[libc-commits] [libc] ad554d6 - [libc] Adds AMDGPU gfx941 and gfx942 to archs (#76573)

via libc-commits libc-commits at lists.llvm.org
Fri Dec 29 12:26:23 PST 2023


Author: Jan Patrick Lehr
Date: 2023-12-29T21:26:20+01:00
New Revision: ad554d6dbda5a85fcd6b8be8654c39621d21c49e

URL: https://github.com/llvm/llvm-project/commit/ad554d6dbda5a85fcd6b8be8654c39621d21c49e
DIFF: https://github.com/llvm/llvm-project/commit/ad554d6dbda5a85fcd6b8be8654c39621d21c49e.diff

LOG: [libc] Adds AMDGPU gfx941 and gfx942 to archs (#76573)

This adds the ROCm device libs defines for both target architectures so
that we an compile libc on such GPUs.

Added: 
    

Modified: 
    libc/cmake/modules/prepare_libc_gpu_build.cmake
    libc/src/math/gpu/vendor/amdgpu/platform.h
    libc/src/time/gpu/time_utils.h

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/prepare_libc_gpu_build.cmake b/libc/cmake/modules/prepare_libc_gpu_build.cmake
index f3ccbdc9eb15a3..05c46a64297adc 100644
--- a/libc/cmake/modules/prepare_libc_gpu_build.cmake
+++ b/libc/cmake/modules/prepare_libc_gpu_build.cmake
@@ -5,8 +5,9 @@ endif()
 
 # Set up the target architectures to build the GPU libc for.
 set(all_amdgpu_architectures "gfx700;gfx701;gfx801;gfx803;gfx900;gfx902;gfx906"
-                             "gfx908;gfx90a;gfx90c;gfx940;gfx1010;gfx1030"
-                             "gfx1031;gfx1032;gfx1033;gfx1034;gfx1035;gfx1036"
+                             "gfx908;gfx90a;gfx90c;gfx940;gfx941;gfx942"
+                             "gfx1010;gfx1030;gfx1031;gfx1032;gfx1033;gfx1034"
+                             "gfx1035;gfx1036"
                              "gfx1100;gfx1101;gfx1102;gfx1103;gfx1150;gfx1151")
 set(all_nvptx_architectures "sm_35;sm_37;sm_50;sm_52;sm_53;sm_60;sm_61;sm_62"
                             "sm_70;sm_72;sm_75;sm_80;sm_86;sm_89;sm_90")

diff  --git a/libc/src/math/gpu/vendor/amdgpu/platform.h b/libc/src/math/gpu/vendor/amdgpu/platform.h
index d06a53d7371d20..160a8508cd8b95 100644
--- a/libc/src/math/gpu/vendor/amdgpu/platform.h
+++ b/libc/src/math/gpu/vendor/amdgpu/platform.h
@@ -72,6 +72,10 @@ extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9010;
 extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9012;
 #elif defined(__gfx940__)
 extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9400;
+#elif defined(__gfx941__)
+extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9401;
+#elif defined(__gfx942__)
+extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 9402;
 #elif defined(__gfx1010__)
 extern const LIBC_INLINE_VAR uint32_t __oclc_ISA_version = 10100;
 #elif defined(__gfx1011__)

diff  --git a/libc/src/time/gpu/time_utils.h b/libc/src/time/gpu/time_utils.h
index 8db9668f326de9..ffab6438c71183 100644
--- a/libc/src/time/gpu/time_utils.h
+++ b/libc/src/time/gpu/time_utils.h
@@ -17,7 +17,8 @@ namespace LIBC_NAMESPACE {
 // AMDGPU does not have a single set frequency. Different architectures and
 // cards can have vary values. Here we default to a few known values, but for
 // complete support the frequency needs to be read from the kernel driver.
-#if defined(__gfx1010__) || defined(__gfx1011__) || defined(__gfx1012__) ||    \
+#if defined(__gfx940__) || defined(__gfx941__) || defined(__gfx942__) ||       \
+    defined(__gfx1010__) || defined(__gfx1011__) || defined(__gfx1012__) ||    \
     defined(__gfx1013__) || defined(__gfx1030__) || defined(__gfx1031__) ||    \
     defined(__gfx1032__) || defined(__gfx1033__) || defined(__gfx1034__) ||    \
     defined(__gfx1035__) || defined(__gfx1036__) || defined(__gfx1100__) ||    \
@@ -27,7 +28,7 @@ namespace LIBC_NAMESPACE {
 constexpr uint64_t clock_freq = 100000000;
 #elif defined(__gfx900__) || defined(__gfx902__) || defined(__gfx904__) ||     \
     defined(__gfx906__) || defined(__gfx908__) || defined(__gfx909__) ||       \
-    defined(__gfx90a__) || defined(__gfx90c__) || defined(__gfx940__)
+    defined(__gfx90a__) || defined(__gfx90c__)
 // These architectures use a 25 MHz fixed frequency clock expect for Vega 10
 // which is actually 27 Mhz. We default to 25 MHz in all cases anyway.
 constexpr uint64_t clock_freq = 25000000;


        


More information about the libc-commits mailing list