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:
Xavier Hallade
2025-03-31 16:14:36 +02:00
parent 3ad5721a1c
commit 795a76029a

View File

@@ -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