Skip to content

Commit 3eb1bc5

Browse files
committed
[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.
1 parent 9513f2f commit 3eb1bc5

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

clang/lib/Headers/amdgpuintrin.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ _Pragma("omp begin declare target device_type(nohost)");
2424
_Pragma("omp begin declare variant match(device = {arch(amdgcn)})");
2525

2626
// Type aliases to the address spaces used by the AMDGPU backend.
27-
#define __gpu_private __attribute__((opencl_private))
28-
#define __gpu_constant __attribute__((opencl_constant))
29-
#define __gpu_local __attribute__((opencl_local))
30-
#define __gpu_global __attribute__((opencl_global))
31-
#define __gpu_generic __attribute__((opencl_generic))
27+
#define __gpu_private __attribute__((address_space(5)))
28+
#define __gpu_constant __attribute__((address_space(4)))
29+
#define __gpu_local __attribute__((address_space(3)))
30+
#define __gpu_global __attribute__((address_space(1)))
31+
#define __gpu_generic __attribute__((address_space(0)))
3232

3333
// Attribute to declare a function as a kernel.
3434
#define __gpu_kernel __attribute__((amdgpu_kernel, visibility("protected")))

clang/lib/Headers/nvptxintrin.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ _Pragma("omp begin declare target device_type(nohost)");
2424
_Pragma("omp begin declare variant match(device = {arch(nvptx64)})");
2525

2626
// Type aliases to the address spaces used by the NVPTX backend.
27-
#define __gpu_private __attribute__((opencl_private))
28-
#define __gpu_constant __attribute__((opencl_constant))
29-
#define __gpu_local __attribute__((opencl_local))
30-
#define __gpu_global __attribute__((opencl_global))
31-
#define __gpu_generic __attribute__((opencl_generic))
27+
#define __gpu_private __attribute__((address_space(5)))
28+
#define __gpu_constant __attribute__((address_space(4)))
29+
#define __gpu_local __attribute__((address_space(3)))
30+
#define __gpu_global __attribute__((address_space(1)))
31+
#define __gpu_generic __attribute__((address_space(0)))
3232

3333
// Attribute to declare a function as a kernel.
3434
#define __gpu_kernel __attribute__((nvptx_kernel, visibility("protected")))

0 commit comments

Comments
 (0)