1
- // UNSUPPORTED: cuda || hip
2
- // CUDA and HIP don't support printf.
1
+ // UNSUPPORTED: hip
2
+ // HIP doesn't support printf.
3
+ // CUDA doesn't support vector format specifiers ("%v").
3
4
//
4
5
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
5
6
// RUN: %HOST_RUN_PLACEHOLDER %t.out %HOST_CHECK_PLACEHOLDER
@@ -59,7 +60,7 @@ int main() {
59
60
{
60
61
// You can declare format string in non-global scope, but in this case
61
62
// static keyword is required
62
- static const CONSTANT char format[] = " %f \n " ;
63
+ static const CONSTANT char format[] = " %.1f \n " ;
63
64
ext::oneapi::experimental::printf (format, 33 .4f );
64
65
ext::oneapi::experimental::printf (format, -33 .4f );
65
66
}
@@ -68,8 +69,8 @@ int main() {
68
69
69
70
// Vectors
70
71
sycl::vec<int , 4 > v4{5 , 6 , 7 , 8 };
71
- #ifdef __SYCL_DEVICE_ONLY__
72
- // On device side , vectors can be printed via native OpenCL types:
72
+ #if defined( __SYCL_DEVICE_ONLY__) && defined(__SPIR__)
73
+ // On SPIRV devices , vectors can be printed via native OpenCL types:
73
74
using ocl_int4 = sycl::vec<int , 4 >::vector_t ;
74
75
{
75
76
static const CONSTANT char format[] = " %v4d\n " ;
@@ -83,7 +84,7 @@ int main() {
83
84
(int32_t )v4.x ());
84
85
}
85
86
#else
86
- // On host side you always have to print them by-element:
87
+ // Otherwise you always have to print them by-element:
87
88
ext::oneapi::experimental::printf (format_vec, (int32_t )v4.x (),
88
89
(int32_t )v4.y (), (int32_t )v4.z (),
89
90
(int32_t )v4.w ());
0 commit comments