Cycles: oneAPI: Restrict use of experimental copy optimization to L0
This API is not properly implemented in other SYCL backends at the moment and we don't want it to fail at runtime, so we conservatively enable it only for Level-Zero.
This commit is contained in:
@@ -388,7 +388,11 @@ void *OneapiDevice::host_alloc(const MemoryType type, const size_t size)
|
||||
/* Import host_pointer into USM memory for faster host<->device data transfers. */
|
||||
if (type == MEM_READ_WRITE || type == MEM_READ_ONLY) {
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(device_queue_);
|
||||
sycl::ext::oneapi::experimental::prepare_for_device_copy(host_pointer, size, *queue);
|
||||
/* This API is properly implemented only in Level-Zero backend at the moment and we don't
|
||||
* want it to fail at runtime, so we conservatively use it only for L0. */
|
||||
if (queue->get_backend() == sycl::backend::ext_oneapi_level_zero) {
|
||||
sycl::ext::oneapi::experimental::prepare_for_device_copy(host_pointer, size, *queue);
|
||||
}
|
||||
}
|
||||
}
|
||||
# endif
|
||||
@@ -401,7 +405,11 @@ void OneapiDevice::host_free(const MemoryType type, void *host_pointer, const si
|
||||
# ifdef SYCL_EXT_ONEAPI_COPY_OPTIMIZE
|
||||
if (type == MEM_READ_WRITE || type == MEM_READ_ONLY) {
|
||||
sycl::queue *queue = reinterpret_cast<sycl::queue *>(device_queue_);
|
||||
sycl::ext::oneapi::experimental::release_from_device_copy(host_pointer, *queue);
|
||||
/* This API is properly implemented only in Level-Zero backend at the moment and we don't
|
||||
* want it to fail at runtime, so we conservatively use it only for L0. */
|
||||
if (queue->get_backend() == sycl::backend::ext_oneapi_level_zero) {
|
||||
sycl::ext::oneapi::experimental::release_from_device_copy(host_pointer, *queue);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user