mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
* test_common: Replace cl_ushort with cl_half (#885) Change-Id: I507eca2084629c3b6f3e7331f062f006edbce434 Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * buffers, pipes, profiling: Replace cl_ushort with cl_half (#885) Change-Id: Id9799322b636af6aa0eec3d4e846d7af8c7f9602 Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * images/kernel_read_write: Replace cl_ushort with cl_half (#885) Change-Id: I922ddb593b6e5631d0f4ea1522c7f75f8770be40 Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com> * half: Replace cl_ushort with cl_half (#885) Change-Id: I484a5bb2b33a7e87805fc6079953c66e5f8d9239 Signed-off-by: Chetankumar Mistry <chetan.mistry@arm.com>
This commit is contained in:
@@ -880,7 +880,7 @@ void generate_random_data( ExplicitType type, size_t count, MTdata d, void *outD
|
||||
cl_ulong *ulongPtr;
|
||||
cl_float *floatPtr;
|
||||
cl_double *doublePtr;
|
||||
cl_ushort *halfPtr;
|
||||
cl_half *halfPtr;
|
||||
size_t i;
|
||||
cl_uint bits = genrand_int32(d);
|
||||
cl_uint bitsLeft = 32;
|
||||
|
||||
@@ -354,7 +354,7 @@ static float Ulp_Error_Half_Float( float test, double reference )
|
||||
return (float) scalbn( testVal - reference, ulp_exp );
|
||||
}
|
||||
|
||||
float Ulp_Error_Half( cl_ushort test, float reference )
|
||||
float Ulp_Error_Half(cl_half test, float reference)
|
||||
{
|
||||
return Ulp_Error_Half_Float(cl_half_to_float(test), reference);
|
||||
}
|
||||
|
||||
@@ -122,9 +122,9 @@ static int vlog_win32(const char *format, ...);
|
||||
|
||||
extern const char *IGetErrorString( int clErrorCode );
|
||||
|
||||
extern float Ulp_Error_Half( cl_ushort test, float reference );
|
||||
extern float Ulp_Error( float test, double reference );
|
||||
extern float Ulp_Error_Double( double test, long double reference );
|
||||
extern float Ulp_Error_Half(cl_half test, float reference);
|
||||
extern float Ulp_Error(float test, double reference);
|
||||
extern float Ulp_Error_Double(double test, long double reference);
|
||||
|
||||
extern const char *GetChannelTypeName( cl_channel_type type );
|
||||
extern int IsChannelTypeSupported( cl_channel_type type );
|
||||
|
||||
@@ -925,7 +925,7 @@ int get_format_min_int( cl_image_format *format )
|
||||
}
|
||||
}
|
||||
|
||||
cl_ushort convert_float_to_half( float f )
|
||||
cl_half convert_float_to_half(float f)
|
||||
{
|
||||
switch( gFloatToHalfRoundingMode )
|
||||
{
|
||||
@@ -1281,10 +1281,9 @@ void read_image_pixel_float( void *imageData, image_descriptor *imageInfo,
|
||||
break;
|
||||
}
|
||||
|
||||
case CL_HALF_FLOAT:
|
||||
{
|
||||
cl_ushort *dPtr = (cl_ushort *)ptr;
|
||||
for( i = 0; i < channelCount; i++ )
|
||||
case CL_HALF_FLOAT: {
|
||||
cl_half *dPtr = (cl_half *)ptr;
|
||||
for (i = 0; i < channelCount; i++)
|
||||
tempData[i] = cl_half_to_float(dPtr[i]);
|
||||
break;
|
||||
}
|
||||
@@ -2397,9 +2396,8 @@ void pack_image_pixel( float *srcVector, const cl_image_format *imageFormat, voi
|
||||
size_t channelCount = get_format_channel_count( imageFormat );
|
||||
switch( imageFormat->image_channel_data_type )
|
||||
{
|
||||
case CL_HALF_FLOAT:
|
||||
{
|
||||
cl_ushort *ptr = (cl_ushort *)outData;
|
||||
case CL_HALF_FLOAT: {
|
||||
cl_half *ptr = (cl_half *)outData;
|
||||
|
||||
switch( gFloatToHalfRoundingMode )
|
||||
{
|
||||
@@ -2569,9 +2567,8 @@ void pack_image_pixel_error( const float *srcVector, const cl_image_format *imag
|
||||
size_t channelCount = get_format_channel_count( imageFormat );
|
||||
switch( imageFormat->image_channel_data_type )
|
||||
{
|
||||
case CL_HALF_FLOAT:
|
||||
{
|
||||
const cl_ushort *ptr = (const cl_ushort *)results;
|
||||
case CL_HALF_FLOAT: {
|
||||
const cl_half *ptr = (const cl_half *)results;
|
||||
|
||||
for( unsigned int i = 0; i < channelCount; i++ )
|
||||
errors[i] = Ulp_Error_Half( ptr[i], srcVector[i] );
|
||||
@@ -2838,25 +2835,28 @@ int DetectFloatToHalfRoundingMode( cl_command_queue q ) // Returns CL_SUCCESS
|
||||
return err;
|
||||
}
|
||||
|
||||
// read the results
|
||||
cl_ushort outBuf[count*4];
|
||||
memset( outBuf, -1, sizeof( outBuf ) );
|
||||
size_t origin[3] = {0,0,0};
|
||||
size_t region[3] = {count,1,1};
|
||||
err = clEnqueueReadImage( q, outImage, CL_TRUE, origin, region, 0, 0, outBuf, 0, NULL, NULL );
|
||||
if( err )
|
||||
// read the results
|
||||
cl_half outBuf[count * 4];
|
||||
memset(outBuf, -1, sizeof(outBuf));
|
||||
size_t origin[3] = { 0, 0, 0 };
|
||||
size_t region[3] = { count, 1, 1 };
|
||||
err = clEnqueueReadImage(q, outImage, CL_TRUE, origin, region, 0, 0,
|
||||
outBuf, 0, NULL, NULL);
|
||||
if (err)
|
||||
{
|
||||
log_error( "Error: could not read output image in DetectFloatToHalfRoundingMode (%d)", err );
|
||||
clReleaseMemObject( inBuf );
|
||||
clReleaseMemObject( outImage );
|
||||
clReleaseKernel( k );
|
||||
log_error("Error: could not read output image in "
|
||||
"DetectFloatToHalfRoundingMode (%d)",
|
||||
err);
|
||||
clReleaseMemObject(inBuf);
|
||||
clReleaseMemObject(outImage);
|
||||
clReleaseKernel(k);
|
||||
return err;
|
||||
}
|
||||
|
||||
// Generate our list of reference results
|
||||
cl_ushort rte_ref[count*4];
|
||||
cl_ushort rtz_ref[count*4];
|
||||
for( size_t i = 0; i < 4 * count; i++ )
|
||||
// Generate our list of reference results
|
||||
cl_half rte_ref[count * 4];
|
||||
cl_half rtz_ref[count * 4];
|
||||
for (size_t i = 0; i < 4 * count; i++)
|
||||
{
|
||||
rte_ref[i] = cl_half_from_float(inp[i], CL_HALF_RTE);
|
||||
rtz_ref[i] = cl_half_from_float(inp[i], CL_HALF_RTZ);
|
||||
|
||||
@@ -275,10 +275,9 @@ template <class T> void read_image_pixel( void *imageData, image_descriptor *ima
|
||||
break;
|
||||
}
|
||||
|
||||
case CL_HALF_FLOAT:
|
||||
{
|
||||
cl_ushort *dPtr = (cl_ushort *)ptr;
|
||||
for( i = 0; i < get_format_channel_count( format ); i++ )
|
||||
case CL_HALF_FLOAT: {
|
||||
cl_half *dPtr = (cl_half *)ptr;
|
||||
for (i = 0; i < get_format_channel_count(format); i++)
|
||||
tempData[i] = (T)cl_half_to_float(dPtr[i]);
|
||||
break;
|
||||
}
|
||||
@@ -639,17 +638,18 @@ protected:
|
||||
size_t mVecSize;
|
||||
};
|
||||
|
||||
extern cl_ushort convert_float_to_half(float f);
|
||||
extern int DetectFloatToHalfRoundingMode( cl_command_queue ); // Returns CL_SUCCESS on success
|
||||
extern cl_half convert_float_to_half(float f);
|
||||
extern int DetectFloatToHalfRoundingMode(
|
||||
cl_command_queue); // Returns CL_SUCCESS on success
|
||||
|
||||
// sign bit: don't care, exponent: maximum value, significand: non-zero
|
||||
static int inline is_half_nan( cl_ushort half ){ return ( half & 0x7fff ) > 0x7c00; }
|
||||
static int inline is_half_nan(cl_half half) { return (half & 0x7fff) > 0x7c00; }
|
||||
|
||||
// sign bit: don't care, exponent: zero, significand: non-zero
|
||||
static int inline is_half_denorm( cl_ushort half ){ return IsHalfSubnormal( half ); }
|
||||
static int inline is_half_denorm(cl_half half) { return IsHalfSubnormal(half); }
|
||||
|
||||
// sign bit: don't care, exponent: zero, significand: zero
|
||||
static int inline is_half_zero( cl_ushort half ){ return ( half & 0x7fff ) == 0; }
|
||||
static int inline is_half_zero(cl_half half) { return (half & 0x7fff) == 0; }
|
||||
|
||||
extern double sRGBmap(float fc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user