Utest: fix a builtin_powr_float fail when OCL_STRICT_CONFORMANCE=0.

Submitted by Yang, Rong R on July 29, 2015, 6:02 a.m.

Details

Message ID 1438149767-25358-1-git-send-email-rong.r.yang@intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Yang, Rong R July 29, 2015, 6:02 a.m.
Need ingore isnan and isinf when OCL_STRICT_CONFORMANCE=0.

Signed-off-by: Yang Rong <rong.r.yang@intel.com>
---
 utests/utest_generator.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/utests/utest_generator.py b/utests/utest_generator.py
index c220575..91cc938 100644
--- a/utests/utest_generator.py
+++ b/utests/utest_generator.py
@@ -110,7 +110,8 @@  def udebug(ulpSize,returnType,function):
 
     float ULPSIZE_NO_FAST_MATH = %s;
     ULPSIZE_FACTOR = select_ulpsize(ULPSIZE_FAST_MATH,ULPSIZE_NO_FAST_MATH);
-    
+    bool fast_math = ULPSIZE_FACTOR == ULPSIZE_FAST_MATH;
+
     if (isinf(cpu_data[index])){
       INFORNAN="INF";
     }
@@ -137,25 +138,25 @@  def udebug(ulpSize,returnType,function):
       }
     else if ((ULPSIZE >= 0 && diff <= ULPSIZE) || (ULPSIZE < 0 && diff == 0)){
       printf("%s expect:%s\\n", log, ULPSIZE);
-      }
+    }
     else
       printf_c("%s expect:%s\\n", log, ULPSIZE);
 #else
     if (isinf(cpu_data[index])){
       sprintf(log, "%s expect:%s\\n", log, INFORNAN);
-      OCL_ASSERTM(isinf(gpu_data[index]),log);
-      }
+      OCL_ASSERTM(isinf(gpu_data[index]) || fast_math,log);
+    }
     else if (isnan(cpu_data[index])){
       sprintf(log, "%s expect:%s\\n", log, INFORNAN);
-      OCL_ASSERTM(isnan(gpu_data[index]),log);
-      }
+      OCL_ASSERTM(isnan(gpu_data[index]) || fast_math,log);
+    }
     else{
       sprintf(log, "%s expect:%s\\n", log, ULPSIZE);
       if (ULPSIZE < 0)
             OCL_ASSERTM(gpu_data[index] == cpu_data[index], log);
       else
             OCL_ASSERTM(fabs(gpu_data[index]-cpu_data[index]) <= ULPSIZE, log);
-      }
+    }
 #endif
   }
 }\n'''%(returnType,Min_ulp(function),\

Comments

LG

> -----Original Message-----

> From: Beignet [mailto:beignet-bounces@lists.freedesktop.org] On Behalf Of

> Yang Rong

> Sent: Wednesday, July 29, 2015 2:03 PM

> To: beignet@lists.freedesktop.org

> Cc: Yang, Rong R

> Subject: [Beignet] [PATCH] Utest: fix a builtin_powr_float fail when

> OCL_STRICT_CONFORMANCE=0.

> 

> Need ingore isnan and isinf when OCL_STRICT_CONFORMANCE=0.

> 

> Signed-off-by: Yang Rong <rong.r.yang@intel.com>

> ---

>  utests/utest_generator.py | 15 ++++++++-------

>  1 file changed, 8 insertions(+), 7 deletions(-)

> 

> diff --git a/utests/utest_generator.py b/utests/utest_generator.py index

> c220575..91cc938 100644

> --- a/utests/utest_generator.py

> +++ b/utests/utest_generator.py

> @@ -110,7 +110,8 @@ def udebug(ulpSize,returnType,function):

> 

>      float ULPSIZE_NO_FAST_MATH = %s;

>      ULPSIZE_FACTOR =

> select_ulpsize(ULPSIZE_FAST_MATH,ULPSIZE_NO_FAST_MATH);

> -

> +    bool fast_math = ULPSIZE_FACTOR == ULPSIZE_FAST_MATH;

> +

>      if (isinf(cpu_data[index])){

>        INFORNAN="INF";

>      }

> @@ -137,25 +138,25 @@ def udebug(ulpSize,returnType,function):

>        }

>      else if ((ULPSIZE >= 0 && diff <= ULPSIZE) || (ULPSIZE < 0 && diff == 0)){

>        printf("%s expect:%s\\n", log, ULPSIZE);

> -      }

> +    }

>      else

>        printf_c("%s expect:%s\\n", log, ULPSIZE);  #else

>      if (isinf(cpu_data[index])){

>        sprintf(log, "%s expect:%s\\n", log, INFORNAN);

> -      OCL_ASSERTM(isinf(gpu_data[index]),log);

> -      }

> +      OCL_ASSERTM(isinf(gpu_data[index]) || fast_math,log);

> +    }

>      else if (isnan(cpu_data[index])){

>        sprintf(log, "%s expect:%s\\n", log, INFORNAN);

> -      OCL_ASSERTM(isnan(gpu_data[index]),log);

> -      }

> +      OCL_ASSERTM(isnan(gpu_data[index]) || fast_math,log);

> +    }

>      else{

>        sprintf(log, "%s expect:%s\\n", log, ULPSIZE);

>        if (ULPSIZE < 0)

>              OCL_ASSERTM(gpu_data[index] == cpu_data[index], log);

>        else

>              OCL_ASSERTM(fabs(gpu_data[index]-cpu_data[index]) <= ULPSIZE, log);

> -      }

> +    }

>  #endif

>    }

>  }\n'''%(returnType,Min_ulp(function),\

> --

> 1.9.1

> 

> _______________________________________________

> Beignet mailing list

> Beignet@lists.freedesktop.org

> http://lists.freedesktop.org/mailman/listinfo/beignet