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

Commit 9ba47b7

Browse files
authored
Fix windows compfail for bfloat16 isnan test (#1520)
Signed-off-by: jinge90 <[email protected]>
1 parent d260b6d commit 9ba47b7

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

SYCL/BFloat16/bfloat16_builtins.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,26 @@ bool check(bool a, bool b) { return (a == b); }
222222
assert(err == 0); \
223223
assert(std::isnan(check_nan));
224224

225+
// The intention to introduce a proxy function for isnan is to bypass a compfail
226+
// on Win64 platform. If we simply pass 'isnan' to testing macro, compiler will
227+
// report 'ambiguous call' error. This is becayse MSVC header correct_math.h
228+
// includes an isnan definition too. In order to bypass this without modifying
229+
// current test infrastructure, we add proxy function for 'isnan' and uses full
230+
// name to avoid amibiguity.
231+
bool isnan_test_proxy(sycl::ext::oneapi::bfloat16 x) {
232+
return sycl::ext::oneapi::experimental::isnan(x);
233+
}
234+
template <size_t N>
235+
sycl::marray<bool, N>
236+
isnan_test_proxy(sycl::marray<sycl::ext::oneapi::bfloat16, N> x) {
237+
return sycl::ext::oneapi::experimental::isnan(x);
238+
}
239+
bool isnan_test_proxy(float x) { return sycl::isnan(x); }
240+
template <size_t N>
241+
sycl::marray<bool, N> isnan_test_proxy(sycl::marray<float, N> x) {
242+
return sycl::isnan(x);
243+
}
244+
225245
int main() {
226246
queue q;
227247

@@ -246,7 +266,7 @@ int main() {
246266

247267
// Insert NAN value in a to test isnan
248268
a[0] = a[N - 1] = NAN;
249-
TEST_BUILTIN_1(isnan, bool);
269+
TEST_BUILTIN_1(isnan_test_proxy, bool);
250270
}
251271
return 0;
252272
}

0 commit comments

Comments
 (0)