[Libclc-dev] [PATCH v2 1/1] r600: Use llvm intrinsic to read work dimension information

Jan Vesely jan.vesely at rutgers.edu
Thu Jul 31 09:04:25 PDT 2014


v2: Fix function declaration
    Add range metadata to r600 implementation

CC: Matt Arsenault <Matthew.Arsenault at amd.com>
CC: Jeroen Ketema <j.ketema at imperial.ac.uk>
Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
 generic/include/clc/workitem/get_work_dim.h | 1 +
 r600/lib/SOURCES                            | 1 +
 r600/lib/workitem/get_work_dim.ll           | 8 ++++++++
 3 files changed, 10 insertions(+)
 create mode 100644 generic/include/clc/workitem/get_work_dim.h
 create mode 100644 r600/lib/workitem/get_work_dim.ll

diff --git a/generic/include/clc/workitem/get_work_dim.h b/generic/include/clc/workitem/get_work_dim.h
new file mode 100644
index 0000000..6d19825
--- /dev/null
+++ b/generic/include/clc/workitem/get_work_dim.h
@@ -0,0 +1 @@
+_CLC_DECL uint get_work_dim();
diff --git a/r600/lib/SOURCES b/r600/lib/SOURCES
index d9fc897..1677102 100644
--- a/r600/lib/SOURCES
+++ b/r600/lib/SOURCES
@@ -5,6 +5,7 @@ workitem/get_group_id.ll
 workitem/get_local_size.ll
 workitem/get_local_id.ll
 workitem/get_global_size.ll
+workitem/get_work_dim.ll
 synchronization/barrier.cl
 synchronization/barrier_impl.ll
 shared/vload.cl
diff --git a/r600/lib/workitem/get_work_dim.ll b/r600/lib/workitem/get_work_dim.ll
new file mode 100644
index 0000000..8b47eb1
--- /dev/null
+++ b/r600/lib/workitem/get_work_dim.ll
@@ -0,0 +1,8 @@
+declare i32 @llvm.r600.read.workdim() nounwind readnone
+
+define i32 @get_work_dim() nounwind readnone alwaysinline {
+  %x = call i32 @llvm.r600.read.workdim() nounwind readnone , !range !0
+  ret i32 %x
+}
+
+!0 = metadata !{ i8 1, i8 2, i8 3 }
-- 
1.9.3





More information about the Libclc-dev mailing list