[Libclc-dev] [PATCH 1/3] Add halfN types and enable fp16 when generating builtin declarations

Aaron Watry via Libclc-dev libclc-dev at lists.llvm.org
Fri Sep 1 13:16:59 PDT 2017


Uses the same mechanism to enable fp16 as we use for fp64 when
processing clc.h

Signed-off-by: Aaron Watry <awatry at gmail.com>
Cc: Jan Vesely <jan.vesely at rutgers.edu>
---
 generic/include/clc/clc.h      | 4 ++++
 generic/include/clc/clctypes.h | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/generic/include/clc/clc.h b/generic/include/clc/clc.h
index deb9d70..059cb7f 100644
--- a/generic/include/clc/clc.h
+++ b/generic/include/clc/clc.h
@@ -8,6 +8,10 @@
 #pragma OPENCL EXTENSION cl_khr_fp64 : enable
 #endif
 
+#ifdef cl_khr_fp16
+#pragma OPENCL EXTENSION cl_khr_fp16 : enable
+#endif
+
 /* Function Attributes */
 #include <clc/clcfunc.h>
 
diff --git a/generic/include/clc/clctypes.h b/generic/include/clc/clctypes.h
index 8308bda..76b816d 100644
--- a/generic/include/clc/clctypes.h
+++ b/generic/include/clc/clctypes.h
@@ -85,3 +85,11 @@ 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
+
+#ifdef cl_khr_fp16
+typedef __attribute__((ext_vector_type(2))) half half2;
+typedef __attribute__((ext_vector_type(3))) half half3;
+typedef __attribute__((ext_vector_type(4))) half half4;
+typedef __attribute__((ext_vector_type(8))) half half8;
+typedef __attribute__((ext_vector_type(16))) half half16;
+#endif
-- 
2.11.0



More information about the Libclc-dev mailing list