[Beignet] [PATCH v2] add half math function support.

xionghu.luo at intel.com xionghu.luo at intel.com
Fri Dec 19 00:29:32 PST 2014


From: Luo Xionghu <xionghu.luo at intel.com>

simply define the half_xxx functions to xxx.

v2: functions need be defined to native_xxx since they could pass under
non-strict conformance mode except sin/cos/powr/tan.

Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
---
 backend/src/libocl/tmpl/ocl_math.tmpl.h |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.h b/backend/src/libocl/tmpl/ocl_math.tmpl.h
index 69ee3f3..0075797 100644
--- a/backend/src/libocl/tmpl/ocl_math.tmpl.h
+++ b/backend/src/libocl/tmpl/ocl_math.tmpl.h
@@ -117,4 +117,18 @@ OVERLOADABLE float native_sin(float x);
 OVERLOADABLE float native_sqrt(float x);
 OVERLOADABLE float native_tan(float x);
 
-// half  not supported now.
+// half
+#define half_cos cos
+#define half_divide native_divide
+#define half_exp native_exp
+#define half_exp2 native_exp2
+#define half_exp10 native_exp10
+#define half_log native_log
+#define half_log2 native_log2
+#define half_log10 native_log10
+#define half_powr powr
+#define half_recip native_recip
+#define half_rsqrt native_rsqrt
+#define half_sin sin
+#define half_sqrt native_sqrt
+#define half_tan tan
-- 
1.7.9.5



More information about the Beignet mailing list