@@ -220,6 +220,7 @@ ur_result_t ur_platform_handle_t_::initialize() {
220220 ZE2UR_CALL (zeDriverGetExtensionProperties,
221221 (ZeDriver, &Count, ZeExtensions.data ()));
222222
223+ bool MutableCommandListSpecExtensionSupported = false ;
223224 for (auto &extension : ZeExtensions) {
224225 // Check if global offset extension is available
225226 if (strncmp (extension.name , ZE_GLOBAL_OFFSET_EXP_NAME,
@@ -244,13 +245,11 @@ ur_result_t ur_platform_handle_t_::initialize() {
244245 ZeDriverEventPoolCountingEventsExtensionFound = true ;
245246 }
246247 }
247-
248- // Check if the ImmediateAppendCommandLists extension is available.
249- if (strncmp (extension.name , ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME,
250- strlen (ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_NAME) + 1 ) == 0 ) {
251- if (extension.version ==
252- ZE_IMMEDIATE_COMMAND_LIST_APPEND_EXP_VERSION_CURRENT) {
253- zeDriverImmediateCommandListAppendFound = true ;
248+ // Check if extension is available for Mutable Command List v1.1.
249+ if (strncmp (extension.name , ZE_MUTABLE_COMMAND_LIST_EXP_NAME,
250+ strlen (ZE_MUTABLE_COMMAND_LIST_EXP_NAME) + 1 ) == 0 ) {
251+ if (extension.version == ZE_MUTABLE_COMMAND_LIST_EXP_VERSION_1_1) {
252+ MutableCommandListSpecExtensionSupported = true ;
254253 }
255254 }
256255 zeDriverExtensionMap[extension.name ] = extension.version ;
@@ -289,37 +288,72 @@ ur_result_t ur_platform_handle_t_::initialize() {
289288
290289 // Check if mutable command list extension is supported and initialize
291290 // function pointers.
292- ZeMutableCmdListExt.Supported |=
293- (ZE_CALL_NOCHECK (
294- zeDriverGetExtensionFunctionAddress,
295- (ZeDriver, " zeCommandListGetNextCommandIdExp" ,
296- reinterpret_cast <void **>(
297- &ZeMutableCmdListExt.zexCommandListGetNextCommandIdExp ))) == 0 );
298-
299- ZeMutableCmdListExt.Supported &=
300- (ZE_CALL_NOCHECK (zeDriverGetExtensionFunctionAddress,
301- (ZeDriver, " zeCommandListUpdateMutableCommandsExp" ,
302- reinterpret_cast <void **>(
303- &ZeMutableCmdListExt
304- .zexCommandListUpdateMutableCommandsExp ))) ==
305- 0 );
306-
307- ZeMutableCmdListExt.Supported &=
308- (ZE_CALL_NOCHECK (
309- zeDriverGetExtensionFunctionAddress,
310- (ZeDriver, " zeCommandListUpdateMutableCommandSignalEventExp" ,
311- reinterpret_cast <void **>(
312- &ZeMutableCmdListExt
313- .zexCommandListUpdateMutableCommandSignalEventExp ))) == 0 );
314-
315- ZeMutableCmdListExt.Supported &=
316- (ZE_CALL_NOCHECK (
317- zeDriverGetExtensionFunctionAddress,
318- (ZeDriver, " zeCommandListUpdateMutableCommandWaitEventsExp" ,
319- reinterpret_cast <void **>(
320- &ZeMutableCmdListExt
321- .zexCommandListUpdateMutableCommandWaitEventsExp ))) == 0 );
322-
291+ if (MutableCommandListSpecExtensionSupported) {
292+ ZeMutableCmdListExt.zexCommandListGetNextCommandIdExp =
293+ (ze_pfnCommandListGetNextCommandIdExp_t)
294+ ur_loader::LibLoader::getFunctionPtr (
295+ GlobalAdapter->processHandle ,
296+ " zeCommandListGetNextCommandIdExp" );
297+ ZeMutableCmdListExt.Supported |=
298+ ZeMutableCmdListExt.zexCommandListGetNextCommandIdExp != nullptr ;
299+ ZeMutableCmdListExt.zexCommandListUpdateMutableCommandsExp =
300+ (ze_pfnCommandListUpdateMutableCommandsExp_t)
301+ ur_loader::LibLoader::getFunctionPtr (
302+ GlobalAdapter->processHandle ,
303+ " zeCommandListUpdateMutableCommandsExp" );
304+ ZeMutableCmdListExt.Supported |=
305+ ZeMutableCmdListExt.zexCommandListUpdateMutableCommandsExp != nullptr ;
306+ ZeMutableCmdListExt.zexCommandListUpdateMutableCommandSignalEventExp =
307+ (ze_pfnCommandListUpdateMutableCommandSignalEventExp_t)
308+ ur_loader::LibLoader::getFunctionPtr (
309+ GlobalAdapter->processHandle ,
310+ " zeCommandListUpdateMutableCommandSignalEventExp" );
311+ ZeMutableCmdListExt.Supported |=
312+ ZeMutableCmdListExt.zexCommandListUpdateMutableCommandSignalEventExp !=
313+ nullptr ;
314+ ZeMutableCmdListExt.zexCommandListUpdateMutableCommandWaitEventsExp =
315+ (ze_pfnCommandListUpdateMutableCommandWaitEventsExp_t)
316+ ur_loader::LibLoader::getFunctionPtr (
317+ GlobalAdapter->processHandle ,
318+ " zeCommandListUpdateMutableCommandWaitEventsExp" );
319+ ZeMutableCmdListExt.Supported |=
320+ ZeMutableCmdListExt.zexCommandListUpdateMutableCommandWaitEventsExp !=
321+ nullptr ;
322+ } else {
323+ ZeMutableCmdListExt.Supported |=
324+ (ZE_CALL_NOCHECK (
325+ zeDriverGetExtensionFunctionAddress,
326+ (ZeDriver, " zeCommandListGetNextCommandIdExp" ,
327+ reinterpret_cast <void **>(
328+ &ZeMutableCmdListExt.zexCommandListGetNextCommandIdExp ))) ==
329+ 0 );
330+
331+ ZeMutableCmdListExt.Supported &=
332+ (ZE_CALL_NOCHECK (zeDriverGetExtensionFunctionAddress,
333+ (ZeDriver, " zeCommandListUpdateMutableCommandsExp" ,
334+ reinterpret_cast <void **>(
335+ &ZeMutableCmdListExt
336+ .zexCommandListUpdateMutableCommandsExp ))) ==
337+ 0 );
338+
339+ ZeMutableCmdListExt.Supported &=
340+ (ZE_CALL_NOCHECK (
341+ zeDriverGetExtensionFunctionAddress,
342+ (ZeDriver, " zeCommandListUpdateMutableCommandSignalEventExp" ,
343+ reinterpret_cast <void **>(
344+ &ZeMutableCmdListExt
345+ .zexCommandListUpdateMutableCommandSignalEventExp ))) ==
346+ 0 );
347+
348+ ZeMutableCmdListExt.Supported &=
349+ (ZE_CALL_NOCHECK (
350+ zeDriverGetExtensionFunctionAddress,
351+ (ZeDriver, " zeCommandListUpdateMutableCommandWaitEventsExp" ,
352+ reinterpret_cast <void **>(
353+ &ZeMutableCmdListExt
354+ .zexCommandListUpdateMutableCommandWaitEventsExp ))) ==
355+ 0 );
356+ }
323357 return UR_RESULT_SUCCESS;
324358}
325359
0 commit comments