Skip to content

Commit

Permalink
Corrected condition to verify if additional pragma is necessary (issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shajder committed Jul 6, 2023
1 parent 94fa1ef commit 242c767
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions test_conformance/basic/test_explicit_s2v.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "harness/conversions.h"
#include "harness/typeWrappers.h"

namespace {

// clang-format off

#define DECLARE_S2V_IDENT_KERNEL(srctype,dsttype,size) \
Expand Down Expand Up @@ -286,10 +288,10 @@ struct TypesIterator
};

std::stringstream sstr;
if (srcType == kDouble || dstType == kDouble)
if (srcT == kDouble || dstT == kDouble)
sstr << "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n";

if (srcType == kHalf || dstType == kHalf)
if (srcT == kHalf || dstT == kHalf)
sstr << "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n";

snprintf(pragma, sizeof(pragma), "%s", sstr.str().c_str());
Expand Down Expand Up @@ -333,6 +335,8 @@ struct TypesIterator
128; // hardcoded in original test
};

} // anonymous namespace

int test_explicit_s2v(cl_device_id deviceID, cl_context context,
cl_command_queue queue, int num_elements)
{
Expand Down
10 changes: 7 additions & 3 deletions test_conformance/basic/test_fpmath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)

Expand Down Expand Up @@ -370,6 +372,8 @@ struct TypesIterator
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)
{
Expand Down

0 comments on commit 242c767

Please sign in to comment.