File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,22 @@ static constexpr auto exe_policy = std::execution::par_unseq;
5555#endif
5656
5757#ifdef USE_STD_PTR_ALLOC_DEALLOC
58+
59+ #if defined(__HIPSYCL__) || defined(__OPENSYCL__)
60+ #include < CL/sycl.hpp>
61+
62+ // TODO We temporarily use malloc_shared/free here for hipSYCL stdpar because there's a linking issue if we let it hijack new/delete
63+ // for this to work, we compile with --hipsycl-stdpar-system-usm so that hijacking is disabled
64+ static cl::sycl::queue queue{cl::sycl::default_selector_v};
65+ template <typename T> T *alloc_raw (size_t size) { return cl::sycl::malloc_shared<T>(size, queue); }
66+ template <typename T> void dealloc_raw (T *ptr) { cl::sycl::free (ptr, queue); }
67+
68+ #else
5869template <typename T>
5970T *alloc_raw (size_t size) { return (T *) aligned_alloc (ALIGNMENT, sizeof (T) * size); }
6071
6172template <typename T>
6273void dealloc_raw (T *ptr) { free (ptr); }
74+ #endif
6375
6476#endif
You can’t perform that action at this time.
0 commit comments