[Libclc-dev] [PATCH 3/3] Add half limits
Jeroen Ketema
j.ketema at imperial.ac.uk
Mon Jun 23 08:37:22 PDT 2014
These are apparently only defined by OpenCL 1.2.
I also tried adding HALF_MAX, HALF_MIN, and HALF_EPSILON. However, clang does
not seem to support the ‘h’ suffix even with the cl_khr_fp16 extension enabled.
---
generic/include/clc/float/definitions.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/generic/include/clc/float/definitions.h b/generic/include/clc/float/definitions.h
index cd65324..6d532a5 100644
--- a/generic/include/clc/float/definitions.h
+++ b/generic/include/clc/float/definitions.h
@@ -46,3 +46,18 @@
#define M_PI 0x1.921fb54442d18p+1
#endif
+
+#ifdef cl_khr_fp16
+
+#if __OPENCL_VERSION__ >= CL_VERSION_1_2
+
+#define HALF_DIG 3
+#define HALF_MANT_DIG 11
+#define HALF_MAX_10_EXP +4
+#define HALF_MAX_EXP +16
+#define HALF_MIN_10_EXP -4
+#define HALF_MIN_EXP -13
+
+#endif
+
+#endif
--
1.8.5.2 (Apple Git-48)
More information about the Libclc-dev
mailing list