mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 14:02:58 +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
@@ -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