Do not reprogram SBA if CSR is not multi os context capable

Related-To: NEO-5459

Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
This commit is contained in:
Igor Venevtsev
2021-03-23 11:55:50 +00:00
committed by Compute-Runtime-Automation
parent d9b1601148
commit cb4db7767e
2 changed files with 55 additions and 1 deletions

View File

@@ -600,6 +600,60 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenNotApplicableGrfConfigWhenFlu
}
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenMultiOsContextCapableSetAndDispatchFlagsWhenFlushingTaskThenReloadSbaProperly) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
// 1. Ignore dispatchFlags.useGlobalAtomics flip if csr is not multi context capable
commandStreamReceiver.multiOsContextCapable = false;
flushTaskFlags.useGlobalAtomics = false;
auto offset = commandStreamReceiver.commandStream.getUsed();
flushTask(commandStreamReceiver);
parseCommands<FamilyType>(commandStreamReceiver.commandStream, 0);
auto stateBaseAddressItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), stateBaseAddressItor);
flushTaskFlags.useGlobalAtomics ^= true;
offset = commandStreamReceiver.commandStream.getUsed();
flushTask(commandStreamReceiver);
cmdList.clear();
parseCommands<FamilyType>(commandStreamReceiver.commandStream, offset);
stateBaseAddressItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
EXPECT_EQ(cmdList.end(), stateBaseAddressItor);
// 2. Reprogram SBA only if dispatchFlags.useGlobalAtomics flips and csr is multi context capable
commandStreamReceiver.multiOsContextCapable = true;
flushTaskFlags.useGlobalAtomics = true;
offset = commandStreamReceiver.commandStream.getUsed();
flushTask(commandStreamReceiver);
cmdList.clear();
parseCommands<FamilyType>(commandStreamReceiver.commandStream, offset);
stateBaseAddressItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), stateBaseAddressItor);
flushTaskFlags.useGlobalAtomics ^= true;
offset = commandStreamReceiver.commandStream.getUsed();
flushTask(commandStreamReceiver);
cmdList.clear();
parseCommands<FamilyType>(commandStreamReceiver.commandStream, offset);
stateBaseAddressItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), stateBaseAddressItor);
offset = commandStreamReceiver.commandStream.getUsed();
flushTask(commandStreamReceiver);
cmdList.clear();
parseCommands<FamilyType>(commandStreamReceiver.commandStream, offset);
stateBaseAddressItor = find<STATE_BASE_ADDRESS *>(cmdList.begin(), cmdList.end());
EXPECT_EQ(cmdList.end(), stateBaseAddressItor);
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenPreambleNotSentWhenFlushingTaskThenPreambleIsSent) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
commandStreamReceiver.isPreambleSent = false;

View File

@@ -375,7 +375,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
latestSentStatelessMocsConfig = mocsIndex;
}
if (dispatchFlags.useGlobalAtomics != lastSentUseGlobalAtomics) {
if (isMultiOsContextCapable() && (dispatchFlags.useGlobalAtomics != lastSentUseGlobalAtomics)) {
isStateBaseAddressDirty = true;
lastSentUseGlobalAtomics = dispatchFlags.useGlobalAtomics;
}