Skip to content

Commit 7867089

Browse files
authored
[SYCL] Fix isordered built-in function realisation (#2841)
1 parent 19f5ad6 commit 7867089

File tree

2 files changed

+39
-3
lines changed

2 files changed

+39
-3
lines changed

sycl/source/detail/builtins_relational.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,13 @@ MAKE_1V_FUNC(IsNormal, __vIsNormal, s::cl_short, s::cl_half)
351351

352352
// (Ordered) // isordered
353353
__SYCL_EXPORT s::cl_int Ordered(s::cl_float x, s::cl_float y) __NOEXC {
354-
return __vOrdered(x, y);
354+
return __sOrdered(x, y);
355355
}
356356
__SYCL_EXPORT s::cl_int Ordered(s::cl_double x, s::cl_double y) __NOEXC {
357-
return __vOrdered(x, y);
357+
return __sOrdered(x, y);
358358
}
359359
__SYCL_EXPORT s::cl_int Ordered(s::cl_half x, s::cl_half y) __NOEXC {
360-
return __vOrdered(x, y);
360+
return __sOrdered(x, y);
361361
}
362362
MAKE_1V_2V_FUNC(Ordered, __vOrdered, s::cl_int, s::cl_float, s::cl_float)
363363
MAKE_1V_2V_FUNC(Ordered, __vOrdered, s::cl_long, s::cl_double, s::cl_double)

sycl/test/regression/isordered.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// RUN: %clangxx -fsycl %s -o %t.out
2+
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
3+
4+
#include <CL/sycl.hpp>
5+
6+
int main() {
7+
cl::sycl::range<1> ndRng(3);
8+
int32_t kernelResult[3];
9+
cl::sycl::queue testQueue;
10+
{
11+
cl::sycl::buffer<int32_t, 1> buffer(&kernelResult[0], ndRng);
12+
testQueue.submit([&](cl::sycl::handler &h) {
13+
auto resultPtr =
14+
buffer.template get_access<cl::sycl::access::mode::write>(h);
15+
h.single_task<class kernel>([=]() {
16+
float inputData_0F(0.1);
17+
float inputData_1F(0.5);
18+
resultPtr[0] = cl::sycl::isordered(inputData_0F, inputData_1F);
19+
20+
double inputData_0D(0.2);
21+
double inputData_1D(0.3);
22+
resultPtr[1] = cl::sycl::isordered(inputData_0D, inputData_1D);
23+
24+
half inputData_0H(0.3);
25+
half inputData_1H(0.9);
26+
resultPtr[2] = cl::sycl::isordered(inputData_0H, inputData_1H);
27+
});
28+
});
29+
}
30+
// Should be 1 according to spec since it's a scalar type not a vector
31+
assert(kernelResult[0] == 1 && "Incorrect result");
32+
assert(kernelResult[1] == 1 && "Incorrect result");
33+
assert(kernelResult[2] == 1 && "Incorrect result");
34+
35+
return 0;
36+
}

0 commit comments

Comments
 (0)