Debug flag to force stateless mocs encryption bit

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz 2022-09-23 14:13:06 +00:00 committed by Compute-Runtime-Automation
parent 878d646772
commit 6175a3e785
8 changed files with 44 additions and 6 deletions

View File

@ -122,7 +122,7 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, givenCsrInBatch
mockCsr.getCS(1024u);
auto &csrCommandStream = mockCsr.commandStream;
//we do level change that will emit PPC, fill all the space so only BB end fits.
// we do level change that will emit PPC, fill all the space so only BB end fits.
taskLevel++;
auto ppcSize = MemorySynchronizationCommands<FamilyType>::getSizeForSingleBarrier(false);
auto fillSize = MemoryConstants::cacheLineSize - ppcSize - sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
@ -516,7 +516,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, whenSamplerCacheFlushAfterThenSend
HWTEST_F(CommandStreamReceiverFlushTaskTests, GivenStaleCqWhenFlushingTaskThenCompletionStampIsValid) {
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
//simulate our CQ is stale for 10 TL's
// simulate our CQ is stale for 10 TL's
commandStreamReceiver.taskLevel = taskLevel + 10;
auto completionStamp = flushTask(commandStreamReceiver);
@ -574,6 +574,25 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskTests, WhenFlushingTas
EXPECT_EQ(stateHeapMocs, cmd.getInstructionMemoryObjectControlState());
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDebugVariableSetWhenProgrammingSbaThenSetStatelessMocsEncryptionBit) {
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
DebugManagerStateRestore restorer;
DebugManager.flags.ForceStatelessMocsEncryptionBit.set(1);
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
flushTask(commandStreamReceiver);
auto &commandStreamCSR = commandStreamReceiver.commandStream;
parseCommands<FamilyType>(commandStreamCSR, 0);
HardwareParse::findHardwareCommands<FamilyType>();
ASSERT_NE(nullptr, cmdStateBaseAddress);
auto cmd = reinterpret_cast<STATE_BASE_ADDRESS *>(cmdStateBaseAddress);
EXPECT_EQ(1u, cmd->getStatelessDataPortAccessMemoryObjectControlState() & 1);
}
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenStateBaseAddressWhenItIsRequiredThenThereIsPipeControlPriorToItWithTextureCacheFlush) {
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
@ -1072,7 +1091,7 @@ HWTEST_F(CommandStreamReceiverCQFlushTaskTests, WhenGettingCsThenReturnCsWithEno
auto currentUsed = commandStream.getUsed();
EXPECT_EQ(0u, currentUsed % MemoryConstants::cacheLineSize);
//depending on the size of commands we may need whole additional cacheline for alignment
// depending on the size of commands we may need whole additional cacheline for alignment
if (currentUsed != expectedSize) {
EXPECT_EQ(expectedSize - MemoryConstants::cacheLineSize, currentUsed);
} else {

View File

@ -219,6 +219,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, OverrideCmdListCmdBufferSizeInKb, -1, "-1: defau
DECLARE_DEBUG_VARIABLE(int32_t, OverrideL1CachePolicyInSurfaceStateAndStateless, -1, "-1: default, >=0 : following policy will be programmed in render surface state (for regular buffers) and stateless L1 caching")
DECLARE_DEBUG_VARIABLE(int32_t, PlaformSupportEvictIfNecessaryFlag, -1, "-1: default - platform specific, 0: disable, 1: enable")
DECLARE_DEBUG_VARIABLE(int32_t, ForceEvictOnlyIfNecessaryFlag, -1, "-1: default - driver selects when to use, 0: force never use this flag, 1: force always use this flag")
DECLARE_DEBUG_VARIABLE(int32_t, ForceStatelessMocsEncryptionBit, -1, "-1: default - 1: set encryption bit")
/*LOGGING FLAGS*/
DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagnostics messages to standard output, value corresponds to hint level")

View File

@ -64,6 +64,8 @@ void StateBaseAddressHelper<Gen8Family>::programStateBaseAddress(
args.statelessMocsIndex = args.statelessMocsIndex << 1;
GmmHelper::applyMocsEncryptionBit(args.statelessMocsIndex);
args.stateBaseAddressCmd->setStatelessDataPortAccessMemoryObjectControlState(args.statelessMocsIndex);
appendStateBaseAddressParameters(args, true);

View File

@ -38,6 +38,12 @@ uint32_t GmmHelper::getMOCS(uint32_t type) const {
return static_cast<uint32_t>(mocs.DwordValue);
}
void GmmHelper::applyMocsEncryptionBit(uint32_t &index) {
if (DebugManager.flags.ForceStatelessMocsEncryptionBit.get() == 1) {
index |= 1;
}
}
GmmHelper::GmmHelper(OSInterface *osInterface, const HardwareInfo *pHwInfo) : hwInfo(pHwInfo) {
auto hwInfoAddressWidth = Math::log2(hwInfo->capabilityTable.gpuAddressSpace + 1);
addressWidth = std::max(hwInfoAddressWidth, 48u);

View File

@ -22,6 +22,7 @@ class GmmHelper {
const HardwareInfo *getHardwareInfo();
uint32_t getMOCS(uint32_t type) const;
static void applyMocsEncryptionBit(uint32_t &index);
void forceAllResourcesUncached() { allResourcesUncached = true; };
static constexpr uint64_t maxPossiblePitch = (1ull << 31);

View File

@ -93,6 +93,8 @@ void StateBaseAddressHelper<GfxFamily>::programStateBaseAddress(
args.statelessMocsIndex = args.statelessMocsIndex << 1;
GmmHelper::applyMocsEncryptionBit(args.statelessMocsIndex);
args.stateBaseAddressCmd->setStatelessDataPortAccessMemoryObjectControlState(args.statelessMocsIndex);
appendStateBaseAddressParameters(args, overrideBindlessSurfaceStateBase);

View File

@ -86,8 +86,14 @@ void StateBaseAddressHelper<GfxFamily>::appendStateBaseAddressParameters(
setSbaStatelessCompressionParams<GfxFamily>(args.stateBaseAddressCmd, args.memoryCompressionState);
}
if (args.stateBaseAddressCmd->getStatelessDataPortAccessMemoryObjectControlState() == args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) && DebugManager.flags.ForceL1Caching.get() != 0) {
args.stateBaseAddressCmd->setStatelessDataPortAccessMemoryObjectControlState(args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
bool l3MocsEnabled = (args.stateBaseAddressCmd->getStatelessDataPortAccessMemoryObjectControlState() >> 1) == (args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
bool constMocsAllowed = (l3MocsEnabled && (DebugManager.flags.ForceL1Caching.get() != 0));
if (constMocsAllowed) {
auto constMocsIndex = args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
GmmHelper::applyMocsEncryptionBit(constMocsIndex);
args.stateBaseAddressCmd->setStatelessDataPortAccessMemoryObjectControlState(constMocsIndex);
}
appendExtraCacheSettings(args);

View File

@ -457,4 +457,5 @@ ForceCsrLockInBcsEnqueueOnlyForGpgpuSubmission = -1
ExperimentalEnableTileAttach = 0
DirectSubmissionDisablePrefetcher = -1
ForceDefaultGrfCompilationMode = 0
ForceLargeGrfCompilationMode = 0
ForceLargeGrfCompilationMode = 0
ForceStatelessMocsEncryptionBit = -1