diff --git a/source/adapters/level_zero/command_buffer.cpp b/source/adapters/level_zero/command_buffer.cpp index bfe00baa60..4a8688628f 100644 --- a/source/adapters/level_zero/command_buffer.cpp +++ b/source/adapters/level_zero/command_buffer.cpp @@ -598,16 +598,15 @@ ur_result_t createMainCommandList(ur_context_handle_t Context, */ bool canBeInOrder(ur_context_handle_t Context, const ur_exp_command_buffer_desc_t *CommandBufferDesc) { - std::ignore = Context; - std::ignore = CommandBufferDesc; + const char *UrRet = std::getenv("UR_L0_USE_DRIVER_INORDER_LISTS"); // In-order command-lists are not available in old driver version. - // bool CompatibleDriver = - // Context->getPlatform()->isDriverVersionNewerOrSimilar( - // 1, 3, L0_DRIVER_INORDER_MIN_VERSION); - // return CompatibleDriver - // ? (CommandBufferDesc ? CommandBufferDesc->isInOrder : false) - // : false; - return false; + bool DriverInOrderRequested = UrRet ? std::atoi(UrRet) != 0 : false; + bool CompatibleDriver = Context->getPlatform()->isDriverVersionNewerOrSimilar( + 1, 3, L0_DRIVER_INORDER_MIN_VERSION); + bool CanUseDriverInOrderLists = CompatibleDriver && DriverInOrderRequested; + return CanUseDriverInOrderLists + ? (CommandBufferDesc ? CommandBufferDesc->isInOrder : false) + : false; } /**