[Libclc-dev] [PATCH 1/1] add __kernel_exec macros

Jan Vesely via Libclc-dev libclc-dev at lists.llvm.org
Thu Jul 27 09:26:51 PDT 2017


also consolidate macros into one file, and rename to clcmacros.h

Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
---
Hi Aaron,

to complement you work on clover provided macros, I think this one is
better done in libclc.

thanks,
Jan

Passes newly posted kernel_exec piglit

 generic/include/clc/clc.h        |  2 +-
 generic/include/clc/clcmacros.h  | 18 ++++++++++++++++++
 generic/include/clc/clctypes.h   |  2 --
 generic/include/clc/clcversion.h |  8 --------
 4 files changed, 19 insertions(+), 11 deletions(-)
 create mode 100644 generic/include/clc/clcmacros.h
 delete mode 100644 generic/include/clc/clcversion.h

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index 4c29214..5130632 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -21,7 +21,7 @@
 #include <clc/as_type.h>
 
 /* 6.9 Preprocessor Directives and Macros */
-#include <clc/clcversion.h>
+#include <clc/clcmacros.h>
 
 /* 6.11.1 Work-Item Functions */
 #include <clc/workitem/get_global_size.h>
diff --git a/generic/include/clc/clcmacros.h b/generic/include/clc/clcmacros.h
new file mode 100644
index 0000000..d821a36
--- /dev/null
+++ b/generic/include/clc/clcmacros.h
@@ -0,0 +1,18 @@
+/* 6.9 Preprocessor Directives and Macros
+ * Some of these are handled by clang or passed by clover */
+#if __OPENCL_VERSION__ >= 110
+#define CLC_VERSION_1_0 100
+#define CLC_VERSION_1_1 110
+#endif
+
+#if __OPENCL_VERSION__ >= 120
+#define CLC_VERSION_1_2 120
+#endif
+
+#define NULL ((void*)NULL)
+
+#define __kernel_exec(X, typen) __kernel \
+                                __attribute__((work_group_size_hint(X, 1, 1))) \
+                                __attribute__((vec_type_hint(typen)))
+
+#define kernel_exec(X, typen) __kernel_exec(X, typen)
diff --git a/generic/include/clc/clctypes.h b/generic/include/clc/clctypes.h
index 2e3db60..8308bda 100644
--- a/generic/include/clc/clctypes.h
+++ b/generic/include/clc/clctypes.h
@@ -85,5 +85,3 @@ typedef __attribute__((ext_vector_type(4))) double double4;
 typedef __attribute__((ext_vector_type(8))) double double8;
 typedef __attribute__((ext_vector_type(16))) double double16;
 #endif
-
-#define NULL ((void *)0)
diff --git a/generic/include/clc/clcversion.h b/generic/include/clc/clcversion.h
deleted file mode 100644
index 57c989e..0000000
--- a/generic/include/clc/clcversion.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#if __OPENCL_VERSION__ >= 110
-#define CLC_VERSION_1_0 100
-#define CLC_VERSION_1_1 110
-#endif
-
-#if __OPENCL_VERSION__ >= 120
-#define CLC_VERSION_1_2 120
-#endif
-- 
2.13.3



More information about the Libclc-dev mailing list