Skip to content

Commit

Permalink
Use malloc_shared for hipSYCL stdpar in shim with --hipsycl-stdpar-sy…
Browse files Browse the repository at this point in the history
…stem-usm for now
  • Loading branch information
tom91136 committed Aug 10, 2023
1 parent 5289fd5 commit 1ab81ba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/std-indices/dpl_shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ static constexpr auto EXEC_POLICY = std::execution::par_unseq;
#ifdef USE_STD_PTR_ALLOC_DEALLOC

#if defined(__HIPSYCL__) || defined(__OPENSYCL__)
#include <CL/sycl.hpp>

template <typename T> T *alloc_raw(size_t size) { return new T[size]; }
template <typename T> void dealloc_raw(T *ptr) { delete[] ptr; }
// TODO We temporarily use malloc_shared/free here for hipSYCL stdpar because there's a linking issue if we let it hijack new/delete
// for this to work, we compile with --hipsycl-stdpar-system-usm so that hijacking is disabled
static cl::sycl::queue queue{cl::sycl::default_selector_v};
template <typename T> T *alloc_raw(size_t size) { return cl::sycl::malloc_shared<T>(size, queue); }
template <typename T> void dealloc_raw(T *ptr) { cl::sycl::free(ptr, queue); }

#else

Expand Down

0 comments on commit 1ab81ba

Please sign in to comment.