1111#include < cstdint>
1212#include < iostream>
1313
14+ /* https://github.com/intel/llvm/pull/2246: namespace compatibility mode*/
15+ __SYCL_INLINE_NAMESPACE (cl) {
16+ namespace sycl {
17+ namespace intel {};
18+ namespace ONEAPI {
19+ using namespace cl ::sycl::intel;
20+ }}};
21+
1422using namespace cl ::sycl;
1523
1624// According to OpenCL C spec, the format string must be in constant address
@@ -40,7 +48,7 @@ int main() {
4048 Queue.submit ([&](handler &CGH) {
4149 CGH.single_task <class integral >([=]() {
4250 // String
43- intel ::experimental::printf (format_hello_world);
51+ ONEAPI ::experimental::printf (format_hello_world);
4452 // Due to a bug in Intel CPU Runtime for OpenCL on Windows, information
4553 // printed using such format strings (without %-specifiers) might
4654 // appear in different order if output is redirected to a file or
@@ -49,8 +57,8 @@ int main() {
4957 // CHECK: {{(Hello, World!)?}}
5058
5159 // Integral types
52- intel ::experimental::printf (format_int, (int32_t )123 );
53- intel ::experimental::printf (format_int, (int32_t )-123 );
60+ ONEAPI ::experimental::printf (format_int, (int32_t )123 );
61+ ONEAPI ::experimental::printf (format_int, (int32_t )-123 );
5462 // CHECK: 123
5563 // CHECK-NEXT: -123
5664
@@ -59,8 +67,8 @@ int main() {
5967 // You can declare format string in non-global scope, but in this case
6068 // static keyword is required
6169 static const CONSTANT char format[] = " %f\n " ;
62- intel ::experimental::printf (format, 33 .4f );
63- intel ::experimental::printf (format, -33 .4f );
70+ ONEAPI ::experimental::printf (format, 33 .4f );
71+ ONEAPI ::experimental::printf (format, -33 .4f );
6472 }
6573 // CHECK-NEXT: 33.4
6674 // CHECK-NEXT: -33.4
@@ -72,21 +80,21 @@ int main() {
7280 using ocl_int4 = cl::sycl::vec<int , 4 >::vector_t ;
7381 {
7482 static const CONSTANT char format[] = " %v4d\n " ;
75- intel ::experimental::printf (format, (ocl_int4)v4);
83+ ONEAPI ::experimental::printf (format, (ocl_int4)v4);
7684 }
7785
7886 // However, you are still able to print them by-element:
7987 {
80- intel ::experimental::printf (format_vec, (int32_t )v4.w (),
88+ ONEAPI ::experimental::printf (format_vec, (int32_t )v4.w (),
8189 (int32_t )v4.z (), (int32_t )v4.y (),
8290 (int32_t )v4.x ());
8391 }
8492#else
8593 // On host side you always have to print them by-element:
86- intel ::experimental::printf (format_vec, (int32_t )v4.x (),
94+ ONEAPI ::experimental::printf (format_vec, (int32_t )v4.x (),
8795 (int32_t )v4.y (), (int32_t )v4.z (),
8896 (int32_t )v4.w ());
89- intel ::experimental::printf (format_vec, (int32_t )v4.w (),
97+ ONEAPI ::experimental::printf (format_vec, (int32_t )v4.w (),
9098 (int32_t )v4.z (), (int32_t )v4.y (),
9199 (int32_t )v4.x ());
92100#endif // __SYCL_DEVICE_ONLY__
@@ -99,7 +107,7 @@ int main() {
99107 // According to OpenCL spec, argument should be a void pointer
100108 {
101109 static const CONSTANT char format[] = " %p\n " ;
102- intel ::experimental::printf (format, (void *)Ptr);
110+ ONEAPI ::experimental::printf (format, (void *)Ptr);
103111 }
104112 // CHECK-NEXT: {{(0x)?[0-9a-fA-F]+$}}
105113 });
@@ -110,7 +118,7 @@ int main() {
110118 Queue.submit ([&](handler &CGH) {
111119 CGH.parallel_for <class stream_string >(range<1 >(10 ), [=](id<1 > i) {
112120 // cast to uint64_t to be sure that we pass 64-bit unsigned value
113- intel ::experimental::printf (format_hello_world_2, (uint64_t )i.get (0 ));
121+ ONEAPI ::experimental::printf (format_hello_world_2, (uint64_t )i.get (0 ));
114122 });
115123 });
116124 Queue.wait ();
0 commit comments