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

xionghu.luo at intel.com xionghu.luo at intel.com
Thu Dec 18 21:44:13 PST 2014


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

simply define the half_xxx functions to xxx.

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..9ed5eed 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 divide
+#define half_exp exp
+#define half_exp2 exp2
+#define half_exp10 exp10
+#define half_log log
+#define half_log2 log2
+#define half_log10 log10
+#define half_powr powr
+#define half_recip recip
+#define half_rsqrt rsqrt
+#define half_sin sin
+#define half_sqrt sqrt
+#define half_tan tan
-- 
1.7.9.5



More information about the Beignet mailing list