Skip to content

Commit b7883bf

Browse files
Add helper to check if non-AUX mode is required
Signed-off-by: Milczarek, Slawomir <[email protected]>
1 parent 4b300e8 commit b7883bf

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

opencl/source/helpers/cl_hw_helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace NEO {
1919

2020
class Context;
2121
class ClDevice;
22+
struct ArgDescPointer;
2223
struct HardwareInfo;
2324
struct KernelInfo;
2425
struct MultiDispatchInfo;
@@ -27,6 +28,7 @@ class ClHwHelper {
2728
public:
2829
static ClHwHelper &get(GFXCORE_FAMILY gfxCore);
2930

31+
virtual bool requiresNonAuxMode(const ArgDescPointer &argAsPtr) const = 0;
3032
virtual bool requiresAuxResolves(const KernelInfo &kernelInfo) const = 0;
3133
virtual bool allowRenderCompressionForContext(const ClDevice &clDevice, const Context &context) const = 0;
3234
virtual cl_command_queue_capabilities_intel getAdditionalDisabledQueueFamilyCapabilities(EngineGroupType type) const = 0;
@@ -55,6 +57,7 @@ class ClHwHelperHw : public ClHwHelper {
5557
return clHwHelper;
5658
}
5759

60+
bool requiresNonAuxMode(const ArgDescPointer &argAsPtr) const override;
5861
bool requiresAuxResolves(const KernelInfo &kernelInfo) const override;
5962
bool allowRenderCompressionForContext(const ClDevice &clDevice, const Context &context) const override;
6063
cl_command_queue_capabilities_intel getAdditionalDisabledQueueFamilyCapabilities(EngineGroupType type) const override;

opencl/source/helpers/cl_hw_helper_base.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313

1414
namespace NEO {
1515

16+
template <typename GfxFamily>
17+
inline bool ClHwHelperHw<GfxFamily>::requiresNonAuxMode(const ArgDescPointer &argAsPtr) const {
18+
return !argAsPtr.isPureStateful();
19+
}
20+
1621
template <typename GfxFamily>
1722
inline bool ClHwHelperHw<GfxFamily>::requiresAuxResolves(const KernelInfo &kernelInfo) const {
1823
return hasStatelessAccessToBuffer(kernelInfo);

opencl/source/kernel/kernel.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,17 @@ cl_int Kernel::setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocatio
889889
bool disableL3 = false;
890890
bool forceNonAuxMode = false;
891891
bool isAuxTranslationKernel = (AuxTranslationDirection::None != auxTranslationDirection);
892+
auto &hwInfo = getDevice().getHardwareInfo();
893+
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
894+
892895
if (isAuxTranslationKernel) {
893896
if (((AuxTranslationDirection::AuxToNonAux == auxTranslationDirection) && argIndex == 1) ||
894897
((AuxTranslationDirection::NonAuxToAux == auxTranslationDirection) && argIndex == 0)) {
895898
forceNonAuxMode = true;
896899
}
897900
disableL3 = (argIndex == 0);
898-
} else if (svmAlloc && svmAlloc->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED && !argAsPtr.isPureStateful()) {
901+
} else if (svmAlloc && svmAlloc->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED &&
902+
clHwHelper.requiresNonAuxMode(argAsPtr)) {
899903
forceNonAuxMode = true;
900904
}
901905

@@ -1376,6 +1380,8 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex,
13761380
bool forceNonAuxMode = false;
13771381
bool isAuxTranslationKernel = (AuxTranslationDirection::None != auxTranslationDirection);
13781382
auto graphicsAllocation = buffer->getGraphicsAllocation(rootDeviceIndex);
1383+
auto &hwInfo = pClDevice->getHardwareInfo();
1384+
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
13791385

13801386
if (isAuxTranslationKernel) {
13811387
if (((AuxTranslationDirection::AuxToNonAux == auxTranslationDirection) && argIndex == 1) ||
@@ -1384,7 +1390,7 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex,
13841390
}
13851391
disableL3 = (argIndex == 0);
13861392
} else if (graphicsAllocation->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED &&
1387-
!argAsPtr.isPureStateful()) {
1393+
clHwHelper.requiresNonAuxMode(argAsPtr)) {
13881394
forceNonAuxMode = true;
13891395
}
13901396

opencl/test/unit_test/helpers/hw_helper_tests.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,3 +1243,14 @@ TEST_F(HwHelperTest, whenGettingNumberOfCacheRegionsThenReturnZero) {
12431243
auto &hwHelper = HwHelper::get(renderCoreFamily);
12441244
EXPECT_EQ(0u, hwHelper.getNumCacheRegions(*defaultHwInfo));
12451245
}
1246+
1247+
TEST_F(HwHelperTest, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequireNonAuxMode) {
1248+
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
1249+
1250+
for (auto isPureStateful : {false, true}) {
1251+
ArgDescPointer argAsPtr{};
1252+
argAsPtr.accessedUsingStatelessAddressingMode = !isPureStateful;
1253+
1254+
EXPECT_EQ(!argAsPtr.isPureStateful(), clHwHelper.requiresNonAuxMode(argAsPtr));
1255+
}
1256+
}

0 commit comments

Comments
 (0)