diff --git a/intern/cycles/device/oneapi/device_impl.cpp b/intern/cycles/device/oneapi/device_impl.cpp index e250a53f377..2dcbe3da1ae 100644 --- a/intern/cycles/device/oneapi/device_impl.cpp +++ b/intern/cycles/device/oneapi/device_impl.cpp @@ -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(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(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