performance: cache MOCS values

This change caches the most used MOCS values:

* getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
* getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
* getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
inside gmmHelper class during initialization to avoid repeated
calls of virtual functions, branches and/or gmm lib access.

and adds more readably corresponding getters:
* getL1EnabledMOCS
* getL3EnabledMOCS
* getUncachedMOCS

If force all resources uncached is called,
these 3 cached mocs values are reinitialized

It also changes the order of gmmHelper members, to avoid
not needed padding after addressWidth
and simplifies logic in getMocsIndex function
for xehp and later products.

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk 2025-04-14 12:15:51 +00:00 committed by Compute-Runtime-Automation
parent 5a545073f6
commit dd3d294f87
68 changed files with 231 additions and 195 deletions

View File

@ -243,7 +243,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
this->signalAllEventPackets = L0GfxCoreHelper::useSignalAllEventPackets(hwInfo);
this->dynamicHeapRequired = NEO::EncodeDispatchKernel<GfxFamily>::isDshNeeded(device->getDeviceInfo());
this->doubleSbaWa = productHelper.isAdditionalStateBaseAddressWARequired(hwInfo);
this->defaultMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
this->defaultMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
this->l1CachePolicyData.init(productHelper);
this->cmdListHeapAddressModel = L0GfxCoreHelper::getHeapAddressModel(rootDeviceEnvironment);
this->dummyBlitWa.rootDeviceEnvironment = &(neoDevice->getRootDeviceEnvironmentRef());

View File

@ -2631,7 +2631,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandListCreateTests, whenCommandListIsCreatedT
EXPECT_TRUE(cmdSba->getSurfaceStateBaseAddressModifyEnable());
EXPECT_EQ(ssh->getHeapGpuBase(), cmdSba->getSurfaceStateBaseAddress());
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), cmdSba->getStatelessDataPortAccessMemoryObjectControlState());
EXPECT_EQ(gmmHelper->getL3EnabledMOCS(), cmdSba->getStatelessDataPortAccessMemoryObjectControlState());
}
HWTEST_F(CommandListCreateTests, givenCommandListWithCopyOnlyWhenCreatedThenStateBaseAddressCmdIsNotProgrammedAndHeapIsNotAllocated) {

View File

@ -115,7 +115,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandListTests, whenCommandListIsCreatedThenPCAnd
EXPECT_EQ(ssh->getHeapGpuBase(), cmdSba->getSurfaceStateBaseAddress());
}
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST), cmdSba->getStatelessDataPortAccessMemoryObjectControlState());
EXPECT_EQ(gmmHelper->getL1EnabledMOCS(), cmdSba->getStatelessDataPortAccessMemoryObjectControlState());
}
HWTEST2_F(CommandListTests, whenCommandListIsCreatedAndProgramExtendedPipeControlPriorToNonPipelinedStateCommandIsEnabledThenPCAndStateBaseAddressCmdsAreAddedAndCorrectlyProgrammed, IsAtLeastXeHpCore) {
@ -203,7 +203,7 @@ HWTEST2_F(CommandListTests, whenCommandListIsCreatedAndProgramExtendedPipeContro
EXPECT_EQ(ssh->getHeapGpuBase(), cmdSba->getSurfaceStateBaseAddress());
}
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST), cmdSba->getStatelessDataPortAccessMemoryObjectControlState());
EXPECT_EQ(gmmHelper->getL1EnabledMOCS(), cmdSba->getStatelessDataPortAccessMemoryObjectControlState());
}
using CommandListTestsReserveSize = Test<DeviceFixture>;

View File

@ -139,7 +139,7 @@ HWTEST2_F(CommandQueueProgramSBATest, whenProgrammingStateBaseAddressWithStatele
auto pSbaCmd = static_cast<STATE_BASE_ADDRESS *>(*itor);
uint32_t statelessMocsIndex = pSbaCmd->getStatelessDataPortAccessMemoryObjectControlState();
auto gmmHelper = device->getNEODevice()->getGmmHelper();
uint32_t expectedMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
uint32_t expectedMocs = gmmHelper->getUncachedMOCS();
EXPECT_EQ(statelessMocsIndex, expectedMocs);
commandQueue->destroy();

View File

@ -304,7 +304,7 @@ HWTEST2_P(L0DebuggerParameterizedTests, givenDebuggerWhenAppendingKernelToComman
auto debugSurfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ssh->getCpuBase());
const auto mocsNoCache = device->getNEODevice()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
const auto mocsNoCache = device->getNEODevice()->getGmmHelper()->getUncachedMOCS();
const auto actualMocs = debugSurfaceState->getMemoryObjectControlState();
EXPECT_EQ(actualMocs, mocsNoCache);
@ -1001,7 +1001,7 @@ HWTEST2_F(L0DebuggerGlobalStatelessTest,
ASSERT_NE(debugSurface, nullptr);
ASSERT_EQ(debugSurface->getGpuAddress(), debugSurfaceState->getSurfaceBaseAddress());
const auto mocsNoCache = device->getNEODevice()->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
const auto mocsNoCache = device->getNEODevice()->getGmmHelper()->getUncachedMOCS();
const auto actualMocs = debugSurfaceState->getMemoryObjectControlState();
EXPECT_EQ(actualMocs, mocsNoCache);

View File

@ -681,7 +681,7 @@ HWTEST2_F(ModuleUncachedBufferTest,
EXPECT_EQ(devicePtr, reinterpret_cast<void *>(surfaceStateAddress->getSurfaceBaseAddress()));
auto gmmHelper = device->getNEODevice()->getGmmHelper();
uint32_t expectedMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
uint32_t expectedMocs = gmmHelper->getUncachedMOCS();
EXPECT_EQ(expectedMocs, surfaceStateAddress->getMemoryObjectControlState());

View File

@ -898,9 +898,9 @@ uint32_t Buffer::getMocsValue(bool disableL3Cache, bool isReadOnlyArgument, uint
auto gmmHelper = executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->getGmmHelper();
if (!disableL3Cache && !isMemObjUncacheableForSurfaceState() && (alignedMemObj || readOnlyMemObj || !isMemObjZeroCopy())) {
return gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
return gmmHelper->getL3EnabledMOCS();
} else {
return gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
return gmmHelper->getUncachedMOCS();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -76,8 +76,8 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, clMemLocallyUncachedResourceFixture, GivenAtLeast
auto bufferUncacheable2 = clCreateBufferWithPropertiesINTEL(context, propertiesUncacheable, 0, n * sizeof(float), nullptr, nullptr);
auto pBufferUncacheable2 = clUniquePtr(castToObject<Buffer>(bufferUncacheable2));
auto mocsCacheable = pClDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocsUncacheable = pClDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto mocsCacheable = pClDevice->getGmmHelper()->getL3EnabledMOCS();
auto mocsUncacheable = pClDevice->getGmmHelper()->getUncachedMOCS();
retVal = clSetKernelArg(pMultiDeviceKernel, 0, sizeof(cl_mem), &bufferCacheable1);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -153,8 +153,8 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, clMemLocallyUncachedResourceFixture, givenBuffers
auto bufferUncacheable2 = clCreateBufferWithPropertiesINTEL(context, propertiesUncacheableInSurfaceState, 0, n * sizeof(float), nullptr, nullptr);
auto pBufferUncacheable2 = clUniquePtr(castToObject<Buffer>(bufferUncacheable2));
auto mocsCacheable = pClDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocsUncacheable = pClDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto mocsCacheable = pClDevice->getGmmHelper()->getL3EnabledMOCS();
auto mocsUncacheable = pClDevice->getGmmHelper()->getUncachedMOCS();
retVal = clSetKernelArg(pMultiDeviceKernel, 0, sizeof(cl_mem), &bufferCacheable1);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -227,8 +227,8 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, clMemLocallyUncachedResourceFixture, givenBuffers
auto bufferUncacheable2 = clCreateBufferWithPropertiesINTEL(context, propertiesUncacheable, 0, n * sizeof(float), nullptr, nullptr);
auto pBufferUncacheable2 = clUniquePtr(castToObject<Buffer>(bufferUncacheable2));
auto mocsCacheable = pClDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocsUncacheable = pClDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto mocsCacheable = pClDevice->getGmmHelper()->getL3EnabledMOCS();
auto mocsUncacheable = pClDevice->getGmmHelper()->getUncachedMOCS();
retVal = clSetKernelArg(pMultiDeviceKernel, 0, sizeof(cl_mem), &bufferCacheable1);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -301,8 +301,8 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, clMemLocallyUncachedResourceFixture, WhenUnsettin
auto bufferUncacheable = clCreateBufferWithPropertiesINTEL(context, propertiesUncacheable, 0, n * sizeof(float), nullptr, nullptr);
auto pBufferUncacheable = clUniquePtr(castToObject<Buffer>(bufferUncacheable));
auto mocsCacheable = pClDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocsUncacheable = pClDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto mocsCacheable = pClDevice->getGmmHelper()->getL3EnabledMOCS();
auto mocsUncacheable = pClDevice->getGmmHelper()->getUncachedMOCS();
retVal = clSetKernelArg(pMultiDeviceKernel, 0, sizeof(cl_mem), &bufferCacheable1);
EXPECT_EQ(CL_SUCCESS, retVal);

View File

@ -206,7 +206,7 @@ HWCMDTEST_P(IGFX_XE_HP_CORE, AuxBuiltInTests, givenXeHpCoreCommandsAndAuxTransla
{
// read args
auto argNum = 0;
auto expectedMocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto expectedMocs = pDevice->getGmmHelper()->getUncachedMOCS();
auto sshBase = mockAuxBuiltInOp.convertToAuxKernel[0]->getSurfaceStateHeap();
auto sshOffset = mockAuxBuiltInOp.convertToAuxKernel[0]->getKernelInfo().getArgDescriptorAt(argNum).as<ArgDescPointer>().bindful;
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(sshBase, sshOffset));
@ -221,7 +221,7 @@ HWCMDTEST_P(IGFX_XE_HP_CORE, AuxBuiltInTests, givenXeHpCoreCommandsAndAuxTransla
{
// write args
auto argNum = 1;
auto expectedMocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
auto expectedMocs = pDevice->getGmmHelper()->getL1EnabledMOCS();
auto sshBase = mockAuxBuiltInOp.convertToAuxKernel[0]->getSurfaceStateHeap();
auto sshOffset = mockAuxBuiltInOp.convertToAuxKernel[0]->getKernelInfo().getArgDescriptorAt(argNum).as<ArgDescPointer>().bindful;
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(sshBase, sshOffset));
@ -700,7 +700,7 @@ HWCMDTEST_P(IGFX_GEN12LP_CORE, AuxBuiltInTests, givenAuxTranslationKernelWhenSet
{
// read args
auto argNum = 0;
auto expectedMocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto expectedMocs = pDevice->getGmmHelper()->getUncachedMOCS();
auto sshBase = mockAuxBuiltInOp.convertToAuxKernel[0]->getSurfaceStateHeap();
auto sshOffset = mockAuxBuiltInOp.convertToAuxKernel[0]->getKernelInfo().getArgDescriptorAt(argNum).as<ArgDescPointer>().bindful;
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(sshBase, sshOffset));
@ -715,7 +715,7 @@ HWCMDTEST_P(IGFX_GEN12LP_CORE, AuxBuiltInTests, givenAuxTranslationKernelWhenSet
{
// write args
auto argNum = 1;
auto expectedMocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs = pDevice->getGmmHelper()->getL3EnabledMOCS();
auto sshBase = mockAuxBuiltInOp.convertToAuxKernel[0]->getSurfaceStateHeap();
auto sshOffset = mockAuxBuiltInOp.convertToAuxKernel[0]->getKernelInfo().getArgDescriptorAt(argNum).as<ArgDescPointer>().bindful;
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ptrOffset(sshBase, sshOffset));

View File

@ -130,7 +130,7 @@ HWTEST2_F(Dg2AndLaterDispatchWalkerBasicTest, givenTimestampPacketWhenDispatchin
auto gmmHelper = device->getGmmHelper();
auto expectedMocs = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getRootDeviceEnvironment()) ? gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) : gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getRootDeviceEnvironment()) ? gmmHelper->getUncachedMOCS() : gmmHelper->getL3EnabledMOCS();
auto walker = genCmdCast<DefaultWalkerType *>(*hwParser.itorWalker);
EXPECT_EQ(POSTSYNC_DATA::OPERATION::OPERATION_WRITE_TIMESTAMP, walker->getPostSync().getOperation());
@ -208,7 +208,7 @@ HWTEST2_F(Dg2AndLaterDispatchWalkerBasicTest, givenDebugVariableEnabledWhenEnque
EXPECT_NE(hwParser.itorWalker, hwParser.cmdList.end());
auto gmmHelper = device->getGmmHelper();
auto expectedMocs = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getRootDeviceEnvironment()) ? gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) : gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getRootDeviceEnvironment()) ? gmmHelper->getUncachedMOCS() : gmmHelper->getL3EnabledMOCS();
WalkerVariant walkerVariant = NEO::UnitTestHelper<FamilyType>::getWalkerVariant(*hwParser.itorWalker);

View File

@ -484,7 +484,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenTimestamp
EXPECT_NE(hwParser.itorWalker, hwParser.cmdList.end());
auto gmmHelper = device->getGmmHelper();
auto expectedMocs = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getRootDeviceEnvironment()) ? gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) : gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getRootDeviceEnvironment()) ? gmmHelper->getUncachedMOCS() : gmmHelper->getL3EnabledMOCS();
auto walker = genCmdCast<DefaultWalkerType *>(*hwParser.itorWalker);
EXPECT_EQ(PostSyncType::OPERATION::OPERATION_WRITE_TIMESTAMP, walker->getPostSync().getOperation());
@ -522,7 +522,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenDebugVari
EXPECT_NE(hwParser.itorWalker, hwParser.cmdList.end());
auto gmmHelper = device->getGmmHelper();
auto expectedMocs = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getRootDeviceEnvironment()) ? gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) : gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, device->getRootDeviceEnvironment()) ? gmmHelper->getUncachedMOCS() : gmmHelper->getL3EnabledMOCS();
WalkerVariant walkerVariant = NEO::UnitTestHelper<FamilyType>::getWalkerVariant(*hwParser.itorWalker);
std::visit([expectedMocs](auto &&walker) {

View File

@ -336,8 +336,8 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenAlignedPointerAndAlignedSizeWhenReadBuf
EXPECT_EQ(CL_SUCCESS, retVal);
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto gmmHelper = pDevice->getGmmHelper();
auto mocsIndexL3on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
auto mocsIndexL1on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
auto mocsIndexL3on = gmmHelper->getL3EnabledMOCS() >> 1;
auto mocsIndexL1on = gmmHelper->getL1EnabledMOCS() >> 1;
EXPECT_TRUE(mocsIndexL3on == csr.latestSentStatelessMocsConfig || mocsIndexL1on == csr.latestSentStatelessMocsConfig);
}
@ -364,9 +364,9 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenNotAlignedPointerAndAlignedSizeWhenRead
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto gmmHelper = pDevice->getGmmHelper();
auto mocsIndexL3off = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
auto mocsIndexL3on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
auto mocsIndexL1on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
auto mocsIndexL3off = gmmHelper->getUncachedMOCS() >> 1;
auto mocsIndexL3on = gmmHelper->getL3EnabledMOCS() >> 1;
auto mocsIndexL1on = gmmHelper->getL1EnabledMOCS() >> 1;
EXPECT_EQ(mocsIndexL3off, csr.latestSentStatelessMocsConfig);
@ -410,7 +410,7 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenNotAlignedPointerAndSizeWhenBlockedRead
EXPECT_EQ(CL_SUCCESS, retVal);
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
auto gmmHelper = pDevice->getGmmHelper();
auto mocsIndexL3off = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
auto mocsIndexL3off = gmmHelper->getUncachedMOCS() >> 1;
EXPECT_EQ(mocsIndexL3off, csr.latestSentStatelessMocsConfig);
clReleaseEvent(userEvent);

View File

@ -566,7 +566,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandStreamReceiverFlushTaskTests, WhenFlushing
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
auto gmmHelper = pDevice->getGmmHelper();
auto stateHeapMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER);
auto l3CacheOnMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto l3CacheOnMocs = gmmHelper->getL3EnabledMOCS();
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
flushTask(commandStreamReceiver);

View File

@ -464,7 +464,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandStreamReceiverFlushTaskXeHPAndLaterTests, Wh
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
auto gmmHelper = pDevice->getGmmHelper();
auto stateHeapMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER);
auto l1CacheOnMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
auto l1CacheOnMocs = gmmHelper->getL1EnabledMOCS();
auto &commandStreamReceiver = pDevice->getUltCommandStreamReceiver<FamilyType>();
if (commandStreamReceiver.heaplessStateInitialized) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -45,7 +45,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenBufferNotReadonlyWhenProgrammingSurfaceStat
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, device->getDevice(), false);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -62,7 +62,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenBufferReadonlyWhenProgrammingSurfaceStateTh
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, true, context->getDevice(0)->getDevice(), false);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -80,7 +80,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenConstantSurfaceWhenProgrammingSurfaceStateT
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context->getDevice(0)->getDevice(), false);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -100,7 +100,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenL1ForceEnabledWhenProgrammingSurfaceStateTh
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, device->getDevice(), false);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -120,7 +120,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenBufferReadonlyAndL1ForceEnabledWhenProgramm
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, device->getDevice(), false);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = device->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -140,7 +140,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenBufferReadonlyL1ForceDisabledWhenProgrammin
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, true, device->getDevice(), false);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2024 Intel Corporation
* Copyright (C) 2019-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -307,8 +307,8 @@ GEN12LPTEST_F(GfxCoreHelperTestGen12Lp, whenRequestingMocsThenProperMocsIndicesA
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto gmmHelper = this->pDevice->getGmmHelper();
const auto mocsNoCache = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
const auto mocsL3 = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
const auto mocsNoCache = gmmHelper->getUncachedMOCS() >> 1;
const auto mocsL3 = gmmHelper->getL3EnabledMOCS() >> 1;
EXPECT_EQ(mocsNoCache, gfxCoreHelper.getMocsIndex(*gmmHelper, false, false));
EXPECT_EQ(mocsNoCache, gfxCoreHelper.getMocsIndex(*gmmHelper, false, true));
@ -323,9 +323,9 @@ GEN12LPTEST_F(GfxCoreHelperTestGen12Lp, givenL1ForceEnabledWhenRequestingMocsThe
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto gmmHelper = this->pDevice->getGmmHelper();
const auto mocsNoCache = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
const auto mocsL3 = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
const auto mocsL1 = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
const auto mocsNoCache = gmmHelper->getUncachedMOCS() >> 1;
const auto mocsL3 = gmmHelper->getL3EnabledMOCS() >> 1;
const auto mocsL1 = gmmHelper->getL1EnabledMOCS() >> 1;
EXPECT_EQ(mocsNoCache, gfxCoreHelper.getMocsIndex(*gmmHelper, false, false));
EXPECT_EQ(mocsNoCache, gfxCoreHelper.getMocsIndex(*gmmHelper, false, true));
@ -340,8 +340,8 @@ GEN12LPTEST_F(GfxCoreHelperTestGen12Lp, givenL1ForceDisabledWhenRequestingMocsTh
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto gmmHelper = this->pDevice->getGmmHelper();
const auto mocsNoCache = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
const auto mocsL3 = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
const auto mocsNoCache = gmmHelper->getUncachedMOCS() >> 1;
const auto mocsL3 = gmmHelper->getL3EnabledMOCS() >> 1;
EXPECT_EQ(mocsNoCache, gfxCoreHelper.getMocsIndex(*gmmHelper, false, false));
EXPECT_EQ(mocsNoCache, gfxCoreHelper.getMocsIndex(*gmmHelper, false, true));

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2023 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -40,7 +40,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenBufferNotReadonlyWhenProgrammingSurfaceStat
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, device->getDevice(), false, 1u);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -57,7 +57,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenBufferReadonlyWhenProgrammingSurfaceStateTh
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, true, context->getDevice(0)->getDevice(), false, 1u);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = device->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -75,7 +75,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenConstantSurfaceWhenProgrammingSurfaceStateT
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context->getDevice(0)->getDevice(), false, 1u);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = device->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -95,7 +95,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenL1ForceEnabledWhenProgrammingSurfaceStateTh
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, device->getDevice(), false, 1u);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = device->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -115,7 +115,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenBufferReadonlyL1ForceDisabledWhenProgrammin
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, true, device->getDevice(), false, 1u);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}

View File

@ -249,7 +249,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHpCommandStreamReceiverFlushTaskTests, whenFlushC
hwParserCsr.findHardwareCommands<FamilyType>();
ASSERT_NE(nullptr, hwParserCsr.cmdStateBaseAddress);
auto stateBaseAddress = static_cast<STATE_BASE_ADDRESS *>(hwParserCsr.cmdStateBaseAddress);
auto expectedMocsForStateless = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
auto expectedMocsForStateless = gmmHelper->getL1EnabledMOCS();
auto expectedMocsForHeap = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER);
EXPECT_EQ(expectedMocsForHeap, stateBaseAddress->getSurfaceStateMemoryObjectControlState());
@ -298,7 +298,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHpCommandStreamReceiverFlushTaskTests, givenL3ToL
hwParserCsr.findHardwareCommands<FamilyType>();
ASSERT_NE(nullptr, hwParserCsr.cmdStateBaseAddress);
auto stateBaseAddress = static_cast<STATE_BASE_ADDRESS *>(hwParserCsr.cmdStateBaseAddress);
auto expectedMocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
auto expectedMocs = pDevice->getGmmHelper()->getL1EnabledMOCS();
EXPECT_EQ(expectedMocs, stateBaseAddress->getStatelessDataPortAccessMemoryObjectControlState());
}
@ -317,7 +317,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHpCommandStreamReceiverFlushTaskTests, givenForce
hwParserCsr.findHardwareCommands<FamilyType>();
ASSERT_NE(nullptr, hwParserCsr.cmdStateBaseAddress);
auto stateBaseAddress = static_cast<STATE_BASE_ADDRESS *>(hwParserCsr.cmdStateBaseAddress);
auto expectedMocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs = pDevice->getGmmHelper()->getL3EnabledMOCS();
EXPECT_EQ(expectedMocs, stateBaseAddress->getStatelessDataPortAccessMemoryObjectControlState());
}

View File

@ -3887,7 +3887,7 @@ HWTEST2_F(KernelConstantSurfaceTest, givenKernelWithConstantSurfaceWhenKernelIsC
ptrOffset(kernel->getSurfaceStateHeap(),
pKernelInfo->kernelDescriptor.payloadMappings.implicitArgs.globalConstantsSurfaceAddress.bindful));
auto actualMocs = surfaceState->getMemoryObjectControlState();
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
EXPECT_EQ(expectedMocs, actualMocs);

View File

@ -7,6 +7,7 @@
#include "shared/source/device/device.h"
#include "shared/source/direct_submission/direct_submission_controller.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/basic_math.h"
#include "shared/source/helpers/gfx_core_helper.h"
@ -26,6 +27,7 @@
#include "shared/test/common/libult/signal_utils.h"
#include "shared/test/common/mocks/mock_compiler_product_helper.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_gmm_client_context.h"
#include "shared/test/common/mocks/mock_release_helper.h"
#include "shared/test/common/os_interface/linux/device_command_stream_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
@ -862,6 +864,7 @@ int main(int argc, char **argv) {
initializeTestedDevice();
Os::dxcoreDllName = "";
GmmHelper::createGmmContextWrapperFunc = GmmClientContext::create<MockGmmClientContext>;
int sigOut = setAlarm(enableAlarm);
if (sigOut != 0)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -141,8 +141,8 @@ HWTEST_F(BufferSetArgTest, givenSetKernelArgOnReadOnlyBufferThatIsMisalingedWhen
auto surfaceState = reinterpret_cast<const RENDER_SURFACE_STATE *>(ptrOffset(pKernel->getSurfaceStateHeap(), pKernelInfo->argAsPtr(0).bindful));
auto mocs = surfaceState->getMemoryObjectControlState();
auto gmmHelper = pDevice->getGmmHelper();
auto expectedMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs2 = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
auto expectedMocs = gmmHelper->getL3EnabledMOCS();
auto expectedMocs2 = gmmHelper->getL1EnabledMOCS();
EXPECT_TRUE(expectedMocs == mocs || expectedMocs2 == mocs);
}

View File

@ -1513,7 +1513,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, BufferSetSurfaceTests, givenBufferSetSurfaceThatM
auto mocs = surfaceState.getMemoryObjectControlState();
auto gmmHelper = device->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), mocs);
EXPECT_EQ(gmmHelper->getL3EnabledMOCS(), mocs);
alignedFree(ptr);
}
@ -1532,7 +1532,7 @@ HWTEST_F(BufferSetSurfaceTests, givenDebugVariableToDisableCachingForStatefulBuf
auto mocs = surfaceState.getMemoryObjectControlState();
auto gmmHelper = device->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), mocs);
EXPECT_EQ(gmmHelper->getUncachedMOCS(), mocs);
alignedFree(ptr);
debugManager.flags.DisableCachingForStatefulBufferAccess.set(false);
@ -1552,7 +1552,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryPtrIsUnalignedToC
auto mocs = surfaceState.getMemoryObjectControlState();
auto gmmHelper = device->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), mocs);
EXPECT_EQ(gmmHelper->getUncachedMOCS(), mocs);
alignedFree(ptr);
}
@ -1571,7 +1571,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemorySizeIsUnalignedTo
auto mocs = surfaceState.getMemoryObjectControlState();
auto gmmHelper = device->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), mocs);
EXPECT_EQ(gmmHelper->getUncachedMOCS(), mocs);
alignedFree(ptr);
}
@ -1590,7 +1590,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferSetSurfaceThatMemoryIsUnalignedToCach
auto mocs = surfaceState.getMemoryObjectControlState();
auto gmmHelper = device->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), mocs);
EXPECT_EQ(gmmHelper->getL3EnabledMOCS(), mocs);
alignedFree(ptr);
}
@ -1750,7 +1750,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferWhenSetArgStatefulWithL3ChacheDisable
auto mocs = surfaceState.getMemoryObjectControlState();
auto gmmHelper = device->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), mocs);
EXPECT_EQ(gmmHelper->getUncachedMOCS(), mocs);
EXPECT_EQ(128u, surfaceState.getWidth());
EXPECT_EQ(4u, surfaceState.getHeight());
}
@ -1778,8 +1778,8 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferThatIsMisalignedButIsAReadOnlyArgumen
auto mocs = surfaceState.getMemoryObjectControlState();
auto gmmHelper = device->getGmmHelper();
auto expectedMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs2 = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
auto expectedMocs = gmmHelper->getL3EnabledMOCS();
auto expectedMocs2 = gmmHelper->getL1EnabledMOCS();
EXPECT_TRUE(expectedMocs == mocs || expectedMocs2 == mocs);
}
@ -1801,7 +1801,7 @@ HWTEST_F(BufferSetSurfaceTests, givenAlignedCacheableReadOnlyBufferThenChoseOclB
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
@ -1826,7 +1826,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, BufferSetSurfaceTests, givenAlignedCacheableNonRe
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = device->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
@ -1912,7 +1912,7 @@ HWTEST_F(BufferSetSurfaceTests, givenBufferThatIsMisalignedWhenSurfaceStateIsBei
Buffer::setSurfaceState(device.get(), &surfaceState, false, false, 5, svmPtr, 0, nullptr, 0, 0, false);
EXPECT_EQ(device->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), surfaceState.getMemoryObjectControlState());
EXPECT_EQ(device->getGmmHelper()->getUncachedMOCS(), surfaceState.getMemoryObjectControlState());
}
using BufferHwFromDeviceTests = BufferTests;
@ -2128,8 +2128,8 @@ HWTEST_P(BufferL3CacheTests, givenMisalignedAndAlignedBufferWhenClEnqueueWriteIm
ASSERT_NE(surfaceStateAddress, nullptr);
auto surfaceState = *reinterpret_cast<RENDER_SURFACE_STATE *>(surfaceStateAddress);
auto expect = ctx.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expect2 = ctx.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
auto expect = ctx.getDevice(0)->getGmmHelper()->getL3EnabledMOCS();
auto expect2 = ctx.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
EXPECT_NE(0u, surfaceState.getMemoryObjectControlState());
EXPECT_TRUE(expect == surfaceState.getMemoryObjectControlState() || expect2 == surfaceState.getMemoryObjectControlState());
@ -2154,8 +2154,8 @@ HWTEST_P(BufferL3CacheTests, givenMisalignedAndAlignedBufferWhenClEnqueueWriteBu
clEnqueueWriteBufferRect(&cmdQ, buffer, false, origin, origin, region, 0, 0, 0, 0, hostPtr, 0, nullptr, nullptr);
auto expect = ctx.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expect2 = ctx.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
auto expect = ctx.getDevice(0)->getGmmHelper()->getL3EnabledMOCS();
auto expect2 = ctx.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
EXPECT_NE(0u, surfaceState->getMemoryObjectControlState());
EXPECT_TRUE(expect == surfaceState->getMemoryObjectControlState() || expect2 == surfaceState->getMemoryObjectControlState());

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -180,7 +180,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenDebugVariableForcingL
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -204,7 +204,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenDebugVariableForcingL
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getL3EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -226,7 +226,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenBufferWhenArgumentIsC
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, true, true, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getUncachedMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
}
@ -246,7 +246,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenBufferSetSurfaceThatM
auto mocs = surfaceState.getMemoryObjectControlState();
auto gmmHelper = device->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST), mocs);
EXPECT_EQ(gmmHelper->getL1EnabledMOCS(), mocs);
alignedFree(ptr);
}
@ -269,7 +269,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterBufferTests, givenAlignedCacheableNonRe
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getDevice().getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = context.getDevice(0)->getDevice().getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);

View File

@ -1054,7 +1054,7 @@ XE2_HPG_CORETEST_F(Xe2BcsTests, givenOverriddenMocksValueWhenAppendBlitCommandsB
bltCmd->setDestinationX2CoordinateRight(1);
bltCmd->setDestinationY2CoordinateBottom(1);
uint32_t mockValue = context->getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
uint32_t mockValue = context->getDevice(0)->getGmmHelper()->getL3EnabledMOCS();
uint32_t newValue = mockValue + 1;
debugManager.flags.OverrideBlitterMocs.set(newValue);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -96,7 +96,7 @@ XE2_HPG_CORETEST_F(CmdsProgrammingTestsXe2HpgCore, givenAlignedCacheableReadOnly
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);

View File

@ -733,7 +733,7 @@ XE3_CORETEST_F(Xe3BcsTests, givenOverriddenMocksValueWhenAppendBlitCommandsBlock
bltCmd->setDestinationX2CoordinateRight(1);
bltCmd->setDestinationY2CoordinateBottom(1);
uint32_t mockValue = context->getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
uint32_t mockValue = context->getDevice(0)->getGmmHelper()->getL3EnabledMOCS();
uint32_t newValue = mockValue + 1;
debugManager.flags.OverrideBlitterMocs.set(newValue);

View File

@ -96,7 +96,7 @@ XE3_CORETEST_F(CmdsProgrammingTestsXe3Core, givenAlignedCacheableReadOnlyBufferT
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);

View File

@ -157,7 +157,7 @@ XE_HPC_CORETEST_F(BlitXeHpcCoreTests, givenTransferLargerThenHalfOfL3WhenItIsPro
ASSERT_NE(hwParser.cmdList.end(), itorBltCmd);
MEM_COPY *bltCmd = (MEM_COPY *)*itorBltCmd;
auto mocsL3disabled = clDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto mocsL3disabled = clDevice->getGmmHelper()->getUncachedMOCS();
EXPECT_EQ(mocsL3disabled, bltCmd->getDestinationMOCS());
EXPECT_EQ(mocsL3disabled, bltCmd->getSourceMOCS());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -96,7 +96,7 @@ XE_HPC_CORETEST_F(CmdsProgrammingTestsXeHpcCore, givenAlignedCacheableReadOnlyBu
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);

View File

@ -76,7 +76,7 @@ XE_HPG_CORETEST_F(BlitXeHpgCoreTests, givenBufferWhenProgrammingBltCommandThenSe
auto bltCmd = genCmdCast<XY_COPY_BLT *>(*(hwParser.cmdList.begin()));
EXPECT_NE(nullptr, bltCmd);
auto mocs = clDevice->getRootDeviceEnvironment().getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto mocs = clDevice->getRootDeviceEnvironment().getGmmHelper()->getUncachedMOCS();
EXPECT_EQ(mocs, bltCmd->getDestinationMOCS());
EXPECT_EQ(mocs, bltCmd->getSourceMOCS());

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -120,7 +120,7 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenAlignedCacheableReadOnlyBufferThenChoseO
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);
@ -150,7 +150,7 @@ DG2TEST_F(CmdsProgrammingTestsDg2, givenAlignedCacheableReadOnlyBufferAndDebugge
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, clDevice->getDevice(), false);
const auto expectedMocs = clDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = clDevice->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -99,7 +99,7 @@ XE_HPG_CORETEST_F(CmdsProgrammingTestsXeHpgCore, givenAlignedCacheableReadOnlyBu
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context.getDevice(0)->getDevice(), false);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
const auto expectedMocs = context.getDevice(0)->getGmmHelper()->getL1EnabledMOCS();
const auto actualMocs = surfaceState.getMemoryObjectControlState();
EXPECT_EQ(expectedMocs, actualMocs);

View File

@ -478,7 +478,7 @@ void EncodeSurfaceState<Family>::encodeBuffer(EncodeSurfaceStateArgs &args) {
}
if (debugManager.flags.DisableCachingForStatefulBufferAccess.get()) {
surfaceState->setMemoryObjectControlState(args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
surfaceState->setMemoryObjectControlState(args.gmmHelper->getUncachedMOCS());
}
EncodeSurfaceState<Family>::encodeExtraBufferParams(args);

View File

@ -309,7 +309,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
STATE_BASE_ADDRESS sbaCmd;
auto gmmHelper = container.getDevice()->getGmmHelper();
uint32_t statelessMocsIndex =
args.requiresUncachedMocs ? (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1) : (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
args.requiresUncachedMocs ? (gmmHelper->getUncachedMOCS() >> 1) : (gmmHelper->getL3EnabledMOCS() >> 1);
auto l1CachePolicy = container.l1CachePolicyDataRef()->getL1CacheValue(false);
auto l1CachePolicyDebuggerActive = container.l1CachePolicyDataRef()->getL1CacheValue(true);
@ -526,9 +526,9 @@ inline uint32_t EncodePostSync<Family>::getPostSyncMocs(const RootDeviceEnvironm
}
if (dcFlush) {
return gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
return gmmHelper->getUncachedMOCS();
} else {
return gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
return gmmHelper->getL3EnabledMOCS();
}
}
@ -790,13 +790,13 @@ void EncodeSurfaceState<Family>::encodeExtraBufferParams(EncodeSurfaceStateArgs
setConstCachePolicy = true;
}
if (surfaceState->getMemoryObjectControlState() == args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) &&
if (surfaceState->getMemoryObjectControlState() == args.gmmHelper->getL3EnabledMOCS() &&
debugManager.flags.ForceL1Caching.get() != 0) {
setConstCachePolicy = true;
}
if (setConstCachePolicy == true) {
surfaceState->setMemoryObjectControlState(args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
surfaceState->setMemoryObjectControlState(args.gmmHelper->getL1EnabledMOCS());
}
encodeExtraCacheSettings(surfaceState, args);

View File

@ -129,7 +129,7 @@ void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchStaticRelaxedOrderingSch
uint64_t loopSectionStartAddress = schedulerStartAddress + RelaxedOrderingHelper::StaticSchedulerSizeAndOffsetSection<GfxFamily>::loopStartSectionStart;
const uint32_t miMathMocs = this->rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const uint32_t miMathMocs = this->rootDeviceEnvironment.getGmmHelper()->getL3EnabledMOCS();
constexpr bool isBcs = Dispatcher::isCopy();
@ -850,7 +850,7 @@ void DirectSubmissionHw<GfxFamily, Dispatcher>::preinitializeRelaxedOrderingSect
LriHelper<GfxFamily>::program(&stream, RegisterOffsets::csGprR8, 8, true, isBcs);
LriHelper<GfxFamily>::program(&stream, RegisterOffsets::csGprR8 + 4, 0, true, isBcs);
const uint32_t miMathMocs = this->rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const uint32_t miMathMocs = this->rootDeviceEnvironment.getGmmHelper()->getL3EnabledMOCS();
EncodeAluHelper<GfxFamily, 9> aluHelper({{
{AluRegisters::opcodeLoad, AluRegisters::srca, AluRegisters::gpr1},

View File

@ -240,7 +240,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
STATE_BASE_ADDRESS sba;
auto gmmHelper = container.getDevice()->getGmmHelper();
uint32_t statelessMocsIndex =
args.requiresUncachedMocs ? (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1) : (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
args.requiresUncachedMocs ? (gmmHelper->getUncachedMOCS() >> 1) : (gmmHelper->getL3EnabledMOCS() >> 1);
auto l1CachePolicy = container.l1CachePolicyDataRef()->getL1CacheValue(false);
auto l1CachePolicyDebuggerActive = container.l1CachePolicyDataRef()->getL1CacheValue(true);
EncodeStateBaseAddressArgs<Family> encodeStateBaseAddressArgs = {
@ -755,7 +755,7 @@ void EncodeWA<Family>::encodeAdditionalPipelineSelect(LinearStream &stream, cons
template <>
void EncodeSurfaceState<Family>::encodeExtraBufferParams(EncodeSurfaceStateArgs &args) {
auto surfaceState = reinterpret_cast<R_SURFACE_STATE *>(args.outMemory);
const bool isL3Allowed = surfaceState->getMemoryObjectControlState() == args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
const bool isL3Allowed = surfaceState->getMemoryObjectControlState() == args.gmmHelper->getL3EnabledMOCS();
if (isL3Allowed) {
const bool isConstantSurface = args.allocation && args.allocation->getAllocationType() == AllocationType::constantSurface;
bool useL1 = args.isReadOnly || isConstantSurface;
@ -765,7 +765,7 @@ void EncodeSurfaceState<Family>::encodeExtraBufferParams(EncodeSurfaceStateArgs
}
if (useL1) {
surfaceState->setMemoryObjectControlState(args.gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
surfaceState->setMemoryObjectControlState(args.gmmHelper->getL1EnabledMOCS());
}
}
}

View File

@ -265,13 +265,13 @@ uint32_t GfxCoreHelperHw<Family>::getMocsIndex(const GmmHelper &gmmHelper, bool
}
if (l1enabled) {
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
return gmmHelper.getL1EnabledMOCS() >> 1;
} else {
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
return gmmHelper.getL3EnabledMOCS() >> 1;
}
}
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
return gmmHelper.getUncachedMOCS() >> 1;
}
template <>

View File

@ -33,6 +33,12 @@ const RootDeviceEnvironment &GmmHelper::getRootDeviceEnvironment() const {
return rootDeviceEnvironment;
}
void GmmHelper::initMocsDefaults() {
mocsL1Enabled = getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST);
mocsL3Enabled = getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
mocsUncached = getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
}
uint32_t GmmHelper::getMOCS(uint32_t type) const {
if (allResourcesUncached || (debugManager.flags.ForceAllResourcesUncached.get() == true)) {
type = GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED;
@ -47,12 +53,29 @@ uint32_t GmmHelper::getMOCS(uint32_t type) const {
return static_cast<uint32_t>(mocs.DwordValue);
}
uint32_t GmmHelper::getL1EnabledMOCS() const {
return mocsL1Enabled;
}
uint32_t GmmHelper::getL3EnabledMOCS() const {
return mocsL3Enabled;
}
uint32_t GmmHelper::getUncachedMOCS() const {
return mocsUncached;
}
void GmmHelper::applyMocsEncryptionBit(uint32_t &index) {
if (debugManager.flags.ForceStatelessMocsEncryptionBit.get() == 1) {
index |= 1;
}
}
void GmmHelper::forceAllResourcesUncached() {
allResourcesUncached = true;
initMocsDefaults();
}
GmmHelper::GmmHelper(const RootDeviceEnvironment &rootDeviceEnvironmentArg) : rootDeviceEnvironment(rootDeviceEnvironmentArg) {
auto hwInfo = getHardwareInfo();
auto hwInfoAddressWidth = Math::log2(hwInfo->capabilityTable.gpuAddressSpace + 1);
@ -60,6 +83,8 @@ GmmHelper::GmmHelper(const RootDeviceEnvironment &rootDeviceEnvironmentArg) : ro
gmmClientContext = GmmHelper::createGmmContextWrapperFunc(rootDeviceEnvironment);
UNRECOVERABLE_IF(!gmmClientContext);
initMocsDefaults();
}
uint64_t GmmHelper::canonize(uint64_t address) const {

View File

@ -21,8 +21,13 @@ class GmmHelper {
const HardwareInfo *getHardwareInfo();
uint32_t getMOCS(uint32_t type) const;
uint32_t getL1EnabledMOCS() const;
uint32_t getL3EnabledMOCS() const;
uint32_t getUncachedMOCS() const;
void initMocsDefaults();
static void applyMocsEncryptionBit(uint32_t &index);
void forceAllResourcesUncached() { allResourcesUncached = true; };
void forceAllResourcesUncached();
static constexpr uint64_t maxPossiblePitch = (1ull << 31);
@ -40,9 +45,12 @@ class GmmHelper {
static std::unique_ptr<GmmClientContext> (*createGmmContextWrapperFunc)(const RootDeviceEnvironment &);
protected:
uint32_t addressWidth;
const RootDeviceEnvironment &rootDeviceEnvironment;
std::unique_ptr<GmmClientContext> gmmClientContext;
uint32_t addressWidth = 0;
uint32_t mocsL1Enabled = 0;
uint32_t mocsL3Enabled = 0;
uint32_t mocsUncached = 0;
bool allResourcesUncached = false;
};
} // namespace NEO

View File

@ -16,7 +16,7 @@ void BlitCommandsHelper<GfxFamily>::dispatchBlitMemoryByteFill(const BlitPropert
using MEM_SET = typename Family::MEM_SET;
auto blitCmd = Family::cmdInitMemSet;
auto mocs = rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocs = rootDeviceEnvironment.getGmmHelper()->getL3EnabledMOCS();
if (debugManager.flags.OverrideBlitterMocs.get() != -1) {
mocs = static_cast<uint32_t>(debugManager.flags.OverrideBlitterMocs.get());
}

View File

@ -60,7 +60,7 @@ void BlitCommandsHelper<GfxFamily>::appendBlitMemoryOptionsForFillBuffer(NEO::Gr
appendExtraMemoryProperties(blitCmd, rootDeviceEnvironment);
auto mocs = rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto mocs = rootDeviceEnvironment.getGmmHelper()->getUncachedMOCS();
if (debugManager.flags.OverrideBlitterMocs.get() != -1) {
mocs = static_cast<uint32_t>(debugManager.flags.OverrideBlitterMocs.get());
}

View File

@ -135,9 +135,9 @@ void GfxCoreHelperHw<Family>::setRenderSurfaceStateForScratchResource(const Root
state.setVerticalLineStrideOffset(0);
if ((isAligned<MemoryConstants::cacheLineSize>(bufferStateAddress) && isAligned<MemoryConstants::cacheLineSize>(bufferStateSize)) ||
isReadOnly) {
state.setMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
state.setMemoryObjectControlState(gmmHelper->getL3EnabledMOCS());
} else {
state.setMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
state.setMemoryObjectControlState(gmmHelper->getUncachedMOCS());
}
if (debugManager.flags.OverrideMocsIndexForScratchSpace.get() != -1) {
auto mocsIndex = static_cast<uint32_t>(debugManager.flags.OverrideMocsIndexForScratchSpace.get()) << 1;

View File

@ -83,17 +83,16 @@ EngineGroupType GfxCoreHelperHw<GfxFamily>::getEngineGroupType(aub_stream::Engin
template <typename GfxFamily>
uint32_t GfxCoreHelperHw<GfxFamily>::getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const {
if (l3enabled) {
if (debugManager.flags.ForceL1Caching.get() == 0) {
if (l1enabled) {
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
}
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
} else {
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
if (debugManager.flags.ForceL1Caching.get() != 1) {
l1enabled = static_cast<bool>(debugManager.flags.ForceL1Caching.get());
}
if (l1enabled) {
return gmmHelper.getL1EnabledMOCS() >> 1;
}
return gmmHelper.getL3EnabledMOCS() >> 1;
}
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
return gmmHelper.getUncachedMOCS() >> 1;
}
template <typename GfxFamily>

View File

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

View File

@ -125,7 +125,7 @@ void BlitCommandsHelper<Family>::appendBlitCommandsBlockCopy(const BlitPropertie
blitCmd.setSourceSurfaceType(XY_BLOCK_COPY_BLT::SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_1D);
}
auto mocs = rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocs = rootDeviceEnvironment.getGmmHelper()->getL3EnabledMOCS();
if (debugManager.flags.OverrideBlitterMocs.get() != -1) {
mocs = static_cast<uint32_t>(debugManager.flags.OverrideBlitterMocs.get());
}
@ -204,7 +204,7 @@ void BlitCommandsHelper<Family>::appendBlitCommandsMemCopy(const BlitProperties
blitCmd.setCopyType(MEM_COPY::COPY_TYPE::COPY_TYPE_LINEAR_COPY);
}
auto mocs = rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocs = rootDeviceEnvironment.getGmmHelper()->getL3EnabledMOCS();
if (debugManager.flags.OverrideBlitterMocs.get() != -1) {
mocs = static_cast<uint32_t>(debugManager.flags.OverrideBlitterMocs.get());
}

View File

@ -79,9 +79,9 @@ uint32_t GfxCoreHelperHw<Family>::getMinimalSIMDSize() const {
template <>
uint32_t GfxCoreHelperHw<Family>::getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const {
if (l3enabled) {
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
return gmmHelper.getL3EnabledMOCS() >> 1;
}
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
return gmmHelper.getUncachedMOCS() >> 1;
}
template <>

View File

@ -124,7 +124,7 @@ void BlitCommandsHelper<Family>::appendBlitCommandsBlockCopy(const BlitPropertie
blitCmd.setSourceSurfaceType(XY_BLOCK_COPY_BLT::SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_1D);
}
auto mocs = rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocs = rootDeviceEnvironment.getGmmHelper()->getL3EnabledMOCS();
if (debugManager.flags.OverrideBlitterMocs.get() != -1) {
mocs = static_cast<uint32_t>(debugManager.flags.OverrideBlitterMocs.get());
}
@ -158,7 +158,7 @@ void BlitCommandsHelper<Family>::appendBlitCommandsMemCopy(const BlitProperties
blitCmd.setCopyType(MEM_COPY::COPY_TYPE::COPY_TYPE_LINEAR_COPY);
}
auto mocs = rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto mocs = rootDeviceEnvironment.getGmmHelper()->getL3EnabledMOCS();
if (debugManager.flags.OverrideBlitterMocs.get() != -1) {
mocs = static_cast<uint32_t>(debugManager.flags.OverrideBlitterMocs.get());
}

View File

@ -84,9 +84,9 @@ uint32_t GfxCoreHelperHw<Family>::getMinimalSIMDSize() const {
template <>
uint32_t GfxCoreHelperHw<Family>::getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const {
if (l3enabled) {
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
return gmmHelper.getL3EnabledMOCS() >> 1;
}
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
return gmmHelper.getUncachedMOCS() >> 1;
}
template <>

View File

@ -127,9 +127,9 @@ uint32_t GfxCoreHelperHw<Family>::getMinimalSIMDSize() const {
template <>
uint32_t GfxCoreHelperHw<Family>::getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const {
if (l3enabled) {
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
return gmmHelper.getL3EnabledMOCS() >> 1;
}
return gmmHelper.getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
return gmmHelper.getUncachedMOCS() >> 1;
}
template <>

View File

@ -129,7 +129,7 @@ void BlitCommandsHelper<Family>::appendBlitCommandsBlockCopy(const BlitPropertie
DEBUG_BREAK_IF((AuxTranslationDirection::none != blitProperties.auxTranslationDirection) &&
(blitProperties.dstAllocation != blitProperties.srcAllocation || !blitProperties.dstAllocation->isCompressionEnabled()));
auto mocs = rootDeviceEnvironment.getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto mocs = rootDeviceEnvironment.getGmmHelper()->getUncachedMOCS();
if (debugManager.flags.OverrideBlitterMocs.get() != -1) {
mocs = static_cast<uint32_t>(debugManager.flags.OverrideBlitterMocs.get());

View File

@ -719,7 +719,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncoderTests, givenAtLeastXeHpPlatformWhenSe
EXPECT_NO_THROW(walkerCmd.getPostSync().setMocs(mocs));
auto gmmHelper = rootDeviceEnvironment.getGmmHelper();
auto expectedMocs = dcFlush ? gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) : gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
auto expectedMocs = dcFlush ? gmmHelper->getUncachedMOCS() : gmmHelper->getL3EnabledMOCS();
EXPECT_EQ(expectedMocs, walkerCmd.getPostSync().getMocs());
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -35,7 +35,7 @@ HWTEST2_F(CommandEncoderXeHpgCorePlusTests, givenSpecifiedL1CacheControlWhenAppe
args.outMemory = &rssCmd;
args.graphicsAddress = allocation->getGpuAddress();
args.size = allocation->getUnderlyingBufferSize();
args.mocs = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER);
args.mocs = pDevice->getGmmHelper()->getL3EnabledMOCS();
args.numAvailableDevices = pDevice->getNumGenericSubDevices();
args.allocation = allocation;
args.gmmHelper = pDevice->getGmmHelper();

View File

@ -1614,7 +1614,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenDebugFlagSetWhenDispatching
EXPECT_EQ(1u, directSubmission.dispatchStaticRelaxedOrderingSchedulerCalled);
EXPECT_TRUE(verifyStaticSchedulerProgramming<FamilyType>(*directSubmission.relaxedOrderingSchedulerAllocation,
directSubmission.deferredTasksListAllocation->getGpuAddress(), directSubmission.semaphoreGpuVa, 123,
pDevice->getRootDeviceEnvironment().getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER)));
pDevice->getRootDeviceEnvironment().getGmmHelper()->getL3EnabledMOCS()));
}
HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenNewNumberOfClientsWhenDispatchingWorkThenIncraseQueueSize, IsAtLeastXeHpcCore) {
@ -1628,7 +1628,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, givenNewNumberOfClientsWhenDispa
EXPECT_EQ(RelaxedOrderingHelper::queueSizeMultiplier, directSubmission.currentRelaxedOrderingQueueSize);
EXPECT_TRUE(verifyStaticSchedulerProgramming<FamilyType>(*directSubmission.relaxedOrderingSchedulerAllocation,
directSubmission.deferredTasksListAllocation->getGpuAddress(), directSubmission.semaphoreGpuVa, RelaxedOrderingHelper::queueSizeMultiplier,
pDevice->getRootDeviceEnvironment().getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER)));
pDevice->getRootDeviceEnvironment().getGmmHelper()->getL3EnabledMOCS()));
const uint64_t expectedQueueSizeValueVa = directSubmission.relaxedOrderingSchedulerAllocation->getGpuAddress() +
RelaxedOrderingHelper::StaticSchedulerSizeAndOffsetSection<FamilyType>::drainRequestSectionStart +
@ -1708,7 +1708,7 @@ HWTEST2_F(DirectSubmissionRelaxedOrderingTests, whenInitializingThenDispatchStat
EXPECT_EQ(1u, directSubmission.dispatchStaticRelaxedOrderingSchedulerCalled);
EXPECT_TRUE(verifyStaticSchedulerProgramming<FamilyType>(*directSubmission.relaxedOrderingSchedulerAllocation,
directSubmission.deferredTasksListAllocation->getGpuAddress(), directSubmission.semaphoreGpuVa, RelaxedOrderingHelper::queueSizeMultiplier,
pDevice->getRootDeviceEnvironment().getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER)));
pDevice->getRootDeviceEnvironment().getGmmHelper()->getL3EnabledMOCS()));
}
{
@ -1861,7 +1861,7 @@ HWTEST_F(DirectSubmissionRelaxedOrderingTests, whenDispatchingWorkThenDispatchTa
EXPECT_EQ(8u, miMathCmd->DW0.BitField.DwordLength);
if constexpr (FamilyType::isUsingMiMathMocs) {
EXPECT_EQ(miMathCmd->DW0.BitField.MemoryObjectControlState, pDevice->getRootDeviceEnvironment().getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
EXPECT_EQ(miMathCmd->DW0.BitField.MemoryObjectControlState, pDevice->getRootDeviceEnvironment().getGmmHelper()->getL3EnabledMOCS());
}
auto miAluCmd = reinterpret_cast<MI_MATH_ALU_INST_INLINE *>(++miMathCmd);

View File

@ -116,7 +116,7 @@ HWTEST_F(CommandEncodeStatesUncachedMocsTests, whenEncodingDispatchKernelWithUnc
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
auto gmmHelper = cmdContainer->getDevice()->getGmmHelper();
EXPECT_EQ(cmdSba->getStatelessDataPortAccessMemoryObjectControlState(),
(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED)));
(gmmHelper->getUncachedMOCS()));
}
HWTEST_F(CommandEncodeStatesUncachedMocsTests, whenEncodingDispatchKernelWithUncachedMocsAndNonDirtyHeapsThenCorrectMocsIsSet) {
@ -144,7 +144,7 @@ HWTEST_F(CommandEncodeStatesUncachedMocsTests, whenEncodingDispatchKernelWithUnc
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
auto gmmHelper = cmdContainer->getDevice()->getGmmHelper();
EXPECT_EQ(cmdSba->getStatelessDataPortAccessMemoryObjectControlState(),
(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED)));
(gmmHelper->getUncachedMOCS()));
}
HWTEST_F(CommandEncodeStatesUncachedMocsTests, whenEncodingDispatchKernelWithNonUncachedMocsAndDirtyHeapsThenSbaIsNotProgrammed) {
@ -173,7 +173,7 @@ HWTEST_F(CommandEncodeStatesUncachedMocsTests, whenEncodingDispatchKernelWithNon
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
auto gmmHelper = cmdContainer->getDevice()->getGmmHelper();
EXPECT_EQ(cmdSba->getStatelessDataPortAccessMemoryObjectControlState(),
(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER)));
(gmmHelper->getL3EnabledMOCS()));
}
HWTEST_F(CommandEncodeStatesUncachedMocsTests, whenEncodingDispatchKernelWithNonUncachedMocsAndNonDirtyHeapsThenSbaIsNotProgrammed) {
@ -673,7 +673,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncodeStatesTest, givenCleanHeapsAndSlmNot
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
auto gmmHelper = cmdContainer->getDevice()->getGmmHelper();
EXPECT_EQ(cmdSba->getStatelessDataPortAccessMemoryObjectControlState(),
(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED)));
(gmmHelper->getUncachedMOCS()));
}
HWCMDTEST_F(IGFX_GEN12LP_CORE, CommandEncodeStatesTest, givenDirtyHeapsAndSlmNotChangedWhenDispatchKernelThenHeapsAreCleanAndFlushAdded) {

View File

@ -98,7 +98,7 @@ HWTEST2_F(CommandEncodeStatesTestDg2AndLater, givenEventAddressWhenEncodeThenMoc
auto gmmHelper = pDevice->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), cmd->getPostSync().getMocs());
EXPECT_EQ(gmmHelper->getUncachedMOCS(), cmd->getPostSync().getMocs());
}
HWTEST2_F(CommandEncodeStatesTestDg2AndLater, GivenVariousSlmTotalSizesWhenSetPreferredSlmIsCalledThenCorrectValuesAreSet, IsXeHpgCore) {

View File

@ -432,9 +432,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesTest, givenEventAddressWhenEncod
ASSERT_NE(itor, commands.end());
auto cmd = genCmdCast<DefaultWalkerType *>(*itor);
if (MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, pDevice->getRootDeviceEnvironment())) {
EXPECT_EQ(pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), cmd->getPostSync().getMocs());
EXPECT_EQ(pDevice->getGmmHelper()->getUncachedMOCS(), cmd->getPostSync().getMocs());
} else {
EXPECT_EQ(pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), cmd->getPostSync().getMocs());
EXPECT_EQ(pDevice->getGmmHelper()->getL3EnabledMOCS(), cmd->getPostSync().getMocs());
}
}

View File

@ -374,7 +374,7 @@ HWTEST2_F(CommandEncodeStatesTest, givenCommandContainerWithDirtyHeapsWhenSetSta
cmdContainer->setHeapDirty(NEO::HeapType::surfaceState);
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
uint32_t statelessMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
STATE_BASE_ADDRESS sba;
@ -415,7 +415,7 @@ HWTEST_F(CommandEncodeStatesTest, givenCommandContainerWhenSetStateBaseAddressCa
STATE_BASE_ADDRESS sba;
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
uint32_t statelessMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(cmdContainer.get(), sba, statelessMocsIndex);
@ -470,7 +470,7 @@ HWTEST2_F(CommandEncodeStatesTest, givenHeapSharingEnabledWhenRetrievingNotIniti
cmdContainer->setHeapDirty(NEO::HeapType::surfaceState);
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
uint32_t statelessMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
STATE_BASE_ADDRESS sba;
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(cmdContainer.get(), sba, statelessMocsIndex);
@ -503,7 +503,7 @@ HWTEST2_F(CommandEncodeStatesTest, givenSbaPropertiesWhenBindingBaseAddressSetTh
cmdContainer->setHeapDirty(NEO::HeapType::surfaceState);
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
uint32_t statelessMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
StateBaseAddressProperties sbaProperties;
sbaProperties.initSupport(pDevice->getRootDeviceEnvironment());

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -26,7 +26,7 @@ HWTEST2_F(CommandEncodeStatesDG2Test, givenCommandContainerWhenSetStateBaseAddre
STATE_BASE_ADDRESS sba;
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
uint32_t statelessMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(cmdContainer.get(), sba, statelessMocsIndex);
@ -51,7 +51,7 @@ HWTEST2_F(CommandEncodeStatesDG2Test, givenCommandContainerAndDebuggerWhenSetSta
cmdContainer->getDevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger);
STATE_BASE_ADDRESS sba;
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
uint32_t statelessMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(cmdContainer.get(), sba, statelessMocsIndex);
EncodeStateBaseAddress<FamilyType>::encode(args);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2024 Intel Corporation
* Copyright (C) 2020-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -88,7 +88,7 @@ GEN12LPTEST_F(CommandEncodeStatesTest, givenVariousEngineTypesWhenEncodeSbaThenA
ASSERT_EQ(CommandContainer::ErrorCode::success, ret);
auto gmmHelper = cmdContainer.getDevice()->getRootDeviceEnvironment().getGmmHelper();
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
uint32_t statelessMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
{
STATE_BASE_ADDRESS sba;

View File

@ -1228,12 +1228,12 @@ TEST(GmmHelperTest, givenNewCoherencyModelWhenGetMocsThenDeferToPat) {
GTEST_SKIP();
}
EXPECT_EQ(0u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
EXPECT_EQ(0u, gmmHelper->getUncachedMOCS());
EXPECT_EQ(0u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER));
EXPECT_EQ(0u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
EXPECT_EQ(0u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER));
EXPECT_EQ(0u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
EXPECT_EQ(0u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
EXPECT_EQ(0u, gmmHelper->getL1EnabledMOCS());
EXPECT_EQ(0u, gmmHelper->getL3EnabledMOCS());
EXPECT_EQ(0u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC));
GmmHelper::createGmmContextWrapperFunc = createGmmContextSave;
@ -1249,24 +1249,24 @@ TEST(GmmHelperTest, givenGmmHelperAndL3CacheDisabledForDebugThenCorrectMOCSIsRet
}
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
auto uncachedMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto uncachedMocs = gmmHelper->getUncachedMOCS();
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
EXPECT_EQ(uncachedMocs, gmmHelper->getUncachedMOCS());
EXPECT_EQ(2u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER));
EXPECT_EQ(4u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
EXPECT_EQ(4u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER));
EXPECT_EQ(8u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
EXPECT_EQ(16u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
EXPECT_EQ(8u, gmmHelper->getL1EnabledMOCS());
EXPECT_EQ(16u, gmmHelper->getL3EnabledMOCS());
EXPECT_EQ(32u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC));
gmmHelper->forceAllResourcesUncached();
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
EXPECT_EQ(uncachedMocs, gmmHelper->getUncachedMOCS());
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER));
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER));
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
EXPECT_EQ(uncachedMocs, gmmHelper->getL1EnabledMOCS());
EXPECT_EQ(uncachedMocs, gmmHelper->getL3EnabledMOCS());
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC));
GmmHelper::createGmmContextWrapperFunc = createGmmContextSave;
}
@ -1281,25 +1281,26 @@ TEST(GmmHelperTest, givenGmmHelperAndForceAllResourcesUncachedDebugVariableSetTh
}
auto gmmHelper = executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper();
auto uncachedMocs = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED);
auto uncachedMocs = gmmHelper->getUncachedMOCS();
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
EXPECT_EQ(uncachedMocs, gmmHelper->getUncachedMOCS());
EXPECT_EQ(2u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER));
EXPECT_EQ(4u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
EXPECT_EQ(4u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER));
EXPECT_EQ(8u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
EXPECT_EQ(16u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
EXPECT_EQ(8u, gmmHelper->getL1EnabledMOCS());
EXPECT_EQ(16u, gmmHelper->getL3EnabledMOCS());
EXPECT_EQ(32u, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC));
DebugManagerStateRestore restore;
debugManager.flags.ForceAllResourcesUncached.set(true);
gmmHelper->initMocsDefaults();
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED));
EXPECT_EQ(uncachedMocs, gmmHelper->getUncachedMOCS());
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER));
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE_FROM_BUFFER));
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST));
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER));
EXPECT_EQ(uncachedMocs, gmmHelper->getL1EnabledMOCS());
EXPECT_EQ(uncachedMocs, gmmHelper->getL3EnabledMOCS());
EXPECT_EQ(uncachedMocs, gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_INLINE_CONST_HDC));
GmmHelper::createGmmContextWrapperFunc = createGmmContextSave;
}

View File

@ -539,14 +539,14 @@ HWTEST_F(GfxCoreHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvid
addr += offset;
EXPECT_EQ(addr, state->getSurfaceBaseAddress());
EXPECT_EQ(type, state->getSurfaceType());
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), state->getMemoryObjectControlState());
EXPECT_EQ(gmmHelper->getL3EnabledMOCS(), state->getMemoryObjectControlState());
memset(stateBuffer, 0, sizeof(RENDER_SURFACE_STATE));
size = 0x1003;
length.length = static_cast<uint32_t>(alignUp(size, 4) - 1);
bool isReadOnly = false;
gfxCoreHelper.setRenderSurfaceStateForScratchResource(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, nullptr, isReadOnly, type, true, false);
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), state->getMemoryObjectControlState());
EXPECT_EQ(gmmHelper->getUncachedMOCS(), state->getMemoryObjectControlState());
EXPECT_EQ(length.surfaceState.depth + 1u, state->getDepth());
EXPECT_EQ(length.surfaceState.width + 1u, state->getWidth());
EXPECT_EQ(length.surfaceState.height + 1u, state->getHeight());
@ -556,7 +556,7 @@ HWTEST_F(GfxCoreHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvid
addr = 0x2001;
length.length = static_cast<uint32_t>(size - 1);
gfxCoreHelper.setRenderSurfaceStateForScratchResource(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, nullptr, isReadOnly, type, true, false);
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), state->getMemoryObjectControlState());
EXPECT_EQ(gmmHelper->getUncachedMOCS(), state->getMemoryObjectControlState());
EXPECT_EQ(length.surfaceState.depth + 1u, state->getDepth());
EXPECT_EQ(length.surfaceState.width + 1u, state->getWidth());
EXPECT_EQ(length.surfaceState.height + 1u, state->getHeight());
@ -567,7 +567,7 @@ HWTEST_F(GfxCoreHelperTest, givenCreatedSurfaceStateBufferWhenNoAllocationProvid
length.length = static_cast<uint32_t>(alignUp(size, 4) - 1);
isReadOnly = true;
gfxCoreHelper.setRenderSurfaceStateForScratchResource(rootDeviceEnvironment, stateBuffer, size, addr, 0, pitch, nullptr, isReadOnly, type, true, false);
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER), state->getMemoryObjectControlState());
EXPECT_EQ(gmmHelper->getL3EnabledMOCS(), state->getMemoryObjectControlState());
EXPECT_EQ(length.surfaceState.depth + 1u, state->getDepth());
EXPECT_EQ(length.surfaceState.width + 1u, state->getWidth());
EXPECT_EQ(length.surfaceState.height + 1u, state->getHeight());
@ -940,9 +940,9 @@ TEST_F(GfxCoreHelperTest, givenAUBDumpForceAllToLocalMemoryDebugVarWhenSetThenGe
HWCMDTEST_F(IGFX_GEN12LP_CORE, GfxCoreHelperTest, givenVariousCachesRequestThenCorrectMocsIndexesAreReturned) {
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto gmmHelper = this->pDevice->getGmmHelper();
auto expectedMocsForL3off = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
auto expectedMocsForL3on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
auto expectedMocsForL3andL1on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CONST) >> 1;
auto expectedMocsForL3off = gmmHelper->getUncachedMOCS() >> 1;
auto expectedMocsForL3on = gmmHelper->getL3EnabledMOCS() >> 1;
auto expectedMocsForL3andL1on = gmmHelper->getL1EnabledMOCS() >> 1;
auto mocsIndex = gfxCoreHelper.getMocsIndex(*gmmHelper, false, true);
EXPECT_EQ(expectedMocsForL3off, mocsIndex);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2021-2024 Intel Corporation
* Copyright (C) 2021-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -25,8 +25,8 @@ HWTEST2_F(GfxCoreHelperTestPvcAndLater, givenVariousCachesRequestsThenProperMocs
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto gmmHelper = this->pDevice->getRootDeviceEnvironment().getGmmHelper();
auto expectedMocsForL3off = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED) >> 1;
auto expectedMocsForL3on = gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1;
auto expectedMocsForL3off = gmmHelper->getUncachedMOCS() >> 1;
auto expectedMocsForL3on = gmmHelper->getL3EnabledMOCS() >> 1;
auto mocsIndex = gfxCoreHelper.getMocsIndex(*gmmHelper, false, true);
EXPECT_EQ(expectedMocsForL3off, mocsIndex);

View File

@ -120,7 +120,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionWhenAppendBlitCommandsForVillB
HWTEST2_F(BlitTests, givenOverridedMocksValueWhenAppendBlitCommandsForVillBufferThenDebugMocksValueIsSet, IsPVC) {
using MEM_SET = typename FamilyType::MEM_SET;
DebugManagerStateRestore dbgRestore;
uint32_t mockValue = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) + 1;
uint32_t mockValue = pDevice->getGmmHelper()->getL3EnabledMOCS() + 1;
debugManager.flags.OverrideBlitterMocs.set(mockValue);
uint32_t pattern = 1;

View File

@ -121,7 +121,7 @@ HWTEST2_F(BlitTests, givenGmmWithEnabledCompresionAndDebugFlagSetWhenAppendBlitC
HWTEST2_F(BlitTests, givenOverridedMocksValueWhenAppendBlitCommandsForFillBufferThenDebugMocksValueIsSet, BlitPlatforms) {
DebugManagerStateRestore dbgRestore;
uint32_t mockValue = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) + 1;
uint32_t mockValue = pDevice->getGmmHelper()->getL3EnabledMOCS() + 1;
debugManager.flags.OverrideBlitterMocs.set(mockValue);

View File

@ -39,7 +39,7 @@ HWTEST2_F(BlitTests, givenOneBytePatternWhenFillPatternWithBlitThenCommandIsProg
HWTEST2_F(BlitTests, givenOverridedMocksValueWhenAppendBlitCommandsForVillBufferThenDebugMocksValueIsSet, IsXe2HpgCore) {
using MEM_SET = typename FamilyType::MEM_SET;
DebugManagerStateRestore dbgRestore;
uint32_t mockValue = pDevice->getGmmHelper()->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) + 1;
uint32_t mockValue = pDevice->getGmmHelper()->getL3EnabledMOCS() + 1;
debugManager.flags.OverrideBlitterMocs.set(mockValue);
uint32_t pattern = 1;

View File

@ -464,7 +464,7 @@ XE2_HPG_CORETEST_F(EncodeKernelXe2HpgCoreTest, givenCleanHeapsAndSlmNotChangedAn
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
auto gmmHelper = cmdContainer->getDevice()->getGmmHelper();
EXPECT_EQ(cmdSba->getStatelessDataPortAccessMemoryObjectControlState(),
(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED)));
(gmmHelper->getUncachedMOCS()));
}
XE2_HPG_CORETEST_F(EncodeKernelXe2HpgCoreTest, givenDebugFlagSetWhenAdjustIsCalledThenUpdateRequiredScratchSizeField) {

View File

@ -174,7 +174,7 @@ XE3_CORETEST_F(CommandEncodeStatesXe3Test, givenHeapSharingEnabledWhenRetrieving
cmdContainer->setHeapDirty(NEO::HeapType::surfaceState);
auto gmmHelper = cmdContainer->getDevice()->getRootDeviceEnvironment().getGmmHelper();
uint32_t statelessMocsIndex = (gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER) >> 1);
uint32_t statelessMocsIndex = (gmmHelper->getL3EnabledMOCS() >> 1);
STATE_BASE_ADDRESS sba;
EncodeStateBaseAddressArgs<FamilyType> args = createDefaultEncodeStateBaseAddressArgs<FamilyType>(cmdContainer.get(), sba, statelessMocsIndex);

View File

@ -484,7 +484,7 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenCleanHeapsAndSlmNotChangedAndU
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
auto gmmHelper = cmdContainer->getDevice()->getGmmHelper();
EXPECT_EQ(cmdSba->getStatelessDataPortAccessMemoryObjectControlState(),
(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED)));
(gmmHelper->getUncachedMOCS()));
}
using XeHpcSbaTest = SbaTest;