diff --git a/unified-runtime/source/adapters/level_zero/v2/command_list_manager.cpp b/unified-runtime/source/adapters/level_zero/v2/command_list_manager.cpp index 4d904ea1c0c14..a64a1dd8fd393 100644 --- a/unified-runtime/source/adapters/level_zero/v2/command_list_manager.cpp +++ b/unified-runtime/source/adapters/level_zero/v2/command_list_manager.cpp @@ -1174,6 +1174,11 @@ ur_result_t ur_command_list_manager::appendKernelLaunchWithArgsExpNew( const ur_kernel_launch_ext_properties_t *launchPropList, wait_list_view &waitListView, ur_event_handle_t phEvent) { + ur_result_t checkResult = kernelLaunchChecks(hKernel, workDim); + if (checkResult != UR_RESULT_SUCCESS) { + return checkResult; + } + if (numArgs != hKernel->getCommonProperties().numKernelArgs) { setErrorMessage("Wrong number of kernel arguments", UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX, @@ -1181,11 +1186,6 @@ ur_result_t ur_command_list_manager::appendKernelLaunchWithArgsExpNew( return UR_RESULT_ERROR_INVALID_KERNEL_ARGUMENT_INDEX; } - ur_result_t checkResult = kernelLaunchChecks(hKernel, workDim); - if (checkResult != UR_RESULT_SUCCESS) { - return checkResult; - } - // It is needed in case of UR_KERNEL_LAUNCH_PROPERTY_ID_COOPERATIVE // to launch the cooperative kernel. ZeStruct