[perf] tweak front end programing to remove not needed steps

1. separate front end programing when tracking is enabled and disabled, it will
limit number of conditional checks.
2. setup command list front end properties only when front end state is dirty.
3. instanced context id should be set once, as this is one time per context
property.

Related-To: NEO-7828

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2023-04-07 11:39:08 +00:00
committed by Compute-Runtime-Automation
parent e4a446df58
commit cd899871b1
2 changed files with 43 additions and 33 deletions

View File

@@ -168,7 +168,7 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::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<gfxCoreFamily>::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);
}
}

View File

@@ -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<PIPE_CONTROL *>(itor, itorLri);
auto itorPipeControl = itorLri;
--itorPipeControl;
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*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<PIPE_CONTROL *>(itor, itorLri);
auto itorPipeControl = itorLri;
--itorPipeControl;
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*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<PIPE_CONTROL *>(itor, itorLri);
auto itorPipeControl = itorLri;
--itorPipeControl;
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*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<PIPE_CONTROL *>(itor, itorLri);
auto itorPipeControl = itorLri;
--itorPipeControl;
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*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<PIPE_CONTROL *>(itor, itorLri);
auto itorPipeControl = itorLri;
--itorPipeControl;
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*itorPipeControl);
if (commandQueue->preemptionCmdSyncProgramming) {
EXPECT_NE(itorPipeControl, itorLri);
EXPECT_NE(nullptr, pipeControlCmd);
} else {
EXPECT_EQ(itorPipeControl, itorLri);
EXPECT_EQ(nullptr, pipeControlCmd);
}
itor = itorLri;