mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 05:24:02 +08:00
refactor: rename functions to check if buffer has stateful access
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5f874f45e2
commit
8b98e0d500
@@ -1640,8 +1640,8 @@ bool KernelImp::checkKernelContainsStatefulAccess() {
|
||||
auto moduleImp = static_cast<ModuleImp *>(this->module);
|
||||
auto isUserKernel = (moduleImp->getModuleType() == ModuleType::user);
|
||||
auto isGeneratedByIgc = moduleImp->getTranslationUnit()->isGeneratedByIgc;
|
||||
auto containsStatefulAccess = NEO::AddressingModeHelper::containsStatefulAccess(getKernelDescriptor(), false);
|
||||
return containsStatefulAccess && isUserKernel && isGeneratedByIgc;
|
||||
auto containsBufferStatefulAccess = NEO::AddressingModeHelper::containsBufferStatefulAccess(getKernelDescriptor(), false);
|
||||
return containsBufferStatefulAccess && isUserKernel && isGeneratedByIgc;
|
||||
}
|
||||
|
||||
uint8_t KernelImp::getRequiredSlmAlignment(uint32_t argIndex) const {
|
||||
|
||||
@@ -835,12 +835,12 @@ inline ze_result_t ModuleImp::initializeTranslationUnit(const ze_module_desc_t *
|
||||
|
||||
inline bool ModuleImp::shouldBuildBeFailed(NEO::Device *neoDevice) {
|
||||
auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment();
|
||||
auto containsStatefulAccess = NEO::AddressingModeHelper::containsStatefulAccess(translationUnit->programInfo.kernelInfos, false);
|
||||
auto containsBufferStatefulAccess = NEO::AddressingModeHelper::containsBufferStatefulAccess(translationUnit->programInfo.kernelInfos, false);
|
||||
auto isUserKernel = (type == ModuleType::user);
|
||||
auto isGeneratedByIgc = translationUnit->isGeneratedByIgc;
|
||||
return containsStatefulAccess &&
|
||||
return containsBufferStatefulAccess &&
|
||||
isUserKernel &&
|
||||
NEO::AddressingModeHelper::failBuildProgramWithStatefulAccess(rootDeviceEnvironment) &&
|
||||
NEO::AddressingModeHelper::failBuildProgramWithBufferStatefulAccess(rootDeviceEnvironment) &&
|
||||
isGeneratedByIgc;
|
||||
}
|
||||
|
||||
|
||||
@@ -4340,7 +4340,7 @@ TEST_F(ModuleTest, whenContainsStatefulAccessIsCalledThenResultIsCorrect) {
|
||||
moduleTranslationUnit->programInfo.kernelInfos.clear();
|
||||
moduleTranslationUnit->programInfo.kernelInfos.push_back(kernelInfo.release());
|
||||
|
||||
EXPECT_EQ(expectedResult, NEO::AddressingModeHelper::containsStatefulAccess(moduleTranslationUnit->programInfo.kernelInfos, false));
|
||||
EXPECT_EQ(expectedResult, NEO::AddressingModeHelper::containsBufferStatefulAccess(moduleTranslationUnit->programInfo.kernelInfos, false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4642,7 +4642,7 @@ TEST_F(ModuleInitializeTest, whenModuleInitializeIsCalledThenCorrectResultIsRetu
|
||||
module.setAddressingMode(isStateful);
|
||||
|
||||
if (isStateful && debugKey == -1 && isIgcGenerated == true) {
|
||||
if (compilerProductHelper.failBuildProgramWithStatefulAccessPreference() == true) {
|
||||
if (compilerProductHelper.failBuildProgramWithBufferStatefulAccessPreference() == true) {
|
||||
expectedResult = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ inline void HardwareInterface<GfxFamily>::dispatchWorkarounds(
|
||||
CommandQueue &commandQueue,
|
||||
Kernel &kernel,
|
||||
const bool &enable) {
|
||||
bool containsStatefulAccess = AddressingModeHelper::containsStatefulAccess(kernel.getDescriptor(), false);
|
||||
bool stateCacheInvalidationWaRequired = commandQueue.getDevice().getReleaseHelper()->isStateCacheInvalidationWaRequired() && containsStatefulAccess;
|
||||
bool containsBufferStatefulAccess = AddressingModeHelper::containsBufferStatefulAccess(kernel.getDescriptor(), false);
|
||||
bool stateCacheInvalidationWaRequired = commandQueue.getDevice().getReleaseHelper()->isStateCacheInvalidationWaRequired() && containsBufferStatefulAccess;
|
||||
if (!enable && stateCacheInvalidationWaRequired) {
|
||||
PipeControlArgs args{};
|
||||
args.stateCacheInvalidationEnable = true;
|
||||
|
||||
@@ -139,12 +139,12 @@ cl_int Program::build(
|
||||
retVal = processGenBinaries(deviceVector, phaseReached);
|
||||
|
||||
auto skipLastExplicitArg = isGTPinInitialized;
|
||||
auto containsStatefulAccess = AddressingModeHelper::containsStatefulAccess(buildInfos[clDevices[0]->getRootDeviceIndex()].kernelInfoArray, skipLastExplicitArg);
|
||||
auto containsBufferStatefulAccess = AddressingModeHelper::containsBufferStatefulAccess(buildInfos[clDevices[0]->getRootDeviceIndex()].kernelInfoArray, skipLastExplicitArg);
|
||||
auto isUserKernel = !isBuiltIn;
|
||||
|
||||
auto failBuildProgram = containsStatefulAccess &&
|
||||
auto failBuildProgram = containsBufferStatefulAccess &&
|
||||
isUserKernel &&
|
||||
AddressingModeHelper::failBuildProgramWithStatefulAccess(clDevices[0]->getRootDeviceEnvironment()) &&
|
||||
AddressingModeHelper::failBuildProgramWithBufferStatefulAccess(clDevices[0]->getRootDeviceEnvironment()) &&
|
||||
isGeneratedByIgc;
|
||||
|
||||
if (failBuildProgram) {
|
||||
|
||||
@@ -1860,7 +1860,7 @@ TEST_F(ProgramTests, whenContainsStatefulAccessIsCalledThenReturnCorrectResult)
|
||||
kernelInfo->kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
|
||||
program.addKernelInfo(kernelInfo.release(), 0);
|
||||
|
||||
EXPECT_EQ(expectedResult, AddressingModeHelper::containsStatefulAccess(program.buildInfos[0].kernelInfoArray, false));
|
||||
EXPECT_EQ(expectedResult, AddressingModeHelper::containsBufferStatefulAccess(program.buildInfos[0].kernelInfoArray, false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1882,7 +1882,7 @@ TEST_F(ProgramTests, givenSkipLastExplicitArgWhenContainsStatefulAccessIsCalledT
|
||||
kernelInfo->kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
|
||||
program.addKernelInfo(kernelInfo.release(), 0);
|
||||
|
||||
EXPECT_EQ(expectedResult, AddressingModeHelper::containsStatefulAccess(program.buildInfos[0].kernelInfoArray, skipLastExplicitArg));
|
||||
EXPECT_EQ(expectedResult, AddressingModeHelper::containsBufferStatefulAccess(program.buildInfos[0].kernelInfoArray, skipLastExplicitArg));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1948,7 +1948,7 @@ TEST_F(ProgramTests, givenStatefulAndStatelessAccessesWhenProgramBuildIsCalledTh
|
||||
zebin.setAsMockCompilerReturnedBinary();
|
||||
debugManager.flags.FailBuildProgramWithStatefulAccess.set(debugKey);
|
||||
if (isStatefulAccess && debugKey == -1 && isIgcGenerated == true) {
|
||||
if (compilerProductHelper.failBuildProgramWithStatefulAccessPreference() == true) {
|
||||
if (compilerProductHelper.failBuildProgramWithBufferStatefulAccessPreference() == true) {
|
||||
expectedResult = CL_BUILD_PROGRAM_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -14,10 +14,10 @@
|
||||
|
||||
namespace NEO::AddressingModeHelper {
|
||||
|
||||
bool failBuildProgramWithStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
bool failBuildProgramWithBufferStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
const auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
|
||||
|
||||
auto failBuildProgram = compilerProductHelper.failBuildProgramWithStatefulAccessPreference();
|
||||
auto failBuildProgram = compilerProductHelper.failBuildProgramWithBufferStatefulAccessPreference();
|
||||
if (NEO::debugManager.flags.FailBuildProgramWithStatefulAccess.get() != -1) {
|
||||
failBuildProgram = static_cast<bool>(NEO::debugManager.flags.FailBuildProgramWithStatefulAccess.get());
|
||||
}
|
||||
@@ -33,7 +33,7 @@ inline bool argPointerIsStateful(const ArgDescriptor &arg) {
|
||||
NEO::isValidOffset(arg.as<NEO::ArgDescPointer>().bindful));
|
||||
}
|
||||
|
||||
bool containsStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipLastExplicitArg) {
|
||||
bool containsBufferStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipLastExplicitArg) {
|
||||
auto size = static_cast<int32_t>(kernelDescriptor.payloadMappings.explicitArgs.size());
|
||||
if (skipLastExplicitArg) {
|
||||
size--;
|
||||
@@ -46,9 +46,9 @@ bool containsStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipL
|
||||
return false;
|
||||
}
|
||||
|
||||
bool containsStatefulAccess(const std::vector<KernelInfo *> &kernelInfos, bool skipLastExplicitArg) {
|
||||
bool containsBufferStatefulAccess(const std::vector<KernelInfo *> &kernelInfos, bool skipLastExplicitArg) {
|
||||
for (const auto &kernelInfo : kernelInfos) {
|
||||
if (containsStatefulAccess(kernelInfo->kernelDescriptor, skipLastExplicitArg)) {
|
||||
if (containsBufferStatefulAccess(kernelInfo->kernelDescriptor, skipLastExplicitArg)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -14,9 +14,9 @@ struct KernelInfo;
|
||||
struct RootDeviceEnvironment;
|
||||
|
||||
namespace AddressingModeHelper {
|
||||
bool failBuildProgramWithStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
bool containsStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipLastExplicitArg);
|
||||
bool containsStatefulAccess(const std::vector<KernelInfo *> &kernelInfos, bool skipLastExplicitArg);
|
||||
bool failBuildProgramWithBufferStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
bool containsBufferStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipLastExplicitArg);
|
||||
bool containsBufferStatefulAccess(const std::vector<KernelInfo *> &kernelInfos, bool skipLastExplicitArg);
|
||||
bool containsBindlessKernel(const std::vector<KernelInfo *> &kernelInfos);
|
||||
|
||||
} // namespace AddressingModeHelper
|
||||
|
||||
@@ -69,7 +69,7 @@ class CompilerProductHelper {
|
||||
virtual bool isSubgroup2DBlockIOSupported() const = 0;
|
||||
virtual bool isSubgroupBufferPrefetchSupported() const = 0;
|
||||
virtual bool isForceToStatelessRequired() const = 0;
|
||||
virtual bool failBuildProgramWithStatefulAccessPreference() const = 0;
|
||||
virtual bool failBuildProgramWithBufferStatefulAccessPreference() const = 0;
|
||||
virtual bool oclocEnforceZebinFormat() const = 0;
|
||||
virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const = 0;
|
||||
virtual const char *getCachingPolicyOptions(bool isDebuggerActive) const = 0;
|
||||
@@ -123,7 +123,7 @@ class CompilerProductHelperHw : public CompilerProductHelper {
|
||||
bool isSubgroup2DBlockIOSupported() const override;
|
||||
bool isSubgroupBufferPrefetchSupported() const override;
|
||||
bool isForceToStatelessRequired() const override;
|
||||
bool failBuildProgramWithStatefulAccessPreference() const override;
|
||||
bool failBuildProgramWithBufferStatefulAccessPreference() const override;
|
||||
bool oclocEnforceZebinFormat() const override;
|
||||
void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const override;
|
||||
const char *getCachingPolicyOptions(bool isDebuggerActive) const override;
|
||||
|
||||
@@ -44,7 +44,7 @@ const char *CompilerProductHelperHw<gfxProduct>::getCachingPolicyOptions(bool is
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
bool CompilerProductHelperHw<gfxProduct>::failBuildProgramWithStatefulAccessPreference() const {
|
||||
bool CompilerProductHelperHw<gfxProduct>::failBuildProgramWithBufferStatefulAccessPreference() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ uint32_t CompilerProductHelperHw<IGFX_PVC>::matchRevisionIdWithProductConfig(Har
|
||||
}
|
||||
|
||||
template <>
|
||||
bool CompilerProductHelperHw<IGFX_PVC>::failBuildProgramWithStatefulAccessPreference() const {
|
||||
bool CompilerProductHelperHw<IGFX_PVC>::failBuildProgramWithBufferStatefulAccessPreference() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class MockCompilerProductHelper : public CompilerProductHelper {
|
||||
ADDMETHOD_CONST_NOBASE(isSubgroup2DBlockIOSupported, bool, false, ());
|
||||
ADDMETHOD_CONST_NOBASE(isSubgroupBufferPrefetchSupported, bool, false, ());
|
||||
ADDMETHOD_CONST_NOBASE(isForceToStatelessRequired, bool, false, ());
|
||||
ADDMETHOD_CONST_NOBASE(failBuildProgramWithStatefulAccessPreference, bool, false, ());
|
||||
ADDMETHOD_CONST_NOBASE(failBuildProgramWithBufferStatefulAccessPreference, bool, false, ());
|
||||
ADDMETHOD_CONST_NOBASE(oclocEnforceZebinFormat, bool, false, ());
|
||||
ADDMETHOD_CONST_NOBASE_VOIDRETURN(setProductConfigForHwInfo, (HardwareInfo & hwInfo, HardwareIpVersion config));
|
||||
ADDMETHOD_CONST_NOBASE(getCachingPolicyOptions, const char *, nullptr, (bool isDebuggerActive));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
* Copyright (C) 2023-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -18,7 +18,7 @@ TEST(AddressingModeHelperTest, GivenArgIsNotPointerWhenCheckingForStatefulAccess
|
||||
KernelDescriptor kernelDescriptor;
|
||||
kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
|
||||
|
||||
EXPECT_FALSE(AddressingModeHelper::containsStatefulAccess(kernelDescriptor, false));
|
||||
EXPECT_FALSE(AddressingModeHelper::containsBufferStatefulAccess(kernelDescriptor, false));
|
||||
}
|
||||
|
||||
TEST(AddressingModeHelperTest, GivenArgIsPointerWithInvalidStatefulOffsetWhenCheckingForStatefulAccessThenReturnFalse) {
|
||||
@@ -29,7 +29,7 @@ TEST(AddressingModeHelperTest, GivenArgIsPointerWithInvalidStatefulOffsetWhenChe
|
||||
KernelDescriptor kernelDescriptor;
|
||||
kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
|
||||
|
||||
EXPECT_FALSE(AddressingModeHelper::containsStatefulAccess(kernelDescriptor, false));
|
||||
EXPECT_FALSE(AddressingModeHelper::containsBufferStatefulAccess(kernelDescriptor, false));
|
||||
}
|
||||
|
||||
TEST(AddressingModeHelperTest, GivenArgIsPointerWithValidBindfulOffsetWhenCheckingForStatefulAccessThenReturnTrue) {
|
||||
@@ -40,7 +40,7 @@ TEST(AddressingModeHelperTest, GivenArgIsPointerWithValidBindfulOffsetWhenChecki
|
||||
KernelDescriptor kernelDescriptor;
|
||||
kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
|
||||
|
||||
EXPECT_TRUE(AddressingModeHelper::containsStatefulAccess(kernelDescriptor, false));
|
||||
EXPECT_TRUE(AddressingModeHelper::containsBufferStatefulAccess(kernelDescriptor, false));
|
||||
}
|
||||
|
||||
TEST(AddressingModeHelperTest, GivenArgIsPointerWithValidBindlessOffsetWhenCheckingForStatefulAccessThenReturnTrue) {
|
||||
@@ -51,7 +51,7 @@ TEST(AddressingModeHelperTest, GivenArgIsPointerWithValidBindlessOffsetWhenCheck
|
||||
KernelDescriptor kernelDescriptor;
|
||||
kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
|
||||
|
||||
EXPECT_TRUE(AddressingModeHelper::containsStatefulAccess(kernelDescriptor, false));
|
||||
EXPECT_TRUE(AddressingModeHelper::containsBufferStatefulAccess(kernelDescriptor, false));
|
||||
}
|
||||
|
||||
TEST(AddressingModeHelperTest, GivenLastArgIsPointerWithValidBindlessOffsetWhenIgnoreLastArgAndCheckingForStatefulAccessThenReturnFalse) {
|
||||
@@ -62,7 +62,7 @@ TEST(AddressingModeHelperTest, GivenLastArgIsPointerWithValidBindlessOffsetWhenI
|
||||
KernelDescriptor kernelDescriptor;
|
||||
kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
|
||||
|
||||
EXPECT_FALSE(AddressingModeHelper::containsStatefulAccess(kernelDescriptor, true));
|
||||
EXPECT_FALSE(AddressingModeHelper::containsBufferStatefulAccess(kernelDescriptor, true));
|
||||
}
|
||||
|
||||
TEST(AddressingModeHelperTest, GivenKernelInfosWhenCheckingForBindlessKernelThenReturnCorrectValue) {
|
||||
|
||||
@@ -42,7 +42,7 @@ PVCTEST_F(CompilerProductHelperPvcTest, givenPvcWhenFailBuildProgramWithStateful
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
|
||||
EXPECT_FALSE(compilerProductHelper.failBuildProgramWithStatefulAccessPreference());
|
||||
EXPECT_FALSE(compilerProductHelper.failBuildProgramWithBufferStatefulAccessPreference());
|
||||
}
|
||||
|
||||
PVCTEST_F(CompilerProductHelperPvcTest, givenPvcB0AndLaterThenMatrixMultiplyAccumulateTF32IsSupported) {
|
||||
|
||||
Reference in New Issue
Block a user