[Beignet] [PATCH 1/2] Benchmark: Evaluate internal sine and cosine performance on intervals

Grigore Lupescu grigore.lupescu at intel.com
Thu Mar 17 17:07:28 UTC 2016


From: Grigore Lupescu <grigore.lupescu at intel.com>

Signed-off-by: Grigore Lupescu <grigore.lupescu at intel.com>
---
 kernels/bench_math.cl | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernels/bench_math.cl b/kernels/bench_math.cl
index b53ba50..a6b6b94 100644
--- a/kernels/bench_math.cl
+++ b/kernels/bench_math.cl
@@ -185,7 +185,11 @@ kernel void bench_math_sin(
 #if defined(BENCHMARK_NATIVE)
     result = native_sin(result); /* calls native */
 #else
-    result = sin(result); /* calls internal slow */
+    result = sin(result);	/* calls internal, random complexity */
+    //result = sin(0.1f + result); /* calls internal, (1) no reduction */
+    //result = sin(2.f + result); /* calls internal, (2) fast reduction */
+    //result = sin(4001 + result); /* calls internal, (3) slow reduction */
+    result *= 0x1p-16;
 #endif
   }
 
@@ -206,7 +210,11 @@ kernel void bench_math_cos(
 #if defined(BENCHMARK_NATIVE)
     result = native_cos(result); /* calls native */
 #else
-    result = cos(result); /* calls internal slow */
+    result = cos(result);	/* calls internal, random complexity */
+    //result = cos(0.1f + result); /* calls internal, (1) no reduction */
+    //result = cos(2.f + result); /* calls internal, (2) fast reduction */
+    //result = cos(4001.f + result); /* calls internal, (3) slow reduction */
+    result *= 0x1p-16;
 #endif
   }
   dst[get_global_id(0)] = result;
-- 
2.5.0



More information about the Beignet mailing list