Skip to content

Commit 7b88d79

Browse files
committed
Implement wait_and_free using detail::free
For buffer support
1 parent 1042c8e commit 7b88d79

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

sycl/include/syclcompat/memory.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ static inline void wait_and_free(void *ptr,
10051005
get_current_device().queues_wait_and_throw();
10061006
q.wait();
10071007
if (ptr) {
1008-
sycl::free(ptr, q);
1008+
detail::free(ptr, q);
10091009
}
10101010
}
10111011

sycl/test-e2e/syclcompat/memory/memory_management_test3_usmnone.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ void test_mempcy_async() {
5252
syclcompat::memcpy_async((void*) (d_A + N1), (void*) h_B, (Num-N1) * sizeof(float));
5353
syclcompat::memcpy_async((void*) h_C, (void*) d_A, Num * sizeof(float));
5454

55-
syclcompat::get_default_queue().wait_and_throw();
56-
57-
syclcompat::free((void*)d_A);
55+
syclcompat::wait_and_free((void*)d_A);
5856

5957
syclcompat::free(0);
6058
syclcompat::free(NULL);
@@ -465,8 +463,7 @@ void test_memset_async(sycl::queue &q) {
465463

466464
// deviceA -> hostA
467465
syclcompat::memcpy_async((void*) h_A, (void*) d_A, Num * sizeof(int), q);
468-
q.wait_and_throw();
469-
syclcompat::free((void*)d_A, q);
466+
syclcompat::wait_and_free((void*)d_A, q);
470467

471468
// check d_A[0,..., 6] = 0
472469
for (int i = 0; i < Num - 3; i++) {

0 commit comments

Comments
 (0)