11 #include <sycl/sycl.hpp>
12 #include <unordered_map>
23 const sycl::queue& queue =
26 #ifdef ENABLE_SYCL_UNIFIED_SHARED_MEMORY
27 return static_cast<void*
>(sycl::malloc_shared(byte_size, queue));
29 return static_cast<void*
>(sycl::malloc_device(byte_size, queue));
35 const sycl::queue& queue =
37 sycl::free(ptr, queue);
41 void MemoryManagerSYCL::Memcpy(
void* dst_ptr,
42 const Device& dst_device,
44 const Device& src_device,
46 Device device_with_queue;
48 if (src_device.IsCPU() && dst_device.IsCPU()) {
50 "Internal error: trying to transfer {}->{}, should not reach "
52 src_device.ToString(), dst_device.ToString());
53 }
else if (src_device.IsCPU() && dst_device.IsSYCL()) {
54 device_with_queue = dst_device;
55 }
else if (src_device.IsSYCL() && dst_device.IsCPU()) {
56 device_with_queue = src_device;
57 }
else if (src_device.IsSYCL() && dst_device.IsSYCL()) {
58 device_with_queue = src_device;
61 dst_device.ToString());
66 queue.memcpy(dst_ptr, src_ptr, num_bytes).wait_and_throw();
static SYCLContext & GetInstance()
Get singleton instance.
sycl::queue GetDefaultQueue(const Device &device)
Get the default SYCL queue given an CloudViewer device.
void Free(benchmark::State &state, int size, const Device &device, const MemoryManagerBackend &backend)
void Malloc(benchmark::State &state, int size, const Device &device, const MemoryManagerBackend &backend)
Generic file read and write utility for python interface.