diff options
| author | Konstantin Zhuravlyov <kzhuravl_dev@outlook.com> | 2016-04-07 19:54:19 +0000 |
|---|---|---|
| committer | Konstantin Zhuravlyov <kzhuravl_dev@outlook.com> | 2016-04-07 19:54:19 +0000 |
| commit | f8a81f869fb94c78c4944ba349c07abcd3bb9675 (patch) | |
| tree | 03392a32d07635dffd082d393b1f8b8cf1704d7f /libclc | |
| parent | 7ed4f988c1ce84e91df57920af629e7149cee406 (diff) | |
| download | bcm5719-llvm-f8a81f869fb94c78c4944ba349c07abcd3bb9675.tar.gz bcm5719-llvm-f8a81f869fb94c78c4944ba349c07abcd3bb9675.zip | |
[AMDGPU] Implement get_local_size for amdgcn--amdhsa triple
Differential Revision: http://reviews.llvm.org/D18284
llvm-svn: 265713
Diffstat (limited to 'libclc')
| -rw-r--r-- | libclc/.gitignore | 1 | ||||
| -rw-r--r-- | libclc/amdgcn-amdhsa/lib/OVERRIDES | 0 | ||||
| -rw-r--r-- | libclc/amdgcn-amdhsa/lib/SOURCES | 1 | ||||
| -rw-r--r-- | libclc/amdgcn-amdhsa/lib/workitem/get_local_size.ll | 35 | ||||
| -rwxr-xr-x | libclc/configure.py | 5 |
5 files changed, 41 insertions, 1 deletions
diff --git a/libclc/.gitignore b/libclc/.gitignore index e19653fd1cc..d0f6856c29b 100644 --- a/libclc/.gitignore +++ b/libclc/.gitignore @@ -1,5 +1,6 @@ Makefile amdgcn-- +amdgcn--amdhsa build/*.pyc built_libs/ generic-- diff --git a/libclc/amdgcn-amdhsa/lib/OVERRIDES b/libclc/amdgcn-amdhsa/lib/OVERRIDES new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/libclc/amdgcn-amdhsa/lib/OVERRIDES diff --git a/libclc/amdgcn-amdhsa/lib/SOURCES b/libclc/amdgcn-amdhsa/lib/SOURCES new file mode 100644 index 00000000000..b33368de9e0 --- /dev/null +++ b/libclc/amdgcn-amdhsa/lib/SOURCES @@ -0,0 +1 @@ +workitem/get_local_size.ll diff --git a/libclc/amdgcn-amdhsa/lib/workitem/get_local_size.ll b/libclc/amdgcn-amdhsa/lib/workitem/get_local_size.ll new file mode 100644 index 00000000000..c4df0279266 --- /dev/null +++ b/libclc/amdgcn-amdhsa/lib/workitem/get_local_size.ll @@ -0,0 +1,35 @@ +declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0 + +define i32 @get_local_size(i32 %dim) #1 { + %dispatch_ptr = call noalias nonnull dereferenceable(64) i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() + %dispatch_ptr_i32 = bitcast i8 addrspace(2)* %dispatch_ptr to i32 addrspace(2)* + %xy_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* %dispatch_ptr_i32, i64 1 + %xy_size = load i32, i32 addrspace(2)* %xy_size_ptr, align 4, !invariant.load !0 + switch i32 %dim, label %default [ + i32 0, label %x_dim + i32 1, label %y_dim + i32 2, label %z_dim + ] + +x_dim: + %x_size = and i32 %xy_size, 65535 + ret i32 %x_size + +y_dim: + %y_size = lshr i32 %xy_size, 16 + ret i32 %y_size + +z_dim: + %z_size_ptr = getelementptr inbounds i32, i32 addrspace(2)* %dispatch_ptr_i32, i64 2 + %z_size = load i32, i32 addrspace(2)* %z_size_ptr, align 4, !invariant.load !0, !range !1 + ret i32 %z_size + +default: + ret i32 1 +} + +attributes #0 = { nounwind readnone } +attributes #1 = { alwaysinline norecurse nounwind readonly } + +!0 = !{} +!1 = !{ i32 0, i32 257 } diff --git a/libclc/configure.py b/libclc/configure.py index 2663212a3cf..63f5adab3c3 100755 --- a/libclc/configure.py +++ b/libclc/configure.py @@ -102,6 +102,9 @@ available_targets = { 'amdgcn--': { 'devices' : [{'gpu' : 'tahiti', 'aliases' : ['pitcairn', 'verde', 'oland', 'hainan', 'bonaire', 'kabini', 'kaveri', 'hawaii','mullins','tonga','carrizo','iceland','fiji','stoney'], 'defines' : {}} ]}, + 'amdgcn--amdhsa': { 'devices' : + [{'gpu' : '', 'aliases' : ['bonaire', 'hawaii', 'kabini', 'kaveri', 'mullins', 'carrizo', 'stoney', 'fiji', 'iceland', 'tonga'], + 'defines' : {}} ]}, 'nvptx--' : { 'devices' : [{'gpu' : '', 'aliases' : [], 'defines' : {'all' : ['cl_khr_fp64']}}]}, 'nvptx64--' : { 'devices' : [{'gpu' : '', 'aliases' : [], @@ -112,7 +115,7 @@ available_targets = { 'defines' : {'all' : ['cl_khr_fp64']}}]}, } -default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--', 'amdgcn--'] +default_targets = ['nvptx--nvidiacl', 'nvptx64--nvidiacl', 'r600--', 'amdgcn--', 'amdgcn--amdhsa'] targets = args if not targets: |

