Skip to content

Revert "Remove AdaptiveCpp workaround in dpl_shim.h to allow for automatic prefetch optimization" #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/dpl_shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,22 @@ static constexpr auto exe_policy = std::execution::par_unseq;
#endif

#ifdef USE_STD_PTR_ALLOC_DEALLOC

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

// 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
template<typename T>
T *alloc_raw(size_t size) { return (T *) aligned_alloc(ALIGNMENT, sizeof(T) * size); }

template<typename T>
void dealloc_raw(T *ptr) { free(ptr); }
#endif

#endif