Skip to content
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] Only include GPU utils when targeting GPU #84999

Closed
wants to merge 1 commit into from

Conversation

petrhosek
Copy link
Member

This code shouldn't be needed on non-GPU platforms.

This code shouldn't be needed on non-GPU platforms.
@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2024

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

Changes

This code shouldn't be needed on non-GPU platforms.


Full diff: https://github.com/llvm/llvm-project/pull/84999.diff

1 Files Affected:

  • (modified) libc/src/stdlib/rand_util.h (+2)
diff --git a/libc/src/stdlib/rand_util.h b/libc/src/stdlib/rand_util.h
index cadd6b5cdcbb8c..036d6331b47f43 100644
--- a/libc/src/stdlib/rand_util.h
+++ b/libc/src/stdlib/rand_util.h
@@ -9,7 +9,9 @@
 #ifndef LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H
 #define LLVM_LIBC_SRC_STDLIB_RAND_UTIL_H
 
+#ifdef LIBC_TARGET_ARCH_IS_GPU
 #include "src/__support/GPU/utils.h"
+#endif
 #include "src/__support/macros/attributes.h"
 
 namespace LIBC_NAMESPACE {

Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's perfectly okay to include it here since all the utility functions are defined to some default fallback if the target isn't a GPU. That's what I use to include rpc.h from both GPU and CPU consumers. However, if you don't want it included regardless that's fine.

@petrhosek
Copy link
Member Author

I found out that this code doesn't compile on 32-bit platforms because of #85000. I'm fine going with that change and including this file unconditionally if you prefer.

@jhuber6
Copy link
Contributor

jhuber6 commented Mar 13, 2024

I found out that this code doesn't compile on 32-bit platforms because of #85000. I'm fine going with that change and including this file unconditionally if you prefer.

Ah, interesting. Didn't know that. All the targets the GPU cares about currently are 64-bit, so it won't change anything there. But we definitely don't want it failing to compile. Thanks for catching that.

@michaelrj-google
Copy link
Contributor

This patch has been superseded by #66167.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants