Skip to content

Commit c7e44ad

Browse files
committed
Implement syclcompat::free using detail::free
1 parent cea476c commit c7e44ad

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

sycl/include/syclcompat/memory.hpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -994,16 +994,11 @@ static inline void wait_and_free(void *ptr,
994994
/// Free the memory \p ptr on the default queue without synchronizing
995995
/// \param ptr Point to free.
996996
/// \returns no return value.
997-
// TODO(joe) in dpct this defers to detail::dpct_free
998-
// Need this to handle the wait()
999997
static inline void free(void *ptr, sycl::queue q = get_default_queue()) {
1000-
if (ptr) {
1001-
#ifdef COMPAT_USM_LEVEL_NONE
1002-
detail::mem_mgr::instance().mem_free(ptr);
1003-
#else
1004-
sycl::free(ptr, q);
1005-
#endif // COMPAT_USM_LEVEL_NONE
1006-
}
998+
#ifndef COMPAT_USM_LEVEL_NONE
999+
get_device(get_device_id(q.get_device())).queues_wait_and_throw();
1000+
#endif
1001+
detail::free(ptr, q);
10071002
}
10081003

10091004
/// Enqueues the release of all pointers in /p pointers on the /p q.

0 commit comments

Comments
 (0)