connect hardware support with front end properties state management

Related-To: NEO-5019

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2022-08-29 20:06:04 +00:00
committed by Compute-Runtime-Automation
parent ee8af85341
commit 816e059c66
39 changed files with 337 additions and 43 deletions

View File

@@ -2291,7 +2291,8 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
finalStreamState.frontEndState.setProperties(isCooperative, kernelAttributes.flags.requiresDisabledEUFusion, disableOverdispatch, -1, hwInfo);
bool isPatchingVfeStateAllowed = NEO::DebugManager.flags.AllowPatchingVfeStateInCommandLists.get();
if (finalStreamState.frontEndState.isDirty() && isPatchingVfeStateAllowed && !getLogicalStateHelper()) {
auto logicalStateHelperBlock = !getLogicalStateHelper();
if (finalStreamState.frontEndState.isDirty() && isPatchingVfeStateAllowed && logicalStateHelperBlock) {
auto pVfeStateAddress = NEO::PreambleHelper<GfxFamily>::getSpaceForVfeState(commandContainer.getCommandStream(), hwInfo, engineGroupType);
auto pVfeState = new VFE_STATE_TYPE;
NEO::PreambleHelper<GfxFamily>::programVfeState(pVfeState, hwInfo, 0, 0, device->getMaxNumHwThreads(), finalStreamState, nullptr);
@@ -2300,7 +2301,7 @@ void CommandListCoreFamily<gfxCoreFamily>::updateStreamProperties(Kernel &kernel
finalStreamState.stateComputeMode.setProperties(false, kernelAttributes.numGrfRequired, kernelAttributes.threadArbitrationPolicy, device->getDevicePreemptionMode(), hwInfo);
if (finalStreamState.stateComputeMode.isDirty() && !getLogicalStateHelper()) {
if (finalStreamState.stateComputeMode.isDirty() && logicalStateHelperBlock) {
bool isRcs = (this->engineGroupType == NEO::EngineGroupType::RenderCompute);
NEO::EncodeComputeMode<GfxFamily>::programComputeModeCommandWithSynchronization(
*commandContainer.getCommandStream(), finalStreamState.stateComputeMode, {}, false, hwInfo, isRcs, nullptr);

View File

@@ -597,7 +597,7 @@ void CommandQueueHw<gfxCoreFamily>::setFrontEndStateProperties(CommandListExecut
streamProperties.frontEndState.setProperties(ctx.anyCommandListWithCooperativeKernels, ctx.anyCommandListRequiresDisabledEUFusion,
disableOverdispatch, isEngineInstanced, hwInfo);
} else {
streamProperties.frontEndState.singleSliceDispatchCcsMode.set(isEngineInstanced);
streamProperties.frontEndState.setPropertySingleSliceDispatchCcsMode(isEngineInstanced, hwInfo);
}
ctx.frontEndStateDirty |= (streamProperties.frontEndState.isDirty() && !this->csr->getLogicalStateHelper());
ctx.frontEndStateDirty |= csr->getMediaVFEStateDirty();

View File

@@ -72,13 +72,20 @@ HWTEST2_F(CommandListExecuteImmediate, whenExecutingCommandListImmediateWithFlus
NEO::StateComputeModePropertiesSupport scmPropertiesSupport = {};
hwInfoConfig.fillScmPropertiesSupportStructure(scmPropertiesSupport);
NEO::FrontEndPropertiesSupport frontEndPropertiesSupport = {};
hwInfoConfig.fillFrontEndPropertiesSupportStructure(frontEndPropertiesSupport);
int expectedDisableOverdispatch = hwInfoConfig.isDisableOverdispatchAvailable(*defaultHwInfo);
int32_t expectedIsCoherencyRequired = scmPropertiesSupport.coherencyRequired ? hwHelper.forceNonGpuCoherencyWA(true) : -1;
int expectedLargeGrfMode = scmPropertiesSupport.largeGrfMode ? 1 : -1;
int expectedThreadArbitrationPolicy = scmPropertiesSupport.threadArbitrationPolicy ? NEO::ThreadArbitrationPolicy::RoundRobin : -1;
EXPECT_EQ(1, currentCsrStreamProperties.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(1, currentCsrStreamProperties.frontEndState.disableEUFusion.value);
int expectedComputeDispatchAllWalkerEnable = frontEndPropertiesSupport.computeDispatchAllWalker ? 1 : -1;
int expectedDisableEuFusion = frontEndPropertiesSupport.disableEuFusion ? 1 : -1;
expectedDisableOverdispatch = frontEndPropertiesSupport.disableOverdispatch ? expectedDisableOverdispatch : -1;
EXPECT_EQ(expectedComputeDispatchAllWalkerEnable, currentCsrStreamProperties.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(expectedDisableEuFusion, currentCsrStreamProperties.frontEndState.disableEUFusion.value);
EXPECT_EQ(expectedDisableOverdispatch, currentCsrStreamProperties.frontEndState.disableOverdispatch.value);
EXPECT_EQ(expectedIsCoherencyRequired, currentCsrStreamProperties.stateComputeMode.isCoherencyRequired.value);
EXPECT_EQ(expectedLargeGrfMode, currentCsrStreamProperties.stateComputeMode.largeGrfMode.value);
@@ -95,9 +102,14 @@ HWTEST2_F(CommandListExecuteImmediate, whenExecutingCommandListImmediateWithFlus
expectedLargeGrfMode = scmPropertiesSupport.largeGrfMode ? 0 : -1;
expectedIsCoherencyRequired = scmPropertiesSupport.coherencyRequired ? 0 : -1;
expectedThreadArbitrationPolicy = scmPropertiesSupport.threadArbitrationPolicy ? NEO::ThreadArbitrationPolicy::AgeBased : -1;
EXPECT_EQ(0, currentCsrStreamProperties.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(0, currentCsrStreamProperties.frontEndState.disableEUFusion.value);
EXPECT_EQ(0, currentCsrStreamProperties.frontEndState.disableOverdispatch.value);
expectedComputeDispatchAllWalkerEnable = frontEndPropertiesSupport.computeDispatchAllWalker ? 0 : -1;
expectedDisableOverdispatch = frontEndPropertiesSupport.disableOverdispatch ? 0 : -1;
expectedDisableEuFusion = frontEndPropertiesSupport.disableEuFusion ? 0 : -1;
EXPECT_EQ(expectedComputeDispatchAllWalkerEnable, currentCsrStreamProperties.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(expectedDisableEuFusion, currentCsrStreamProperties.frontEndState.disableEUFusion.value);
EXPECT_EQ(expectedDisableOverdispatch, currentCsrStreamProperties.frontEndState.disableOverdispatch.value);
EXPECT_EQ(expectedIsCoherencyRequired, currentCsrStreamProperties.stateComputeMode.isCoherencyRequired.value);
EXPECT_EQ(expectedLargeGrfMode, currentCsrStreamProperties.stateComputeMode.largeGrfMode.value);
EXPECT_EQ(expectedThreadArbitrationPolicy, currentCsrStreamProperties.stateComputeMode.threadArbitrationPolicy.value);

View File

@@ -360,7 +360,8 @@ HWTEST2_F(CommandListAppendLaunchKernel, whenUpdateStreamPropertiesIsCalledThenR
EXPECT_EQ(-1, pCommandList->finalStreamState.frontEndState.disableOverdispatch.value);
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
int32_t expectedDisableOverdispatch = hwInfoConfig.isDisableOverdispatchAvailable(*defaultHwInfo);
int32_t expectedDisableOverdispatch = hwInfoConfig.isDisableOverdispatchAvailable(*defaultHwInfo) ? 1 : 0;
expectedDisableOverdispatch = hwInfoConfig.getFrontEndPropertyDisableOverDispatchSupport() ? expectedDisableOverdispatch : -1;
pCommandList->updateStreamProperties(kernel, false, false);
EXPECT_EQ(expectedDisableOverdispatch, pCommandList->requiredStreamState.frontEndState.disableOverdispatch.value);

View File

@@ -210,40 +210,52 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenVariousKernelsWhenUpdateStreamProp
EXPECT_EQ(-1, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(0u, pCommandList->commandsToPatch.size());
auto &hwInfoConfig = *NEO::HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
int32_t expectedDispatchAllWalkerEnable = hwInfoConfig.getFrontEndPropertyComputeDispatchAllWalkerSupport() ? 0 : -1;
pCommandList->updateStreamProperties(defaultKernel, false, false);
EXPECT_EQ(0, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(0, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(0u, pCommandList->commandsToPatch.size());
pCommandList->reset();
pCommandList->updateStreamProperties(cooperativeKernel, false, true);
pCommandList->updateStreamProperties(cooperativeKernel, false, true);
EXPECT_EQ(1, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(1, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
expectedDispatchAllWalkerEnable = expectedDispatchAllWalkerEnable != -1 ? 1 : expectedDispatchAllWalkerEnable;
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(0u, pCommandList->commandsToPatch.size());
pCommandList->reset();
pCommandList->updateStreamProperties(defaultKernel, false, false);
pCommandList->updateStreamProperties(cooperativeKernel, false, true);
EXPECT_EQ(0, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(1, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(1u, pCommandList->commandsToPatch.size());
expectedDispatchAllWalkerEnable = expectedDispatchAllWalkerEnable != -1 ? 0 : expectedDispatchAllWalkerEnable;
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
expectedDispatchAllWalkerEnable = expectedDispatchAllWalkerEnable != -1 ? 1 : expectedDispatchAllWalkerEnable;
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
size_t expectedCommandsToPatch = expectedDispatchAllWalkerEnable != -1 ? 1 : 0;
EXPECT_EQ(expectedCommandsToPatch, pCommandList->commandsToPatch.size());
pCommandList->reset();
pCommandList->updateStreamProperties(cooperativeKernel, false, true);
pCommandList->updateStreamProperties(defaultKernel, false, false);
pCommandList->updateStreamProperties(cooperativeKernel, false, true);
EXPECT_EQ(1, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(1, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(2u, pCommandList->commandsToPatch.size());
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
expectedCommandsToPatch = expectedCommandsToPatch != 0 ? 2 : 0;
EXPECT_EQ(expectedCommandsToPatch, pCommandList->commandsToPatch.size());
pCommandList->reset();
pCommandList->updateStreamProperties(defaultKernel, false, false);
pCommandList->updateStreamProperties(defaultKernel, false, false);
pCommandList->updateStreamProperties(cooperativeKernel, false, true);
EXPECT_EQ(0, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(1, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
EXPECT_EQ(1u, pCommandList->commandsToPatch.size());
expectedDispatchAllWalkerEnable = expectedDispatchAllWalkerEnable != -1 ? 0 : expectedDispatchAllWalkerEnable;
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
expectedDispatchAllWalkerEnable = expectedDispatchAllWalkerEnable != -1 ? 1 : expectedDispatchAllWalkerEnable;
EXPECT_EQ(expectedDispatchAllWalkerEnable, pCommandList->finalStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
expectedCommandsToPatch = expectedCommandsToPatch != 0 ? 1 : 0;
EXPECT_EQ(expectedCommandsToPatch, pCommandList->commandsToPatch.size());
pCommandList->reset();
EXPECT_EQ(-1, pCommandList->requiredStreamState.frontEndState.computeDispatchAllWalkerEnable.value);
@@ -275,7 +287,11 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenVariousKernelsAndPatchingDisallowe
DebugManager.flags.AllowPatchingVfeStateInCommandLists.set(1);
pCommandList->updateStreamProperties(defaultKernel, false, false);
pCommandList->updateStreamProperties(cooperativeKernel, false, true);
EXPECT_EQ(1u, pCommandList->commandsToPatch.size());
const auto &hwInfoConfig = *NEO::HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
size_t expectedCmdsToPatch = hwInfoConfig.getFrontEndPropertyComputeDispatchAllWalkerSupport() ? 1 : 0;
EXPECT_EQ(expectedCmdsToPatch, pCommandList->commandsToPatch.size());
pCommandList->reset();
}

View File

@@ -143,7 +143,9 @@ HWTEST_F(CommandQueueExecuteCommandLists, givenCommandListThatRequiresDisabledEU
auto result = commandQueue->executeCommandLists(numCommandLists, commandLists, nullptr, true);
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(1, commandQueue->getCsr()->getStreamProperties().frontEndState.disableEUFusion.value);
bool disableEuFusion = NEO::HwInfoConfig::get(device->getHwInfo().platform.eProductFamily)->getFrontEndPropertyDisableEuFusionSupport();
int32_t expectedDisableEuFusion = disableEuFusion ? 1 : -1;
EXPECT_EQ(expectedDisableEuFusion, commandQueue->getCsr()->getStreamProperties().frontEndState.disableEUFusion.value);
commandQueue->destroy();
}