Skip to content

Commit 0c91bc6

Browse files
authored
libclc: Stop using r600 asm intrinsic declarations for amdgcn (llvm#181975)
Really the workitem functions should all be moved to generic code and use gpuintrin.h. These implementations were copied from there.
1 parent b92ab89 commit 0c91bc6

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

libclc/opencl/lib/amdgcn/workitem/get_local_size.cl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@
88

99
#include <clc/opencl/opencl-base.h>
1010

11-
uint __clc_amdgcn_get_local_size_x(void) __asm("llvm.r600.read.local.size.x");
12-
uint __clc_amdgcn_get_local_size_y(void) __asm("llvm.r600.read.local.size.y");
13-
uint __clc_amdgcn_get_local_size_z(void) __asm("llvm.r600.read.local.size.z");
14-
1511
_CLC_DEF _CLC_OVERLOAD size_t get_local_size(uint dim) {
1612
switch (dim) {
1713
case 0:
18-
return __clc_amdgcn_get_local_size_x();
14+
return __builtin_amdgcn_workgroup_size_x();
1915
case 1:
20-
return __clc_amdgcn_get_local_size_y();
16+
return __builtin_amdgcn_workgroup_size_y();
2117
case 2:
22-
return __clc_amdgcn_get_local_size_z();
18+
return __builtin_amdgcn_workgroup_size_z();
2319
default:
2420
return 1;
2521
}

libclc/opencl/lib/amdgcn/workitem/get_num_groups.cl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,14 @@
88

99
#include <clc/opencl/opencl-base.h>
1010

11-
uint __clc_amdgcn_get_num_groups_x(void) __asm("llvm.r600.read.ngroups.x");
12-
uint __clc_amdgcn_get_num_groups_y(void) __asm("llvm.r600.read.ngroups.y");
13-
uint __clc_amdgcn_get_num_groups_z(void) __asm("llvm.r600.read.ngroups.z");
14-
1511
_CLC_DEF _CLC_OVERLOAD size_t get_num_groups(uint dim) {
1612
switch (dim) {
1713
case 0:
18-
return __clc_amdgcn_get_num_groups_x();
14+
return __builtin_amdgcn_grid_size_x() / __builtin_amdgcn_workgroup_size_x();
1915
case 1:
20-
return __clc_amdgcn_get_num_groups_y();
16+
return __builtin_amdgcn_grid_size_y() / __builtin_amdgcn_workgroup_size_y();
2117
case 2:
22-
return __clc_amdgcn_get_num_groups_z();
18+
return __builtin_amdgcn_grid_size_z() / __builtin_amdgcn_workgroup_size_z();
2319
default:
2420
return 1;
2521
}

0 commit comments

Comments
 (0)