Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit e8de8bb

Browse files
authored
[ESIMD] Add tests for esimd::exp2 and esimd::log2 functions (#673)
Signed-off-by: Sergey Dmitriev <[email protected]>
1 parent 8e3692c commit e8de8bb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

SYCL/ESIMD/ext_math.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
//===----------------------------------------------------------------------===//
88
// REQUIRES: gpu
99
// UNSUPPORTED: cuda || hip
10-
// TODO the test started failing on Linux apprently due to host-side changes in
11-
// code generation for log/exp, as device code remained the same as earlier,
12-
// when the test passed.
13-
// XFAIL: linux
1410
// RUN: %clangxx -fsycl %s -o %t.out
1511
// RUN: %GPU_RUN_PLACEHOLDER %t.out
1612

@@ -58,7 +54,7 @@ struct InitDataInRange0_5 {
5854

5955
// --- Math operation identification
6056

61-
enum class MathOp { sin, cos, exp, sqrt, inv, log, rsqrt, trunc };
57+
enum class MathOp { sin, cos, exp, sqrt, inv, log, rsqrt, trunc, exp2, log2 };
6258

6359
// --- Template functions calculating given math operation on host and device
6460

@@ -95,14 +91,16 @@ template <MathOp Op> float HostMathFunc(float X);
9591
} \
9692
}
9793

98-
DEFINE_SIMD_OVERLOADED_STD_SYCL_OP(sin, sin);
99-
DEFINE_SIMD_OVERLOADED_STD_SYCL_OP(cos, cos);
100-
DEFINE_SIMD_OVERLOADED_STD_SYCL_OP(exp, exp);
101-
DEFINE_SIMD_OVERLOADED_STD_SYCL_OP(log, log);
94+
DEFINE_SIMD_OVERLOADED_STD_SYCL_OP(sin, std::sin);
95+
DEFINE_SIMD_OVERLOADED_STD_SYCL_OP(cos, std::cos);
96+
DEFINE_SIMD_OVERLOADED_STD_SYCL_OP(exp, std::exp);
97+
DEFINE_SIMD_OVERLOADED_STD_SYCL_OP(log, std::log);
10298
DEFINE_ESIMD_OP(inv, 1.0f /);
103-
DEFINE_ESIMD_OP(sqrt, sqrt);
104-
DEFINE_ESIMD_OP(rsqrt, 1.0f / sqrt);
105-
DEFINE_ESIMD_RT_OP(trunc, trunc);
99+
DEFINE_ESIMD_OP(sqrt, std::sqrt);
100+
DEFINE_ESIMD_OP(rsqrt, 1.0f / std::sqrt);
101+
DEFINE_ESIMD_OP(exp2, std::exp2);
102+
DEFINE_ESIMD_OP(log2, std::log2);
103+
DEFINE_ESIMD_RT_OP(trunc, std::trunc);
106104

107105
// --- Generic kernel calculating an extended math operation on array elements
108106

@@ -199,6 +197,8 @@ template <int VL> bool test(queue &Q) {
199197
Pass &= test<MathOp::exp, VL>(Q, "exp", InitDataInRange0_5{});
200198
Pass &= test<MathOp::log, VL>(Q, "log", InitDataFuncWide{});
201199
Pass &= test<MathOp::trunc, VL>(Q, "trunc", InitDataFuncWide{});
200+
Pass &= test<MathOp::exp2, VL>(Q, "exp2", InitDataFuncWide{});
201+
Pass &= test<MathOp::log2, VL>(Q, "log2", InitDataFuncWide{});
202202
return Pass;
203203
}
204204

0 commit comments

Comments
 (0)