Skip to content

Commit

Permalink
More corrections related to code review (cl_khr_fp16 for conversions K…
Browse files Browse the repository at this point in the history
  • Loading branch information
shajder committed Nov 29, 2023
1 parent a99d062 commit 26bac40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion test_conformance/conversions/basic_test_conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ void ConversionsTest::TestTypesConversion(const Type &inType,
sat = (SaturationMode)(sat + 1))
{
// skip illegal saturated conversions to float type
if (kSaturated == sat && (outType == kfloat || outType == kdouble))
if (kSaturated == sat
&& (outType == kfloat || outType == kdouble || outType == khalf))
{
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion test_conformance/conversions/conversions_data_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ struct DataInitInfo

#define HFF(num) cl_half_from_float(num, DataInitInfo::halfRoundingMode)
#define HTF(num) cl_half_to_float(num)
#define HFD(num) cl_half_from_double(num, DataInitInfo::halfRoundingMode)

struct DataInitBase : public DataInitInfo
{
Expand Down Expand Up @@ -456,7 +457,7 @@ void DataInfoSpec<InType, OutType, InFP, OutFP>::conv(OutType *out, InType *in)
if (std::is_same<cl_float, OutType>::value)
*out = (OutType)*in;
else if (is_out_half())
*out = static_cast<OutType>(HFF(*in));
*out = static_cast<OutType>(HFD(*in));
else
*out = rint(*in);
}
Expand Down

0 comments on commit 26bac40

Please sign in to comment.