diff --git a/sycl/doc/extensions/supported/sycl_ext_oneapi_backend_level_zero.md b/sycl/doc/extensions/supported/sycl_ext_oneapi_backend_level_zero.md index a190cb5a47ae0..a4a09377b93b2 100644 --- a/sycl/doc/extensions/supported/sycl_ext_oneapi_backend_level_zero.md +++ b/sycl/doc/extensions/supported/sycl_ext_oneapi_backend_level_zero.md @@ -388,6 +388,8 @@ If the deprecated variant of backend_input_t When using the L0 v2 adapter, ```make_queue()``` only accepts ```ze_command_list_handle_t```. The command list has to be in-order. The L0 v2 adapter is always used when running on platforms with GPUs based on the Xe2 architecture or later, such as Battlemage, Lunar Lake, and Arrow Lake. Applications may also opt-in to the L0 v2 adapter using the `SYCL_UR_USE_LEVEL_ZERO_V2` environment variable. diff --git a/unified-runtime/source/adapters/level_zero/v2/queue_create.cpp b/unified-runtime/source/adapters/level_zero/v2/queue_create.cpp index a8270b192dfb7..be211cb198438 100644 --- a/unified-runtime/source/adapters/level_zero/v2/queue_create.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/queue_create.cpp @@ -94,6 +94,7 @@ ur_result_t urQueueCreateWithNativeHandle( bool ownNativeHandle = pProperties ? pProperties->isNativeHandleOwned : false; ur_queue_flags_t flags = 0; + bool isNativeHandleImmediate = true; if (pProperties) { void *pNext = pProperties->pNext; @@ -104,11 +105,30 @@ ur_result_t urQueueCreateWithNativeHandle( const ur_queue_properties_t *pUrProperties = reinterpret_cast(extendedProperties); flags = pUrProperties->flags; + } else if (extendedProperties->stype == + UR_STRUCTURE_TYPE_QUEUE_NATIVE_DESC) { + const ur_queue_native_desc_t *pUrNativeDesc = + reinterpret_cast( + extendedProperties); + if (pUrNativeDesc->pNativeData) { + // The pNativeData has value if if the native handle is an immediate + // command list. + isNativeHandleImmediate = + *(reinterpret_cast((pUrNativeDesc->pNativeData))) == 1; + } } pNext = extendedProperties->pNext; } } + if (!isNativeHandleImmediate) { + UR_LOG(ERR, "urQueueCreateWithNativeHandle: " + "Native handle is not an immediate command " + "list; only immediate command lists are " + "supported."); + return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; + } + ze_bool_t isImmediate = false; ZE2UR_CALL( zeCommandListIsImmediate,