Added cl_khr_fp16 extension support for test_explicit_s2v from basic (#1713)

* Added cl_khr_fp16 support for test_explicit_s2v from basic (issue #142, basic)

* Cosmetic corrections

* cosmetic fix

* Added correction to distinguish signed and unsigned char types for ARM architecture tests

* Added missing pieces of convertion procedure to support half

* Corrected condition to verify if additional pragma is necessary (issue #142, basic)

* Add NaN check for half to float conversion

* check-format fixes

* Add NaN check for all float types

Use std::isnan for float/double types.

Change-Id: I005bddccaa3f8490ac59b2aa431ed315733ad143

* Fix Ubuntu build error with isnan macro definition

Change-Id: I671ed826a9631fbbc66d0aa9b674ab00124c7967

* Check format fixes

* NAN define not needed anymore

---------

Co-authored-by: Vasu Penugonda <vpenugon@qti.qualcomm.com>
Co-authored-by: Sreelakshmi Haridas <sharidas@quicinc.com>
This commit is contained in:
Marcin Hajder
2023-10-17 18:38:36 +02:00
committed by GitHub
parent c73d6a341b
commit 72bb711646
5 changed files with 421 additions and 298 deletions

View File

@@ -33,7 +33,11 @@
#include "procs.h"
static const char *fp_kernel_code = R"(
extern cl_half_rounding_mode halfRoundingMode;
namespace {
const char *fp_kernel_code = R"(
%s
__kernel void test_fp(__global TYPE *srcA, __global TYPE *srcB, __global TYPE *dst)
{
@@ -42,8 +46,6 @@ __kernel void test_fp(__global TYPE *srcA, __global TYPE *srcB, __global TYPE *d
dst[tid] = srcA[tid] OP srcB[tid];
})";
extern cl_half_rounding_mode halfRoundingMode;
#define HFF(num) cl_half_from_float(num, halfRoundingMode)
#define HTF(num) cl_half_to_float(num)
@@ -370,6 +372,8 @@ protected:
std::map<size_t, std::string> type2name;
};
} // anonymous namespace
int test_fpmath(cl_device_id device, cl_context context, cl_command_queue queue,
int num_elements)
{