[libc-commits] [libc] 9d0a8ed - [libc][NFC] Replace address space with constant GPU utility
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Thu May 16 13:21:46 PDT 2024
Author: Joseph Huber
Date: 2024-05-16T15:13:24-05:00
New Revision: 9d0a8eda0baca51ce61fd5ce7c59864b2b57dcf8
URL: https://github.com/llvm/llvm-project/commit/9d0a8eda0baca51ce61fd5ce7c59864b2b57dcf8
DIFF: https://github.com/llvm/llvm-project/commit/9d0a8eda0baca51ce61fd5ce7c59864b2b57dcf8.diff
LOG: [libc][NFC] Replace address space with constant GPU utility
Summary:
This was written before we had the address space helpers. Using
numerical address spaces is bad so this should be removed.
Added:
Modified:
libc/src/time/gpu/time_utils.cpp
libc/src/time/gpu/time_utils.h
Removed:
################################################################################
diff --git a/libc/src/time/gpu/time_utils.cpp b/libc/src/time/gpu/time_utils.cpp
index 300a72b102360..53a1b2121f7c6 100644
--- a/libc/src/time/gpu/time_utils.cpp
+++ b/libc/src/time/gpu/time_utils.cpp
@@ -15,8 +15,8 @@ namespace LIBC_NAMESPACE {
// insufficient.
// TODO: Once we have another use-case for this we should put it in a common
// device environment struct.
-extern "C" [[gnu::visibility("protected")]] uint64_t
- [[clang::address_space(4)]] __llvm_libc_clock_freq = clock_freq;
+extern "C" [[gnu::visibility("protected")]] gpu::Constant<uint64_t>
+ __llvm_libc_clock_freq = clock_freq;
#endif
} // namespace LIBC_NAMESPACE
diff --git a/libc/src/time/gpu/time_utils.h b/libc/src/time/gpu/time_utils.h
index 3f1fd11c1791c..e7e0e526a532b 100644
--- a/libc/src/time/gpu/time_utils.h
+++ b/libc/src/time/gpu/time_utils.h
@@ -23,8 +23,8 @@ constexpr uint64_t clock_freq = 100000000UL;
// We provide an externally visible symbol such that the runtime can set
// this to the correct value.
-extern "C" [[gnu::visibility("protected")]] uint64_t
- [[clang::address_space(4)]] __llvm_libc_clock_freq;
+extern "C" [[gnu::visibility("protected")]] gpu::Constant<uint64_t>
+ __llvm_libc_clock_freq;
#define GPU_CLOCKS_PER_SEC static_cast<clock_t>(__llvm_libc_clock_freq)
#elif defined(LIBC_TARGET_ARCH_IS_NVPTX)
More information about the libc-commits
mailing list