[clang] 3eb1bc5 - [Clang] Change 'gpuintrin.h' to use target specific address spceas
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 15 08:28:36 PST 2024
Author: Joseph Huber
Date: 2024-11-15T10:28:20-06:00
New Revision: 3eb1bc5edfc69895bfdc0a8ddd31af3969e6aacc
URL: https://github.com/llvm/llvm-project/commit/3eb1bc5edfc69895bfdc0a8ddd31af3969e6aacc
DIFF: https://github.com/llvm/llvm-project/commit/3eb1bc5edfc69895bfdc0a8ddd31af3969e6aacc.diff
LOG: [Clang] Change 'gpuintrin.h' to use target specific address spceas
Summary:
A recent patch allowed the target specific address spcaces to be handled
correctly. The one downside here is that we no long get semantic errors
for initializers, but that will error in the backend anyway.
Added:
Modified:
clang/lib/Headers/amdgpuintrin.h
clang/lib/Headers/nvptxintrin.h
Removed:
################################################################################
diff --git a/clang/lib/Headers/amdgpuintrin.h b/clang/lib/Headers/amdgpuintrin.h
index f4f90b394522d6..5e89eb92c0b58b 100644
--- a/clang/lib/Headers/amdgpuintrin.h
+++ b/clang/lib/Headers/amdgpuintrin.h
@@ -24,11 +24,11 @@ _Pragma("omp begin declare target device_type(nohost)");
_Pragma("omp begin declare variant match(device = {arch(amdgcn)})");
// Type aliases to the address spaces used by the AMDGPU backend.
-#define __gpu_private __attribute__((opencl_private))
-#define __gpu_constant __attribute__((opencl_constant))
-#define __gpu_local __attribute__((opencl_local))
-#define __gpu_global __attribute__((opencl_global))
-#define __gpu_generic __attribute__((opencl_generic))
+#define __gpu_private __attribute__((address_space(5)))
+#define __gpu_constant __attribute__((address_space(4)))
+#define __gpu_local __attribute__((address_space(3)))
+#define __gpu_global __attribute__((address_space(1)))
+#define __gpu_generic __attribute__((address_space(0)))
// Attribute to declare a function as a kernel.
#define __gpu_kernel __attribute__((amdgpu_kernel, visibility("protected")))
diff --git a/clang/lib/Headers/nvptxintrin.h b/clang/lib/Headers/nvptxintrin.h
index 8b68b807cac4f3..962dca9cf03126 100644
--- a/clang/lib/Headers/nvptxintrin.h
+++ b/clang/lib/Headers/nvptxintrin.h
@@ -24,11 +24,11 @@ _Pragma("omp begin declare target device_type(nohost)");
_Pragma("omp begin declare variant match(device = {arch(nvptx64)})");
// Type aliases to the address spaces used by the NVPTX backend.
-#define __gpu_private __attribute__((opencl_private))
-#define __gpu_constant __attribute__((opencl_constant))
-#define __gpu_local __attribute__((opencl_local))
-#define __gpu_global __attribute__((opencl_global))
-#define __gpu_generic __attribute__((opencl_generic))
+#define __gpu_private __attribute__((address_space(5)))
+#define __gpu_constant __attribute__((address_space(4)))
+#define __gpu_local __attribute__((address_space(3)))
+#define __gpu_global __attribute__((address_space(1)))
+#define __gpu_generic __attribute__((address_space(0)))
// Attribute to declare a function as a kernel.
#define __gpu_kernel __attribute__((nvptx_kernel, visibility("protected")))
More information about the cfe-commits
mailing list