diff options
author | Jan Vesely <jan.vesely@rutgers.edu> | 2016-07-22 17:24:24 +0000 |
---|---|---|
committer | Jan Vesely <jan.vesely@rutgers.edu> | 2016-07-22 17:24:24 +0000 |
commit | a82e080b57a47e9ef8f89c56bdd6b9593db596d2 (patch) | |
tree | 392d06b76bd59817ac4897128a1961dc84c39208 /libclc/r600 | |
parent | 74f02db922b4609095da4218fd3016c2c51d056b (diff) | |
download | llvm-a82e080b57a47e9ef8f89c56bdd6b9593db596d2.zip llvm-a82e080b57a47e9ef8f89c56bdd6b9593db596d2.tar.gz llvm-a82e080b57a47e9ef8f89c56bdd6b9593db596d2.tar.bz2 |
AMDGPU: Implement get_global_offset builtin
Also fix get_global_id to consider offset
No idea how to add this for ptx, so they are stuck with the old get_global_id
implementation.
v2: split to a separate patch
v3: Switch R600 to use implictarg.ptr
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 276443
Diffstat (limited to 'libclc/r600')
-rw-r--r-- | libclc/r600/lib/SOURCES | 1 | ||||
-rw-r--r-- | libclc/r600/lib/workitem/get_global_offset.cl | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/libclc/r600/lib/SOURCES b/libclc/r600/lib/SOURCES index 4178d70..33038f2 100644 --- a/libclc/r600/lib/SOURCES +++ b/libclc/r600/lib/SOURCES @@ -1,4 +1,5 @@ synchronization/barrier_impl.ll +workitem/get_global_offset.cl workitem/get_group_id.cl workitem/get_local_id.cl workitem/get_work_dim.cl diff --git a/libclc/r600/lib/workitem/get_global_offset.cl b/libclc/r600/lib/workitem/get_global_offset.cl new file mode 100644 index 0000000..b38ae33 --- /dev/null +++ b/libclc/r600/lib/workitem/get_global_offset.cl @@ -0,0 +1,11 @@ +#include <clc/clc.h> + +_CLC_DEF uint get_global_offset(uint dim) +{ + __attribute__((address_space(7))) uint * ptr = + (__attribute__((address_space(7))) uint *) + __builtin_r600_implicitarg_ptr(); + if (dim < 3) + return ptr[dim + 1]; + return 0; +} |