Fixes for basic explicit_s2v and commonfns degrees for cl_half (#2024)

Basic explicit_s2v:

The verification step was always using round to even when converting a
float to half even for round to zero cores.

Commonfns degrees:

The verification step was only taking into account infinities and not
values that over/underflow. This resulted in an incorrect error
calculation. E.g:

double cpu_result = 175668.85998711039;
cl_half gpu_result = 31743; // this is 65504 when converting to float,
we overflowed.
float error = (cpu_result - gpu_result) * some_factor;

The fix adds the check if( (cl_half) reference == test ) before
calculating the error.
This commit is contained in:
Ahmed
2024-08-13 17:52:07 +01:00
committed by GitHub
parent aa49f3bb53
commit b4c3bf2af2
5 changed files with 90 additions and 61 deletions

View File

@@ -21,6 +21,8 @@
#include <CL/cl_half.h>
extern cl_half_rounding_mode halfRoundingMode;
#define DEBUG 0
#define DEPTH 16
// Limit the maximum code size for any given kernel.
@@ -320,7 +322,8 @@ int test_vector_creation(cl_device_id deviceID, cl_context context,
&j,
((char *)input_data_converted.data())
+ get_explicit_type_size(vecType[type_index]) * j,
kInt, 0, kRoundToEven, vecType[type_index]);
kInt, 0, kRoundToEven, halfRoundingMode,
vecType[type_index]);
}
}