-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc] Remove more libc dependencies from the RPC header #116437
base: main
Are you sure you want to change the base?
Conversation
Summary: The end goal is to make `rpc.h` a standalone header so that other projects can include it without leaking `libc` internals. I'm trying to replace stuff slowly before pulling it out all at once to reduce the size of the changes. This patch removes the atomic and a few sparse dependencies. Now we mostly rely on the GPU utils, the sleep function, optional, and the type traits. I'll clean these up in future patches. This removed the old stuff I had around the memcpy, but I think that it's not quite as bad as it once was, as it removes a branch and only uses a few extra VGPRs since I believe the builtin memcpy was improved for AMD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM from the libc side
|
||
namespace LIBC_NAMESPACE_DECL { | ||
namespace rpc { | ||
|
||
/// Conditional to indicate if this process is running on the GPU. | ||
LIBC_INLINE constexpr bool is_process_gpu() { | ||
#if defined(LIBC_TARGET_ARCH_IS_GPU) | ||
#if defined(__NVPTX__) || defined(__AMDGPU__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it make sense to have a gpu_common.h
public header where you could define LIBC_TARGET_ARCH_IS_GPU
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm going to cram all of this in rpc_util.h
. Question is where I should put those two headers when I'm done such that they can be included by everyone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was assuming they were going in include/gpu/rpc_util.h
Summary:
The end goal is to make
rpc.h
a standalone header so that otherprojects can include it without leaking
libc
internals. I'm trying toreplace stuff slowly before pulling it out all at once to reduce the
size of the changes.
This patch removes the atomic and a few sparse dependencies. Now we
mostly rely on the GPU utils, the sleep function, optional, and the
type traits. I'll clean these up in future patches. This removed the old
stuff I had around the memcpy, but I think that it's not quite as bad as
it once was, as it removes a branch and only uses a few extra VGPRs
since I believe the builtin memcpy was improved for AMD.