fix: adjust scope of disable L3 for debug WA

Related-To: HSD-1609398399
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-05-29 15:18:31 +00:00
committed by Compute-Runtime-Automation
parent d247fb5aa1
commit 61055478d4
19 changed files with 68 additions and 126 deletions

View File

@@ -578,7 +578,7 @@ HWTEST2_F(L0DebuggerTest, givenNotXeHpOrXeHpgCoreAndDebugIsActiveThenDisableL3Ca
EXPECT_FALSE(static_cast<MockGmmHelper *>(neoDevice->getGmmHelper())->allResourcesUncached);
}
HWTEST2_F(L0DebuggerTest, givenXeHpOrXeHpgCoreAndDebugIsActiveThenDisableL3CacheInGmmHelperIsSet, IsXeHpOrXeHpgCore) {
HWTEST2_F(L0DebuggerTest, givenDebugIsActiveThenDisableL3CacheInGmmHelperIsSet, IsDG2) {
EXPECT_TRUE(static_cast<MockGmmHelper *>(neoDevice->getGmmHelper())->allResourcesUncached);
}

View File

@@ -418,67 +418,56 @@ TEST(MemObjHelper, givenDifferentValuesWhenCheckingBufferCompressionSupportThenC
cl_mem_flags_intel flagsIntelValues[] = {0, CL_MEM_COMPRESSED_HINT_INTEL, CL_MEM_UNCOMPRESSED_HINT_INTEL};
uint32_t contextTypes[] = {ContextType::CONTEXT_TYPE_DEFAULT, ContextType::CONTEXT_TYPE_SPECIALIZED,
ContextType::CONTEXT_TYPE_UNRESTRICTIVE};
__REVID steppingValues[] = {REVISION_A0, REVISION_B};
MockExecutionEnvironment mockExecutionEnvironemnt{};
const auto &productHelper = mockExecutionEnvironemnt.rootDeviceEnvironments[0]->getProductHelper();
for (auto numSubDevices : numsSubDevices) {
UltClDeviceFactory clDeviceFactory{1, numSubDevices};
for (auto stepping : steppingValues) {
hardwareStepping = productHelper.getHwRevIdFromStepping(stepping, *defaultHwInfo);
if (hardwareStepping == CommonConstants::invalidStepping) {
continue;
}
for (auto contextType : contextTypes) {
if ((numSubDevices == 0) && (contextType != ContextType::CONTEXT_TYPE_DEFAULT)) {
continue;
}
for (auto numSubDevices : numsSubDevices) {
UltClDeviceFactory clDeviceFactory{1, numSubDevices};
ClDeviceVector contextDevices;
if (contextType != ContextType::CONTEXT_TYPE_SPECIALIZED) {
contextDevices.push_back(clDeviceFactory.rootDevices[0]);
}
if (contextType != ContextType::CONTEXT_TYPE_DEFAULT) {
contextDevices.push_back(clDeviceFactory.subDevices[0]);
contextDevices.push_back(clDeviceFactory.subDevices[1]);
}
MockContext context{contextDevices};
for (auto contextType : contextTypes) {
if ((numSubDevices == 0) && (contextType != ContextType::CONTEXT_TYPE_DEFAULT)) {
continue;
}
for (auto flags : flagsValues) {
for (auto flagsIntel : flagsIntelValues) {
ClDeviceVector contextDevices;
if (contextType != ContextType::CONTEXT_TYPE_SPECIALIZED) {
contextDevices.push_back(clDeviceFactory.rootDevices[0]);
}
if (contextType != ContextType::CONTEXT_TYPE_DEFAULT) {
contextDevices.push_back(clDeviceFactory.subDevices[0]);
contextDevices.push_back(clDeviceFactory.subDevices[1]);
}
MockContext context{contextDevices};
auto &device = context.getDevice(0)->getDevice();
auto &clGfxCoreHelper = device.getRootDeviceEnvironment().getHelper<ClGfxCoreHelper>();
for (auto flags : flagsValues) {
for (auto flagsIntel : flagsIntelValues) {
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel,
0, &device);
auto &device = context.getDevice(0)->getDevice();
auto &clGfxCoreHelper = device.getRootDeviceEnvironment().getHelper<ClGfxCoreHelper>();
bool compressionEnabled = MemObjHelper::isSuitableForCompression(GfxCoreHelper::compressedBuffersSupported(*defaultHwInfo), memoryProperties, context, true);
MockPublicAccessBuffer::getGraphicsAllocationTypeAndCompressionPreference(
memoryProperties, context, compressionEnabled, false);
MemoryProperties memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(flags, flagsIntel,
0, &device);
bool isCompressionDisabled = isValueSet(flags, CL_MEM_UNCOMPRESSED_HINT_INTEL) ||
isValueSet(flagsIntel, CL_MEM_UNCOMPRESSED_HINT_INTEL);
bool expectBufferCompressed = !isCompressionDisabled;
bool compressionEnabled = MemObjHelper::isSuitableForCompression(GfxCoreHelper::compressedBuffersSupported(*defaultHwInfo), memoryProperties, context, true);
MockPublicAccessBuffer::getGraphicsAllocationTypeAndCompressionPreference(
memoryProperties, context, compressionEnabled, false);
bool isMultiTile = (numSubDevices > 1);
if (expectBufferCompressed && isMultiTile) {
bool isBufferReadOnly = isValueSet(flags, CL_MEM_READ_ONLY | CL_MEM_HOST_NO_ACCESS);
expectBufferCompressed = clGfxCoreHelper.allowCompressionForContext(*context.getDevice(0), context) &&
((contextType == ContextType::CONTEXT_TYPE_SPECIALIZED) || isBufferReadOnly);
}
bool isCompressionDisabled = isValueSet(flags, CL_MEM_UNCOMPRESSED_HINT_INTEL) ||
isValueSet(flagsIntel, CL_MEM_UNCOMPRESSED_HINT_INTEL);
bool expectBufferCompressed = !isCompressionDisabled;
bool isMultiTile = (numSubDevices > 1);
if (expectBufferCompressed && isMultiTile) {
bool isBufferReadOnly = isValueSet(flags, CL_MEM_READ_ONLY | CL_MEM_HOST_NO_ACCESS);
expectBufferCompressed = clGfxCoreHelper.allowCompressionForContext(*context.getDevice(0), context) &&
((contextType == ContextType::CONTEXT_TYPE_SPECIALIZED) || isBufferReadOnly);
}
if (expectBufferCompressed) {
EXPECT_TRUE(compressionEnabled);
} else {
EXPECT_FALSE(compressionEnabled);
}
if (expectBufferCompressed) {
EXPECT_TRUE(compressionEnabled);
} else {
EXPECT_FALSE(compressionEnabled);
}
}
}
}
}
}
}

View File

@@ -886,7 +886,7 @@ HWTEST2_F(LegacyDebuggerTest, givenNotXeHpOrXeHpgCoreAndDebugIsActiveThenDisable
EXPECT_FALSE(static_cast<MockGmmHelper *>(platform.getClDevice(0)->getDevice().getGmmHelper())->allResourcesUncached);
}
HWTEST2_F(LegacyDebuggerTest, givenXeHpOrXeHpgCoreAndDebugIsActiveThenDisableL3CacheInGmmHelperIsSet, IsXeHpOrXeHpgCore) {
HWTEST2_F(LegacyDebuggerTest, givenDebugIsActiveThenDisableL3CacheInGmmHelperIsSet, IsDG2) {
DebugManagerStateRestore stateRestore;
DebugManager.flags.EnableMockSourceLevelDebugger.set(1);

View File

@@ -16,13 +16,13 @@
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/common/utilities/base_object_utils.h"
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
using namespace NEO;
struct BlitXeHpgCoreTests : public ::testing::Test {
@@ -290,7 +290,7 @@ XE_HPG_CORETEST_F(BlitXeHpgCoreTests, givenBufferWhenProgrammingBltCommandThenSe
}
}
XE_HPG_CORETEST_F(BlitXeHpgCoreTests, givenBufferWhenProgrammingBltCommandAndRevisionB0ThenSetTargetMemory) {
HWTEST2_F(BlitXeHpgCoreTests, givenBufferWhenProgrammingBltCommandAndRevisionB0ThenSetTargetMemory, IsDG2) {
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
HardwareInfo *hwInfo = clDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
const auto &productHelper = clDevice->getProductHelper();

View File

@@ -13,7 +13,6 @@
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/memory_manager/memory_operations_handler.h"
@@ -80,7 +79,6 @@ void DebuggerL0::initialize() {
auto &hwInfo = device->getHardwareInfo();
auto &rootDeviceEnvironment = device->getRootDeviceEnvironment();
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
NEO::AllocationProperties properties{device->getRootDeviceIndex(), true, MemoryConstants::pageSize64k,
NEO::AllocationType::DEBUG_MODULE_AREA,
false,
@@ -104,7 +102,7 @@ void DebuggerL0::initialize() {
NEO::MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, *moduleDebugArea),
*device, moduleDebugArea, 0, &debugArea,
sizeof(DebugAreaHeader));
if (gfxCoreHelper.disableL3CacheForDebug(hwInfo, productHelper)) {
if (productHelper.disableL3CacheForDebug(hwInfo)) {
device->getGmmHelper()->forceAllResourcesUncached();
}

View File

@@ -222,9 +222,8 @@ bool Device::createDeviceImpl() {
this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->initDebugger();
}
auto &gfxCoreHelper = getGfxCoreHelper();
auto &productHelper = getProductHelper();
if (getDebugger() && gfxCoreHelper.disableL3CacheForDebug(hwInfo, productHelper)) {
if (getDebugger() && productHelper.disableL3CacheForDebug(hwInfo)) {
getGmmHelper()->forceAllResourcesUncached();
}
@@ -274,6 +273,7 @@ bool Device::createDeviceImpl() {
}
createBindlessHeapsHelper();
auto &gfxCoreHelper = getGfxCoreHelper();
if (!isEngineInstanced()) {
uuid.isValid = false;

View File

@@ -154,7 +154,6 @@ class GfxCoreHelper {
virtual uint64_t getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const = 0;
virtual bool isStatelessToStatefulWithOffsetSupported() const = 0;
virtual void encodeBufferSurfaceState(EncodeSurfaceStateArgs &args) const = 0;
virtual bool disableL3CacheForDebug(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const = 0;
virtual bool isRevisionSpecificBinaryBuiltinRequired() const = 0;
virtual bool forceNonGpuCoherencyWA(bool requiresCoherency) const = 0;
virtual bool platformSupportsImplicitScaling(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
@@ -368,7 +367,6 @@ class GfxCoreHelperHw : public GfxCoreHelper {
uint64_t getPatIndex(CacheRegion cacheRegion, CachePolicy cachePolicy) const override;
bool isStatelessToStatefulWithOffsetSupported() const override;
void encodeBufferSurfaceState(EncodeSurfaceStateArgs &args) const override;
bool disableL3CacheForDebug(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const override;
bool isRevisionSpecificBinaryBuiltinRequired() const override;
bool forceNonGpuCoherencyWA(bool requiresCoherency) const override;
bool platformSupportsImplicitScaling(const NEO::RootDeviceEnvironment &rootDeviceEnvironment) const override;

View File

@@ -603,11 +603,6 @@ template <typename GfxFamily>
void GfxCoreHelperHw<GfxFamily>::encodeBufferSurfaceState(EncodeSurfaceStateArgs &args) const {
EncodeSurfaceState<GfxFamily>::encodeBuffer(args);
}
template <typename GfxFamily>
bool GfxCoreHelperHw<GfxFamily>::disableL3CacheForDebug(const HardwareInfo &, const ProductHelper &productHelper) const {
return false;
}
template <typename GfxFamily>
bool GfxCoreHelperHw<GfxFamily>::isRevisionSpecificBinaryBuiltinRequired() const {
return false;

View File

@@ -206,6 +206,7 @@ class ProductHelper {
virtual bool isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const = 0;
virtual uint32_t getNumberOfPartsInTileForConcurrentKernel() const = 0;
virtual bool is48bResourceNeededForRayTracing() const = 0;
virtual bool disableL3CacheForDebug(const HardwareInfo &hwInfo) const = 0;
virtual ~ProductHelper() = default;

View File

@@ -786,4 +786,9 @@ uint32_t ProductHelperHw<gfxProduct>::getMaxNumSamplers() const {
return 16u;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::disableL3CacheForDebug(const HardwareInfo &) const {
return false;
}
} // namespace NEO

View File

@@ -159,6 +159,7 @@ class ProductHelperHw : public ProductHelper {
bool isFusedEuDisabledForDpas(bool kernelHasDpasInstructions, const uint32_t *lws, const uint32_t *groupCount, const HardwareInfo &hwInfo) const override;
bool isCalculationForDisablingEuFusionWithDpasNeeded(const HardwareInfo &hwInfo) const override;
bool is48bResourceNeededForRayTracing() const override;
bool disableL3CacheForDebug(const HardwareInfo &hwInfo) const override;
~ProductHelperHw() override = default;

View File

@@ -254,4 +254,10 @@ template <>
bool ProductHelperHw<gfxProduct>::isDummyBlitWaRequired() const {
return false;
}
template <>
bool ProductHelperHw<gfxProduct>::disableL3CacheForDebug(const HardwareInfo &hwInfo) const {
return DG2::isG10(hwInfo) && GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo, *this);
}
} // namespace NEO

View File

@@ -124,11 +124,6 @@ uint32_t GfxCoreHelperHw<Family>::computeSlmValues(const HardwareInfo &hwInfo, u
return slmValue;
}
template <>
bool GfxCoreHelperHw<Family>::disableL3CacheForDebug(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const {
return GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo, productHelper);
}
template <>
bool GfxCoreHelperHw<Family>::copyThroughLockedPtrEnabled(const HardwareInfo &hwInfo, const ProductHelper &productHelper) const {
if (DebugManager.flags.ExperimentalCopyThroughLock.get() != -1) {

View File

@@ -33,23 +33,11 @@ bool ProductHelperHw<gfxProduct>::isPageTableManagerSupported(const HardwareInfo
template <>
uint32_t ProductHelperHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const {
switch (stepping) {
case REVISION_A0:
return 0x0;
case REVISION_B:
return 0x1;
}
return CommonConstants::invalidStepping;
}
template <>
uint32_t ProductHelperHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (hwInfo.platform.usRevId) {
case 0x0:
return REVISION_A0;
case 0x1:
return REVISION_B;
}
return CommonConstants::invalidStepping;
}
@@ -107,4 +95,5 @@ template <>
bool ProductHelperHw<gfxProduct>::isDummyBlitWaRequired() const {
return true;
}
} // namespace NEO

View File

@@ -1261,18 +1261,6 @@ HWTEST_F(GfxCoreHelperTest, whenBlitterSupportIsDisabledThenDontExposeAnyBcsEngi
}
}
HWTEST2_F(GfxCoreHelperTest, givenNotXeHpOrXeHpgCoreWhenDisableL3ForDebugCalledThenFalseIsReturned, IsNotXeHpOrXeHpgCore) {
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto &productHelper = getHelper<ProductHelper>();
EXPECT_FALSE(gfxCoreHelper.disableL3CacheForDebug(*defaultHwInfo, productHelper));
}
HWTEST2_F(GfxCoreHelperTest, givenXeHpOrXeHpgCoreWhenDisableL3ForDebugCalledThenTrueIsReturned, IsXeHpOrXeHpgCore) {
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto &productHelper = getHelper<ProductHelper>();
EXPECT_TRUE(gfxCoreHelper.disableL3CacheForDebug(*defaultHwInfo, productHelper));
}
HWTEST_F(GfxCoreHelperTest, givenGfxCoreHelperWhenGettingIfRevisionSpecificBinaryBuiltinIsRequiredThenFalseIsReturned) {
const auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
EXPECT_FALSE(gfxCoreHelper.isRevisionSpecificBinaryBuiltinRequired());

View File

@@ -756,3 +756,7 @@ HWTEST_F(ProductHelperTest, givenProductHelperWhenCheckingIsTranslationException
HWTEST_F(ProductHelperTest, whenQueryingMaxNumSamplersThenReturnSixteen) {
EXPECT_EQ(16u, productHelper->getMaxNumSamplers());
}
HWTEST_F(ProductHelperTest, whenDisableL3ForDebugCalledThenFalseIsReturned) {
EXPECT_FALSE(productHelper->disableL3CacheForDebug(*defaultHwInfo));
}

View File

@@ -36,3 +36,4 @@ HWTEST_EXCLUDE_PRODUCT(ProductHelperTestXeHpgCore, givenProductHelperWhenCheckDu
HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesTestDg2AndLater, GivenVariousSlmTotalSizesAndSettingRevIDToDifferentValuesWhenSetAdditionalInfoIsCalledThenCorrectValuesAreSet_IsXeHpgCore, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(ProductHelperCommonTest, givenHwHelperWhenIsFusedEuDisabledForDpasCalledThenFalseReturned, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(ProductHelperCommonTest, givenProductHelperWhenCallingIsCalculationForDisablingEuFusionWithDpasNeededThenFalseReturned, IGFX_DG2);
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, whenDisableL3ForDebugCalledThenFalseIsReturned, IGFX_DG2);

View File

@@ -632,14 +632,14 @@ DG2TEST_F(ProductHelperTestDg2, givenRevisionEnumAndDisableL3CacheForDebugCalled
};
auto hardwareInfo = *defaultHwInfo;
const auto &gfxCoreHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
hardwareInfo.platform.usDeviceID = dg2G10DeviceIds[0];
for (auto stepping : steppings) {
for (auto &stepping : steppings) {
hardwareInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(stepping, hardwareInfo);
if (stepping < REVISION_B) {
EXPECT_TRUE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, *productHelper));
EXPECT_TRUE(productHelper->disableL3CacheForDebug(hardwareInfo));
} else {
EXPECT_FALSE(gfxCoreHelper.disableL3CacheForDebug(hardwareInfo, *productHelper));
EXPECT_FALSE(productHelper->disableL3CacheForDebug(hardwareInfo));
}
}
}

View File

@@ -51,34 +51,6 @@ MTLTEST_F(GfxCoreHelperTestMtl, givenisCompressionEnabledAndWaAuxTable64KGranula
EXPECT_TRUE(gfxCoreHelper.is1MbAlignmentSupported(hardwareInfo, isCompressionEnabled));
}
MTLTEST_F(GfxCoreHelperTestMtl, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) {
uint32_t steppings[] = {
REVISION_A0,
REVISION_B,
CommonConstants::invalidStepping,
};
auto hardwareInfo = *defaultHwInfo;
const auto &productHelper = getHelper<ProductHelper>();
for (auto stepping : steppings) {
hardwareInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(stepping, hardwareInfo);
if (stepping == REVISION_A0) {
EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, productHelper));
} else {
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, productHelper));
}
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo, productHelper));
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, productHelper));
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, productHelper));
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo, productHelper));
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_D, REVISION_A0, hardwareInfo, productHelper));
}
}
MTLTEST_F(GfxCoreHelperTestMtl, givenMtlWhenSetForceNonCoherentThenNothingChanged) {
using FORCE_NON_COHERENT = typename FamilyType::STATE_COMPUTE_MODE::FORCE_NON_COHERENT;