diff --git a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl index 38d0d5a20e..5aab7c2f1a 100644 --- a/level_zero/core/source/cmdqueue/cmdqueue_hw.inl +++ b/level_zero/core/source/cmdqueue/cmdqueue_hw.inl @@ -168,7 +168,7 @@ ze_result_t CommandQueueHw::executeCommandListsRegular( this->programCsrBaseAddressIfPreemptionModeInitial(ctx.isPreemptionModeInitial, child); this->programStateSip(ctx.stateSipRequired, child); this->programActivePartitionConfig(ctx.isProgramActivePartitionConfigRequired, child); - bool shouldProgramVfe = this->csr->getLogicalStateHelper() && ctx.frontEndStateDirty; + bool shouldProgramVfe = (this->csr->getLogicalStateHelper() || !frontEndTrackingEnabled()) && ctx.frontEndStateDirty; this->programFrontEndAndClearDirtyFlag(shouldProgramVfe, ctx, child, csrStateProperties); if (ctx.rtDispatchRequired) { @@ -329,30 +329,30 @@ void CommandQueueHw::programOneCmdListFrontEndIfDirty( const NEO::StreamProperties &cmdListRequired, const NEO::StreamProperties &cmdListFinal) { + if (!frontEndTrackingEnabled()) { + return; + } + bool shouldProgramVfe = ctx.frontEndStateDirty; - ctx.cmdListBeginState.frontEndState = {}; - - if (frontEndTrackingEnabled()) { - if (shouldProgramVfe) { - csrState.frontEndState.copyPropertiesAll(cmdListRequired.frontEndState); - } else { - csrState.frontEndState.copyPropertiesComputeDispatchAllWalkerEnableDisableEuFusion(cmdListRequired.frontEndState); - } + if (shouldProgramVfe) { + csrState.frontEndState.copyPropertiesAll(cmdListRequired.frontEndState); csrState.frontEndState.setPropertySingleSliceDispatchCcsMode(ctx.engineInstanced); - + } else { + csrState.frontEndState.copyPropertiesComputeDispatchAllWalkerEnableDisableEuFusion(cmdListRequired.frontEndState); shouldProgramVfe |= csrState.frontEndState.isDirty(); } - ctx.cmdListBeginState.frontEndState.copyPropertiesAll(csrState.frontEndState); - this->programFrontEndAndClearDirtyFlag(shouldProgramVfe, ctx, cmdStream, csrState); + if (shouldProgramVfe) { + ctx.cmdListBeginState.frontEndState = {}; + ctx.cmdListBeginState.frontEndState.copyPropertiesAll(csrState.frontEndState); + this->programFrontEndAndClearDirtyFlag(shouldProgramVfe, ctx, cmdStream, csrState); + } - if (frontEndTrackingEnabled()) { - if (shouldProgramVfe) { - csrState.frontEndState.copyPropertiesAll(cmdListFinal.frontEndState); - } else { - csrState.frontEndState.copyPropertiesComputeDispatchAllWalkerEnableDisableEuFusion(cmdListFinal.frontEndState); - } + if (shouldProgramVfe) { + csrState.frontEndState.copyPropertiesAll(cmdListFinal.frontEndState); + } else { + csrState.frontEndState.copyPropertiesComputeDispatchAllWalkerEnableDisableEuFusion(cmdListFinal.frontEndState); } } diff --git a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp index 5c97eea738..37d07ec688 100644 --- a/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdqueue/test_cmdqueue_enqueue_cmdlist.cpp @@ -738,11 +738,13 @@ void CommandQueueExecuteCommandLists::twoCommandListCommandPreemptionTest(bool p EXPECT_EQ(disabledPreemptionRegisterData, lriCmd->getDataDword()); // verify presence of sync PIPE_CONTROL just before LRI switching preemption - auto itorPipeControl = find(itor, itorLri); + auto itorPipeControl = itorLri; + --itorPipeControl; + auto pipeControlCmd = genCmdCast(*itorPipeControl); if (commandQueue->preemptionCmdSyncProgramming) { - EXPECT_NE(itorPipeControl, itorLri); + EXPECT_NE(nullptr, pipeControlCmd); } else { - EXPECT_EQ(itorPipeControl, itorLri); + EXPECT_EQ(nullptr, pipeControlCmd); } itor = itorLri; @@ -765,11 +767,13 @@ void CommandQueueExecuteCommandLists::twoCommandListCommandPreemptionTest(bool p EXPECT_EQ(threadGroupPreemptionRegisterData, lriCmd->getDataDword()); // verify presence of sync PIPE_CONTROL just before LRI switching preemption - auto itorPipeControl = find(itor, itorLri); + auto itorPipeControl = itorLri; + --itorPipeControl; + auto pipeControlCmd = genCmdCast(*itorPipeControl); if (commandQueue->preemptionCmdSyncProgramming) { - EXPECT_NE(itorPipeControl, itorLri); + EXPECT_NE(nullptr, pipeControlCmd); } else { - EXPECT_EQ(itorPipeControl, itorLri); + EXPECT_EQ(nullptr, pipeControlCmd); } itor = itorLri; @@ -791,11 +795,13 @@ void CommandQueueExecuteCommandLists::twoCommandListCommandPreemptionTest(bool p EXPECT_EQ(disabledPreemptionRegisterData, lriCmd->getDataDword()); // verify presence of sync PIPE_CONTROL just before LRI switching preemption - auto itorPipeControl = find(itor, itorLri); + auto itorPipeControl = itorLri; + --itorPipeControl; + auto pipeControlCmd = genCmdCast(*itorPipeControl); if (commandQueue->preemptionCmdSyncProgramming) { - EXPECT_NE(itorPipeControl, itorLri); + EXPECT_NE(nullptr, pipeControlCmd); } else { - EXPECT_EQ(itorPipeControl, itorLri); + EXPECT_EQ(nullptr, pipeControlCmd); } itor = itorLri; @@ -842,11 +848,13 @@ void CommandQueueExecuteCommandLists::twoCommandListCommandPreemptionTest(bool p EXPECT_EQ(threadGroupPreemptionRegisterData, lriCmd->getDataDword()); // verify presence of sync PIPE_CONTROL just before LRI switching preemption - auto itorPipeControl = find(itor, itorLri); + auto itorPipeControl = itorLri; + --itorPipeControl; + auto pipeControlCmd = genCmdCast(*itorPipeControl); if (commandQueue->preemptionCmdSyncProgramming) { - EXPECT_NE(itorPipeControl, itorLri); + EXPECT_NE(nullptr, pipeControlCmd); } else { - EXPECT_EQ(itorPipeControl, itorLri); + EXPECT_EQ(nullptr, pipeControlCmd); } itor = itorLri; @@ -868,11 +876,13 @@ void CommandQueueExecuteCommandLists::twoCommandListCommandPreemptionTest(bool p EXPECT_EQ(disabledPreemptionRegisterData, lriCmd->getDataDword()); // verify presence of sync PIPE_CONTROL just before LRI switching preemption - auto itorPipeControl = find(itor, itorLri); + auto itorPipeControl = itorLri; + --itorPipeControl; + auto pipeControlCmd = genCmdCast(*itorPipeControl); if (commandQueue->preemptionCmdSyncProgramming) { - EXPECT_NE(itorPipeControl, itorLri); + EXPECT_NE(nullptr, pipeControlCmd); } else { - EXPECT_EQ(itorPipeControl, itorLri); + EXPECT_EQ(nullptr, pipeControlCmd); } itor = itorLri;