@@ -37,25 +37,39 @@ class AsyncTest {
3737 AsyncTest ()
3838 : q_{syclcompat::get_default_queue ()}, grid_{NUM_WG}, thread_{WG_SIZE},
3939 size_{WG_SIZE * NUM_WG} {
40- d_A_ = sycl::malloc_device <float >(size_, q_);
41- d_B_ = sycl::malloc_device <float >(size_, q_);
42- d_C_ = sycl::malloc_device <float >(size_, q_);
40+ d_A_ = syclcompat::malloc <float >(size_, q_);
41+ d_B_ = syclcompat::malloc <float >(size_, q_);
42+ d_C_ = syclcompat::malloc <float >(size_, q_);
4343 }
4444
4545 ~AsyncTest () {
46- sycl ::free (d_A_, q_);
47- sycl ::free (d_B_, q_);
48- sycl ::free (d_C_, q_);
46+ syclcompat ::free (d_A_, q_);
47+ syclcompat ::free (d_B_, q_);
48+ syclcompat ::free (d_C_, q_);
4949 }
5050 sycl::event launch_kernel () {
5151 auto &dd_A = d_A_;
5252 auto &dd_B = d_B_;
5353 auto &dd_C = d_C_;
54+ #ifdef COMPAT_USM_LEVEL_NONE
55+ syclcompat::buffer_t buffer_A = syclcompat::get_buffer (d_A_);
56+ syclcompat::buffer_t buffer_B = syclcompat::get_buffer (d_B_);
57+ syclcompat::buffer_t buffer_C = syclcompat::get_buffer (d_C_);
58+ #endif
5459 return q_.submit ([&](sycl::handler &cgh) {
60+ #ifdef COMPAT_USM_LEVEL_NONE
61+ auto A = buffer_A.get_access <sycl::access::mode::read_write>(cgh);
62+ auto B = buffer_B.get_access <sycl::access::mode::read_write>(cgh);
63+ auto C = buffer_C.get_access <sycl::access::mode::read_write>(cgh);
64+ #else
65+ auto A = dd_A;
66+ auto B = dd_B;
67+ auto C = dd_C;
68+ #endif
5569 cgh.parallel_for (size_, [=](sycl::id<1 > id) {
56- dd_A [id] = static_cast <float >(id) + 1 .0f ;
57- dd_B [id] = static_cast <float >(id) + 1 .0f ;
58- dd_C [id] = dd_A [id] + dd_B [id];
70+ A [id] = static_cast <float >(id) + 1 .0f ;
71+ B [id] = static_cast <float >(id) + 1 .0f ;
72+ C [id] = A [id] + B [id];
5973 });
6074 });
6175 }
0 commit comments