[Beignet] [PATCH OCL20] Backend: Refine script for math.h

Xiuli Pan xiuli.pan at intel.com
Mon Apr 25 07:09:39 UTC 2016


From: Pan Xiuli <xiuli.pan at intel.com>

We need generic memory space pointer for OpenCL2.0 header.

Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
 backend/src/libocl/script/gen_vector.py |  5 +-
 backend/src/libocl/script/ocl_math.def  | 84 +++++++++------------------------
 2 files changed, 24 insertions(+), 65 deletions(-)

diff --git a/backend/src/libocl/script/gen_vector.py b/backend/src/libocl/script/gen_vector.py
index cb562a2..3808057 100755
--- a/backend/src/libocl/script/gen_vector.py
+++ b/backend/src/libocl/script/gen_vector.py
@@ -114,7 +114,7 @@ def _prefix(prefix, dtype):
         return prefix + '_' + dtype
     return dtype
 
-memspaces = ["__local ", "__private ", "__global "]
+memspaces = ["__local ", "__private ", "__global ", "__generic "]
 
 def stripMemSpace(t):
     if t[0:2] == '__':
@@ -254,7 +254,8 @@ class builtinProto():
                     tmpType = line[i]
                 if tmpType == '__local' or   \
                    tmpType == '__private' or \
-                   tmpType == '__global':
+                   tmpType == '__global' or\
+                   tmpType == '__generic':
                    memSpace = tmpType + ' '
                    stripped += 1
                    continue
diff --git a/backend/src/libocl/script/ocl_math.def b/backend/src/libocl/script/ocl_math.def
index b5c1e47..7392108 100644
--- a/backend/src/libocl/script/ocl_math.def
+++ b/backend/src/libocl/script/ocl_math.def
@@ -36,27 +36,13 @@ gentypef fmin (gentypef x, float y)
 gentypeh fmin (gentypeh x, half y)
 gentyped fmin (gentyped x, double y)
 gentype fmod (gentype x, gentype y)
-gentype fract (gentype x, __global gentype *iptr)
-gentype fract (gentype x, __local gentype *iptr)
-gentype fract (gentype x, __private gentype *iptr)
-floatn frexp (floatn x, __global intn *exp)
-floatn frexp (floatn x, __local intn *exp)
-floatn frexp (floatn x, __private intn *exp)
-float frexp (float x, __global int *exp)
-float frexp (float x, __local int *exp)
-float frexp (float x, __private int *exp)
-halfn frexp (halfn x, __global intn *exp)
-halfn frexp (halfn x, __local intn *exp)
-halfn frexp (halfn x, __private intn *exp)
-half frexp (half x, __global int *exp)
-half frexp (half x, __local int *exp)
-half frexp (half x, __private int *exp)
-doublen frexp (doublen x, __global intn *exp)
-doublen frexp (doublen x, __local intn *exp)
-doublen frexp (doublen x, __private intn *exp)
-double frexp (double x, __global int *exp)
-double frexp (double x, __local int *exp)
-double frexp (double x, __private int *exp)
+gentype fract (gentype x, __generic gentype *iptr)
+floatn frexp (floatn x, __generic intn *exp)
+float frexp (float x, __generic int *exp)
+halfn frexp (halfn x, __generic intn *exp)
+half frexp (half x, __generic int *exp)
+doublen frexp (doublen x, __generic intn *exp)
+double frexp (double x, __generic int *exp)
 gentype hypot (gentype x, gentype y)
 intn ilogb (floatn x)
 int ilogb (float x)
@@ -74,24 +60,12 @@ doublen ldexp (doublen x, intn k)
 doublen ldexp (doublen x, int k)
 double ldexp (double x, int k)
 gentype lgamma (gentype x)
-floatn lgamma_r (floatn x, __global intn *signp)
-floatn lgamma_r (floatn x, __local intn *signp)
-floatn lgamma_r (floatn x, __private intn *signp)
-float lgamma_r (float x, __global int *signp)
-float lgamma_r (float x, __local int *signp)
-float lgamma_r (float x,   __private int *signp)
-halfn lgamma_r (halfn x, __global intn *signp)
-halfn lgamma_r (halfn x, __local intn *signp)
-halfn lgamma_r (halfn x, __private intn *signp)
-half lgamma_r (half x, __global int *signp)
-half lgamma_r (half x, __local int *signp)
-half lgamma_r (half x,   __private int *signp)
-#doublen lgamma_r (doublen x, __global intn *signp)
-#doublen lgamma_r (doublen x, __local intn *signp)
-#doublen lgamma_r (doublen x, __private intn *signp)
-#double lgamma_r (double x, __global int *signp)
-#double lgamma_r (double x, __local int *signp)
-#double lgamma_r (double x, __private int *signp)
+floatn lgamma_r (floatn x, __generic intn *signp)
+float lgamma_r (float x, __generic int *signp)
+halfn lgamma_r (halfn x, __generic intn *signp)
+half lgamma_r (half x, __generic int *signp)
+#doublen lgamma_r (doublen x, __generic intn *signp)
+#double lgamma_r (double x, __generic int *signp)
 gentype log (gentype)
 gentype log2 (gentype)
 gentype log10 (gentype)
@@ -100,9 +74,7 @@ gentype logb (gentype x)
 gentype mad (gentype a, gentype b, gentype c)
 gentype maxmag (gentype x, gentype y)
 gentype minmag (gentype x, gentype y)
-gentype modf (gentype x, __global gentype *iptr)
-gentype modf (gentype x, __local gentype *iptr)
-gentype modf (gentype x, __private gentype *iptr)
+gentype modf (gentype x, __generic gentype *iptr)
 floatn nan (uintn nancode)
 float nan (uint nancode)
 halfn nan (ushortn nancode)
@@ -119,24 +91,12 @@ doublen pown (doublen x, intn y)
 double pown (double x, int y)
 gentype powr (gentype x, gentype y)
 gentype remainder (gentype x, gentype y)
-floatn remquo (floatn x, floatn y, __global intn *quo)
-floatn remquo (floatn x, floatn y, __local intn *quo)
-floatn remquo (floatn x, floatn y, __private intn *quo)
-float remquo (float x, float y, __global int *quo)
-float remquo (float x, float y, __local int *quo)
-float remquo (float x, float y, __private int *quo)
-halfn remquo (halfn x, halfn y, __global intn *quo)
-halfn remquo (halfn x, halfn y, __local intn *quo)
-halfn remquo (halfn x, halfn y, __private intn *quo)
-half remquo (half x, half y, __global int *quo)
-half remquo (half x, half y, __local int *quo)
-half remquo (half x, half y, __private int *quo)
-doublen remquo (doublen x, doublen y, __global intn *quo)
-doublen remquo (doublen x, doublen y, __local intn *quo)
-doublen remquo (doublen x, doublen y, __private intn *quo)
-double remquo (double x, double y, __global int *quo)
-double remquo (double x, double y, __local int *quo)
-double remquo (double x, double y, __private int *quo)
+floatn remquo (floatn x, floatn y, __generic intn *quo)
+float remquo (float x, float y, __generic int *quo)
+halfn remquo (halfn x, halfn y, __generic intn *quo)
+half remquo (half x, half y, __generic int *quo)
+doublen remquo (doublen x, doublen y, __generic intn *quo)
+double remquo (double x, double y, __generic int *quo)
 gentype rint (gentype)
 floatn rootn (floatn x, intn y)
 halfn rootn (halfn x, intn y)
@@ -145,9 +105,7 @@ doublen rootn (double x, int y)
 gentype round (gentype x)
 gentype rsqrt (gentype)
 gentype sin (gentype)
-gentype sincos (gentype x, __global gentype *cosval)
-gentype sincos (gentype x, __local gentype *cosval)
-gentype sincos (gentype x, __private gentype *cosval)
+gentype sincos (gentype x, __generic gentype *cosval)
 gentype sinh (gentype)
 gentype sinpi (gentype x)
 gentype sqrt (gentype)
-- 
2.5.0



More information about the Beignet mailing list