summaryrefslogtreecommitdiff
path: root/ptx-nvidiacl/lib/workitem/get_num_groups.cl
diff options
context:
space:
mode:
Diffstat (limited to 'ptx-nvidiacl/lib/workitem/get_num_groups.cl')
-rw-r--r--ptx-nvidiacl/lib/workitem/get_num_groups.cl10
1 files changed, 10 insertions, 0 deletions
diff --git a/ptx-nvidiacl/lib/workitem/get_num_groups.cl b/ptx-nvidiacl/lib/workitem/get_num_groups.cl
new file mode 100644
index 0000000..90bdc2e
--- /dev/null
+++ b/ptx-nvidiacl/lib/workitem/get_num_groups.cl
@@ -0,0 +1,10 @@
+#include <clc/clc.h>
+
+_CLC_DEF size_t get_num_groups(uint dim) {
+ switch (dim) {
+ case 0: return __builtin_ptx_read_nctaid_x();
+ case 1: return __builtin_ptx_read_nctaid_y();
+ case 2: return __builtin_ptx_read_nctaid_z();
+ default: return 0;
+ }
+}