fix: update prefetch mocs settings

Related-To: NEO-14703

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2025-06-02 10:42:26 +00:00
committed by Compute-Runtime-Automation
parent 48b4a33645
commit 9647612f98
6 changed files with 34 additions and 12 deletions

View File

@@ -8,6 +8,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_container/encode_surface_state.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
@@ -59,11 +60,14 @@ XE2_HPG_CORETEST_F(CommandEncodeXe2HpgCoreTest, givenDebugVariableSetwhenProgram
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
constexpr uint64_t gpuVa = 0x100000;
constexpr uint32_t mocsIndexForL3 = (1 << 1);
constexpr size_t numCachelines = 3;
const GraphicsAllocation allocation(0, 1u /*num gmms*/, AllocationType::buffer, nullptr, gpuVa, 0, 4096, MemoryPool::localMemory, MemoryManager::maxOsContextCount);
auto rootDeviceEnv = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
auto usage = CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false, rootDeviceEnv->getProductHelper(), rootDeviceEnv->getHardwareInfo());
uint32_t mocs = rootDeviceEnv->getGmmHelper()->getMOCS(usage);
static constexpr std::array<uint32_t, 7> expectedSizes = {{
MemoryConstants::cacheLineSize - 1,
MemoryConstants::cacheLineSize,
@@ -92,7 +96,7 @@ XE2_HPG_CORETEST_F(CommandEncodeXe2HpgCoreTest, givenDebugVariableSetwhenProgram
EXPECT_EQ(statePrefetchCmd[i].getAddress(), gpuVa + (i * MemoryConstants::pageSize64k));
EXPECT_FALSE(statePrefetchCmd[i].getKernelInstructionPrefetch());
EXPECT_FALSE(statePrefetchCmd[i].getParserStall());
EXPECT_EQ(mocsIndexForL3, statePrefetchCmd[i].getMemoryObjectControlState());
EXPECT_EQ(mocs, statePrefetchCmd[i].getMemoryObjectControlState());
if (programmedSize > expectedSize) {
// cacheline alignemnt

View File

@@ -9,6 +9,8 @@
#include "shared/source/command_container/encode_surface_state.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/debugger/debugger_l0.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_walk_order.h"
@@ -80,11 +82,14 @@ XE3_CORETEST_F(CommandEncodeXe3CoreTest, givenDebugVariableSetwhenProgramingStat
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
constexpr uint64_t gpuVa = 0x100000;
constexpr uint32_t mocsIndexForL3 = (2 << 1);
constexpr size_t numCachelines = 3;
const GraphicsAllocation allocation(0, 1u /*num gmms*/, AllocationType::buffer, nullptr, gpuVa, 0, 4096, MemoryPool::localMemory, MemoryManager::maxOsContextCount);
auto rootDeviceEnv = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
auto usage = CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false, rootDeviceEnv->getProductHelper(), rootDeviceEnv->getHardwareInfo());
uint32_t mocs = rootDeviceEnv->getGmmHelper()->getMOCS(usage);
static constexpr std::array<uint32_t, 7> expectedSizes = {{
MemoryConstants::cacheLineSize - 1,
MemoryConstants::cacheLineSize,
@@ -113,7 +118,7 @@ XE3_CORETEST_F(CommandEncodeXe3CoreTest, givenDebugVariableSetwhenProgramingStat
EXPECT_EQ(statePrefetchCmd[i].getAddress(), gpuVa + (i * MemoryConstants::pageSize64k));
EXPECT_FALSE(statePrefetchCmd[i].getKernelInstructionPrefetch());
EXPECT_FALSE(statePrefetchCmd[i].getParserStall());
EXPECT_EQ(mocsIndexForL3, statePrefetchCmd[i].getMemoryObjectControlState());
EXPECT_EQ(mocs, statePrefetchCmd[i].getMemoryObjectControlState());
if (programmedSize > expectedSize) {
// cacheline alignemnt

View File

@@ -7,6 +7,7 @@
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/gmm_lib.h"
#include "shared/source/helpers/definitions/command_encoder_args.h"
@@ -86,11 +87,14 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugVariableSetwhenProgramin
auto statePrefetchCmd = reinterpret_cast<STATE_PREFETCH *>(buffer);
constexpr uint64_t gpuVa = 0x100000;
constexpr uint32_t mocsIndexForL3 = (2 << 1);
constexpr size_t numCachelines = 3;
const GraphicsAllocation allocation(0, 1u /*num gmms*/, AllocationType::buffer, nullptr, gpuVa, 0, 4096, MemoryPool::localMemory, MemoryManager::maxOsContextCount);
auto rootDeviceEnv = mockExecutionEnvironment.rootDeviceEnvironments[0].get();
auto usage = CacheSettingsHelper::getGmmUsageType(allocation.getAllocationType(), false, rootDeviceEnv->getProductHelper(), rootDeviceEnv->getHardwareInfo());
uint32_t mocs = rootDeviceEnv->getGmmHelper()->getMOCS(usage);
static constexpr std::array<uint32_t, 7> expectedSizes = {{
MemoryConstants::cacheLineSize - 1,
MemoryConstants::cacheLineSize,
@@ -119,7 +123,7 @@ XE_HPC_CORETEST_F(CommandEncodeXeHpcCoreTest, givenDebugVariableSetwhenProgramin
EXPECT_EQ(statePrefetchCmd[i].getAddress(), gpuVa + (i * MemoryConstants::pageSize64k));
EXPECT_FALSE(statePrefetchCmd[i].getKernelInstructionPrefetch());
EXPECT_FALSE(statePrefetchCmd[i].getParserStall());
EXPECT_EQ(mocsIndexForL3, statePrefetchCmd[i].getMemoryObjectControlState());
EXPECT_EQ(mocs, statePrefetchCmd[i].getMemoryObjectControlState());
if (programmedSize > expectedSize) {
// cacheline alignemnt