Skip to content

Commit ad61a0d

Browse files
authored
Merge pull request #178 from UoB-HPC/revert-177-patch-5
Revert "Remove AdaptiveCpp workaround in dpl_shim.h to allow for automatic prefetch optimization"
2 parents 06c3d53 + 438e210 commit ad61a0d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/dpl_shim.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff 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
5869
template<typename T>
5970
T *alloc_raw(size_t size) { return (T *) aligned_alloc(ALIGNMENT, sizeof(T) * size); }
6071

6172
template<typename T>
6273
void dealloc_raw(T *ptr) { free(ptr); }
74+
#endif
6375

6476
#endif

0 commit comments

Comments
 (0)