Add missing cache policy isDebuggerActive values

Cache policy was not kept as WBP in some cases with debugger

Related-To: NEO-7003

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek 2022-09-02 16:54:57 +00:00 committed by Compute-Runtime-Automation
parent 417746182c
commit 7fa9cfd7fc
5 changed files with 42 additions and 1 deletions

View File

@ -282,6 +282,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelWithParams(K
args.useGlobalAtomics = kernelImp->getKernelDescriptor().kernelAttributes.flags.useGlobalAtomics;
args.areMultipleSubDevicesInContext = args.numAvailableDevices > 1;
args.implicitScaling = this->partitionCount > 1;
args.isDebuggerActive = true;
NEO::EncodeSurfaceState<GfxFamily>::encodeBuffer(args);
*reinterpret_cast<typename GfxFamily::RENDER_SURFACE_STATE *>(surfaceStateSpace) = surfaceState;

View File

@ -139,7 +139,7 @@ std::string ModuleTranslationUnit::generateCompilerOptions(const char *buildOpti
if (forceToStatelessRequired || statelessToStatefulOptimizationDisabled) {
internalOptions = NEO::CompilerOptions::concatenate(internalOptions, NEO::CompilerOptions::greaterThan4gbBuffersRequired);
}
isDebuggerActive |= neoDevice.getDebugger() != nullptr;
NEO::CompilerOptions::concatenateAppend(internalOptions, compilerHwInfoConfig.getCachingPolicyOptions(isDebuggerActive));
return internalOptions;
}

View File

@ -8,6 +8,7 @@
#include "shared/source/gen_common/reg_configs_common.h"
#include "shared/source/helpers/preamble.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
#include "shared/test/common/mocks/mock_gmm_helper.h"
#include "shared/test/common/test_macros/hw_test.h"
@ -530,6 +531,34 @@ HWTEST2_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionDisabledCommandLis
commandList->destroy();
}
HWTEST2_F(L0DebuggerTest, givenDebuggerEnabledAndL1CachePolicyWBWhenAppendingThenDebugSurfaceHasCachePolicyWBP, IsAtLeastXeHpgCore) {
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
MockHwInfoConfigHw<productFamily> hwInfoConfig;
VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
hwInfoConfigFactoryBackup = &hwInfoConfig;
hwInfoConfig.returnedL1CachePolicy = RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB;
hwInfoConfig.returnedL1CachePolicyIfDebugger = RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP;
Mock<::L0::Kernel> kernel;
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(L0::CommandList::create(productFamily, device, NEO::EngineGroupType::RenderCompute, 0u, returnValue));
ze_group_count_t groupCount{1, 1, 1};
CmdListKernelLaunchParams launchParams = {};
returnValue = commandList->appendLaunchKernel(kernel.toHandle(), &groupCount, nullptr, 0, nullptr, launchParams);
ASSERT_EQ(ZE_RESULT_SUCCESS, returnValue);
commandList->close();
auto *ssh = commandList->commandContainer.getIndirectHeap(NEO::HeapType::SURFACE_STATE);
ASSERT_NE(ssh, nullptr);
auto debugSurfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(ssh->getCpuBase());
ASSERT_NE(debugSurfaceState, nullptr);
auto debugSurface = static_cast<L0::DeviceImp *>(device)->getDebugSurface();
ASSERT_NE(debugSurface, nullptr);
ASSERT_EQ(debugSurface->getGpuAddress(), debugSurfaceState->getSurfaceBaseAddress());
EXPECT_EQ(debugSurfaceState->getL1CachePolicyL1CacheControl(), RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP);
}
HWTEST2_F(L0DebuggerTest, givenNotXeHpOrXeHpgCoreAndDebugIsActiveThenDisableL3CacheInGmmHelperIsNotSet, IsNotXeHpOrXeHpgCore) {
EXPECT_FALSE(static_cast<MockGmmHelper *>(neoDevice->getGmmHelper())->allResourcesUncached);
}

View File

@ -20,6 +20,7 @@ struct MockHwInfoConfigHw : NEO::HwInfoConfigHw<productFamily> {
int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) override;
uint64_t getDeviceMemoryPhysicalSizeInBytes(const OSInterface *osIface, uint32_t subDeviceIndex) override;
uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) override;
uint32_t getL1CachePolicy(bool isDebuggerActive) const override;
bool use128MbEdram = false;
bool enableMidThreadPreemption = false;
@ -28,6 +29,8 @@ struct MockHwInfoConfigHw : NEO::HwInfoConfigHw<productFamily> {
bool failOnConfigureHardwareCustom = false;
bool isCooperativeEngineSupportedValue = true;
uint32_t returnedStepping = 0;
uint32_t returnedL1CachePolicy = 0;
uint32_t returnedL1CachePolicyIfDebugger = 0;
std::vector<int32_t> threadArbPolicies = {};
};
} // namespace NEO

View File

@ -56,3 +56,11 @@ template <>
uint32_t MockHwInfoConfigHw<gfxProduct>::getDeviceMemoryMaxClkRate(const HardwareInfo &hwInfo, const OSInterface *osIface, uint32_t subDeviceIndex) {
return 800u;
}
template <>
uint32_t MockHwInfoConfigHw<gfxProduct>::getL1CachePolicy(bool isDebuggerActive) const {
if (isDebuggerActive) {
return this->returnedL1CachePolicyIfDebugger;
}
return this->returnedL1CachePolicy;
}