Skip to content

Commit 8b98e0d

Browse files
refactor: rename functions to check if buffer has stateful access
Signed-off-by: Kamil Kopryk <[email protected]>
1 parent 5f874f4 commit 8b98e0d

File tree

14 files changed

+37
-37
lines changed

14 files changed

+37
-37
lines changed

level_zero/core/source/kernel/kernel_imp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,8 +1640,8 @@ bool KernelImp::checkKernelContainsStatefulAccess() {
16401640
auto moduleImp = static_cast<ModuleImp *>(this->module);
16411641
auto isUserKernel = (moduleImp->getModuleType() == ModuleType::user);
16421642
auto isGeneratedByIgc = moduleImp->getTranslationUnit()->isGeneratedByIgc;
1643-
auto containsStatefulAccess = NEO::AddressingModeHelper::containsStatefulAccess(getKernelDescriptor(), false);
1644-
return containsStatefulAccess && isUserKernel && isGeneratedByIgc;
1643+
auto containsBufferStatefulAccess = NEO::AddressingModeHelper::containsBufferStatefulAccess(getKernelDescriptor(), false);
1644+
return containsBufferStatefulAccess && isUserKernel && isGeneratedByIgc;
16451645
}
16461646

16471647
uint8_t KernelImp::getRequiredSlmAlignment(uint32_t argIndex) const {

level_zero/core/source/module/module_imp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,12 +835,12 @@ inline ze_result_t ModuleImp::initializeTranslationUnit(const ze_module_desc_t *
835835

836836
inline bool ModuleImp::shouldBuildBeFailed(NEO::Device *neoDevice) {
837837
auto &rootDeviceEnvironment = neoDevice->getRootDeviceEnvironment();
838-
auto containsStatefulAccess = NEO::AddressingModeHelper::containsStatefulAccess(translationUnit->programInfo.kernelInfos, false);
838+
auto containsBufferStatefulAccess = NEO::AddressingModeHelper::containsBufferStatefulAccess(translationUnit->programInfo.kernelInfos, false);
839839
auto isUserKernel = (type == ModuleType::user);
840840
auto isGeneratedByIgc = translationUnit->isGeneratedByIgc;
841-
return containsStatefulAccess &&
841+
return containsBufferStatefulAccess &&
842842
isUserKernel &&
843-
NEO::AddressingModeHelper::failBuildProgramWithStatefulAccess(rootDeviceEnvironment) &&
843+
NEO::AddressingModeHelper::failBuildProgramWithBufferStatefulAccess(rootDeviceEnvironment) &&
844844
isGeneratedByIgc;
845845
}
846846

level_zero/core/test/unit_tests/sources/module/test_module.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4340,7 +4340,7 @@ TEST_F(ModuleTest, whenContainsStatefulAccessIsCalledThenResultIsCorrect) {
43404340
moduleTranslationUnit->programInfo.kernelInfos.clear();
43414341
moduleTranslationUnit->programInfo.kernelInfos.push_back(kernelInfo.release());
43424342

4343-
EXPECT_EQ(expectedResult, NEO::AddressingModeHelper::containsStatefulAccess(moduleTranslationUnit->programInfo.kernelInfos, false));
4343+
EXPECT_EQ(expectedResult, NEO::AddressingModeHelper::containsBufferStatefulAccess(moduleTranslationUnit->programInfo.kernelInfos, false));
43444344
}
43454345
}
43464346

@@ -4642,7 +4642,7 @@ TEST_F(ModuleInitializeTest, whenModuleInitializeIsCalledThenCorrectResultIsRetu
46424642
module.setAddressingMode(isStateful);
46434643

46444644
if (isStateful && debugKey == -1 && isIgcGenerated == true) {
4645-
if (compilerProductHelper.failBuildProgramWithStatefulAccessPreference() == true) {
4645+
if (compilerProductHelper.failBuildProgramWithBufferStatefulAccessPreference() == true) {
46464646
expectedResult = ZE_RESULT_ERROR_MODULE_BUILD_FAILURE;
46474647
}
46484648
}

opencl/source/command_queue/hardware_interface_xehp_and_later.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ inline void HardwareInterface<GfxFamily>::dispatchWorkarounds(
4141
CommandQueue &commandQueue,
4242
Kernel &kernel,
4343
const bool &enable) {
44-
bool containsStatefulAccess = AddressingModeHelper::containsStatefulAccess(kernel.getDescriptor(), false);
45-
bool stateCacheInvalidationWaRequired = commandQueue.getDevice().getReleaseHelper()->isStateCacheInvalidationWaRequired() && containsStatefulAccess;
44+
bool containsBufferStatefulAccess = AddressingModeHelper::containsBufferStatefulAccess(kernel.getDescriptor(), false);
45+
bool stateCacheInvalidationWaRequired = commandQueue.getDevice().getReleaseHelper()->isStateCacheInvalidationWaRequired() && containsBufferStatefulAccess;
4646
if (!enable && stateCacheInvalidationWaRequired) {
4747
PipeControlArgs args{};
4848
args.stateCacheInvalidationEnable = true;

opencl/source/program/build.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ cl_int Program::build(
139139
retVal = processGenBinaries(deviceVector, phaseReached);
140140

141141
auto skipLastExplicitArg = isGTPinInitialized;
142-
auto containsStatefulAccess = AddressingModeHelper::containsStatefulAccess(buildInfos[clDevices[0]->getRootDeviceIndex()].kernelInfoArray, skipLastExplicitArg);
142+
auto containsBufferStatefulAccess = AddressingModeHelper::containsBufferStatefulAccess(buildInfos[clDevices[0]->getRootDeviceIndex()].kernelInfoArray, skipLastExplicitArg);
143143
auto isUserKernel = !isBuiltIn;
144144

145-
auto failBuildProgram = containsStatefulAccess &&
145+
auto failBuildProgram = containsBufferStatefulAccess &&
146146
isUserKernel &&
147-
AddressingModeHelper::failBuildProgramWithStatefulAccess(clDevices[0]->getRootDeviceEnvironment()) &&
147+
AddressingModeHelper::failBuildProgramWithBufferStatefulAccess(clDevices[0]->getRootDeviceEnvironment()) &&
148148
isGeneratedByIgc;
149149

150150
if (failBuildProgram) {

opencl/test/unit_test/program/program_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ TEST_F(ProgramTests, whenContainsStatefulAccessIsCalledThenReturnCorrectResult)
18601860
kernelInfo->kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
18611861
program.addKernelInfo(kernelInfo.release(), 0);
18621862

1863-
EXPECT_EQ(expectedResult, AddressingModeHelper::containsStatefulAccess(program.buildInfos[0].kernelInfoArray, false));
1863+
EXPECT_EQ(expectedResult, AddressingModeHelper::containsBufferStatefulAccess(program.buildInfos[0].kernelInfoArray, false));
18641864
}
18651865
}
18661866

@@ -1882,7 +1882,7 @@ TEST_F(ProgramTests, givenSkipLastExplicitArgWhenContainsStatefulAccessIsCalledT
18821882
kernelInfo->kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptor);
18831883
program.addKernelInfo(kernelInfo.release(), 0);
18841884

1885-
EXPECT_EQ(expectedResult, AddressingModeHelper::containsStatefulAccess(program.buildInfos[0].kernelInfoArray, skipLastExplicitArg));
1885+
EXPECT_EQ(expectedResult, AddressingModeHelper::containsBufferStatefulAccess(program.buildInfos[0].kernelInfoArray, skipLastExplicitArg));
18861886
}
18871887
}
18881888

@@ -1948,7 +1948,7 @@ TEST_F(ProgramTests, givenStatefulAndStatelessAccessesWhenProgramBuildIsCalledTh
19481948
zebin.setAsMockCompilerReturnedBinary();
19491949
debugManager.flags.FailBuildProgramWithStatefulAccess.set(debugKey);
19501950
if (isStatefulAccess && debugKey == -1 && isIgcGenerated == true) {
1951-
if (compilerProductHelper.failBuildProgramWithStatefulAccessPreference() == true) {
1951+
if (compilerProductHelper.failBuildProgramWithBufferStatefulAccessPreference() == true) {
19521952
expectedResult = CL_BUILD_PROGRAM_FAILURE;
19531953
}
19541954
}

shared/source/helpers/addressing_mode_helper.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022-2024 Intel Corporation
2+
* Copyright (C) 2022-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -14,10 +14,10 @@
1414

1515
namespace NEO::AddressingModeHelper {
1616

17-
bool failBuildProgramWithStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment) {
17+
bool failBuildProgramWithBufferStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment) {
1818
const auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
1919

20-
auto failBuildProgram = compilerProductHelper.failBuildProgramWithStatefulAccessPreference();
20+
auto failBuildProgram = compilerProductHelper.failBuildProgramWithBufferStatefulAccessPreference();
2121
if (NEO::debugManager.flags.FailBuildProgramWithStatefulAccess.get() != -1) {
2222
failBuildProgram = static_cast<bool>(NEO::debugManager.flags.FailBuildProgramWithStatefulAccess.get());
2323
}
@@ -33,7 +33,7 @@ inline bool argPointerIsStateful(const ArgDescriptor &arg) {
3333
NEO::isValidOffset(arg.as<NEO::ArgDescPointer>().bindful));
3434
}
3535

36-
bool containsStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipLastExplicitArg) {
36+
bool containsBufferStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipLastExplicitArg) {
3737
auto size = static_cast<int32_t>(kernelDescriptor.payloadMappings.explicitArgs.size());
3838
if (skipLastExplicitArg) {
3939
size--;
@@ -46,9 +46,9 @@ bool containsStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipL
4646
return false;
4747
}
4848

49-
bool containsStatefulAccess(const std::vector<KernelInfo *> &kernelInfos, bool skipLastExplicitArg) {
49+
bool containsBufferStatefulAccess(const std::vector<KernelInfo *> &kernelInfos, bool skipLastExplicitArg) {
5050
for (const auto &kernelInfo : kernelInfos) {
51-
if (containsStatefulAccess(kernelInfo->kernelDescriptor, skipLastExplicitArg)) {
51+
if (containsBufferStatefulAccess(kernelInfo->kernelDescriptor, skipLastExplicitArg)) {
5252
return true;
5353
}
5454
}

shared/source/helpers/addressing_mode_helper.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022-2024 Intel Corporation
2+
* Copyright (C) 2022-2025 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -14,9 +14,9 @@ struct KernelInfo;
1414
struct RootDeviceEnvironment;
1515

1616
namespace AddressingModeHelper {
17-
bool failBuildProgramWithStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment);
18-
bool containsStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipLastExplicitArg);
19-
bool containsStatefulAccess(const std::vector<KernelInfo *> &kernelInfos, bool skipLastExplicitArg);
17+
bool failBuildProgramWithBufferStatefulAccess(const RootDeviceEnvironment &rootDeviceEnvironment);
18+
bool containsBufferStatefulAccess(const KernelDescriptor &kernelDescriptor, bool skipLastExplicitArg);
19+
bool containsBufferStatefulAccess(const std::vector<KernelInfo *> &kernelInfos, bool skipLastExplicitArg);
2020
bool containsBindlessKernel(const std::vector<KernelInfo *> &kernelInfos);
2121

2222
} // namespace AddressingModeHelper

shared/source/helpers/compiler_product_helper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class CompilerProductHelper {
6969
virtual bool isSubgroup2DBlockIOSupported() const = 0;
7070
virtual bool isSubgroupBufferPrefetchSupported() const = 0;
7171
virtual bool isForceToStatelessRequired() const = 0;
72-
virtual bool failBuildProgramWithStatefulAccessPreference() const = 0;
72+
virtual bool failBuildProgramWithBufferStatefulAccessPreference() const = 0;
7373
virtual bool oclocEnforceZebinFormat() const = 0;
7474
virtual void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const = 0;
7575
virtual const char *getCachingPolicyOptions(bool isDebuggerActive) const = 0;
@@ -123,7 +123,7 @@ class CompilerProductHelperHw : public CompilerProductHelper {
123123
bool isSubgroup2DBlockIOSupported() const override;
124124
bool isSubgroupBufferPrefetchSupported() const override;
125125
bool isForceToStatelessRequired() const override;
126-
bool failBuildProgramWithStatefulAccessPreference() const override;
126+
bool failBuildProgramWithBufferStatefulAccessPreference() const override;
127127
bool oclocEnforceZebinFormat() const override;
128128
void setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const override;
129129
const char *getCachingPolicyOptions(bool isDebuggerActive) const override;

shared/source/helpers/compiler_product_helper_base.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const char *CompilerProductHelperHw<gfxProduct>::getCachingPolicyOptions(bool is
4444
}
4545

4646
template <PRODUCT_FAMILY gfxProduct>
47-
bool CompilerProductHelperHw<gfxProduct>::failBuildProgramWithStatefulAccessPreference() const {
47+
bool CompilerProductHelperHw<gfxProduct>::failBuildProgramWithBufferStatefulAccessPreference() const {
4848
return false;
4949
}
5050

0 commit comments

Comments
 (0)