Replace cl_ushort with cl_half (#885) (#1000)

* 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:
Chetan Mistry
2020-10-02 16:29:05 +01:00
committed by GitHub
parent 615ab64db5
commit 7a735b74e3
15 changed files with 156 additions and 90 deletions

View File

@@ -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);