Fp16 math bruteforce staging (#1863)

* Enable fp16 in math bruteforce

* Added modernization of remaining half tests for consistency (issue #142, bruteforce)

* Added kernel types related corrections

* Added more fixes and general cleanup

* Corrected ULP values for half tests (issue #142, bruteforce)

* Corrected presubmit check for clang format

* Added support for ternary, unary_two_result and unary_two_result_i tests for cl_half (issue #142, bruteforce)

* Added missing condition due to vendor's review

* code format correction

* Added check for lack of support for denormals in binary_half scenario

* Corrected procedure to compute nextafter cl_half for flush-to-zero mode

* Added correction for external check of reference value for nextafter test

* Added correction due to code review request

* Changed quantity of tests performed for half in unary and macro_unary procedures from basic

* Added corrections related to code review:

-added binary_operator_half.cpp and binary_two_results_i_half.cpp
-address sanitizer errors fixed
-extending list of special half values
-removed unnecessary relaxed math references in half tests
-corrected conditions to verify ulp narrowing of computation results
-several refactoring and cosmetics corrections

* Print format correction due to failed CI check

* Corrected bug found in code review (fp16 bruteforce)

* Corrections related to code review (cl_khr_fp16 support according to #142)

-gHostFill missing support added
-special half values array extended
-cosmetics and unifying

* clang format applied

* consistency correction

* more consistency corrections for cl_fp16_khr supported tests

* Corrections related to code review (bureforce #142)

* Correction for i_unary_half test capacity

* Corrections related to capacity of cl_khr_fp16 tests in bruteforce (#142)

---------

Co-authored-by: Wawiorko, Grzegorz <grzegorz.wawiorko@intel.com>
This commit is contained in:
Marcin Hajder
2023-12-18 19:15:31 +01:00
committed by GitHub
parent 4216c5323d
commit 87dc09c66f
31 changed files with 6581 additions and 145 deletions

View File

@@ -27,8 +27,11 @@ const char *GetTypeName(ParameterType type)
{
switch (type)
{
case ParameterType::Half: return "half";
case ParameterType::Float: return "float";
case ParameterType::Double: return "double";
case ParameterType::Short: return "short";
case ParameterType::UShort: return "ushort";
case ParameterType::Int: return "int";
case ParameterType::UInt: return "uint";
case ParameterType::Long: return "long";
@@ -41,9 +44,13 @@ const char *GetUndefValue(ParameterType type)
{
switch (type)
{
case ParameterType::Half:
case ParameterType::Float:
case ParameterType::Double: return "NAN";
case ParameterType::Short:
case ParameterType::UShort: return "0x5678";
case ParameterType::Int:
case ParameterType::UInt: return "0x12345678";
@@ -71,14 +78,17 @@ void EmitEnableExtension(std::ostringstream &kernel,
const std::initializer_list<ParameterType> &types)
{
bool needsFp64 = false;
bool needsFp16 = false;
for (const auto &type : types)
{
switch (type)
{
case ParameterType::Double: needsFp64 = true; break;
case ParameterType::Half: needsFp16 = true; break;
case ParameterType::Float:
case ParameterType::Short:
case ParameterType::UShort:
case ParameterType::Int:
case ParameterType::UInt:
case ParameterType::Long:
@@ -89,6 +99,7 @@ void EmitEnableExtension(std::ostringstream &kernel,
}
if (needsFp64) kernel << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n";
if (needsFp16) kernel << "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n";
}
std::string GetBuildOptions(bool relaxed_mode)