Gen does not support denorm. We have to flush input to zero. Signed-off-by: Ruiling Song <ruiling.s...@intel.com> --- backend/src/libocl/tmpl/ocl_math.tmpl.cl | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/backend/src/libocl/tmpl/ocl_math.tmpl.cl b/backend/src/libocl/tmpl/ocl_math.tmpl.cl index c7be47e..248ddd0 100644 --- a/backend/src/libocl/tmpl/ocl_math.tmpl.cl +++ b/backend/src/libocl/tmpl/ocl_math.tmpl.cl @@ -3414,7 +3414,15 @@ OVERLOADABLE float pow(float x, float y) { OVERLOADABLE float rootn(float x, int n) { float ax,re; int sign = 0; + int hx; if( n == 0 )return NAN; + + GEN_OCL_GET_FLOAT_WORD(hx, x); + // Gen does not support denorm, flush to zero + if ((hx & 0x7fffffff) < 0x00800000) { + x = hx < 0 ? -0.0f : 0.0f; + } + //rootn ( x, n ) returns a NaN for x < 0 and n is even. if( x < 0 && 0 == (n&1) ) return NAN; -- 1.7.10.4 _______________________________________________ Beignet mailing list Beignet@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/beignet