mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Move ClCoreHelper ownership to RootDeviceEnvironment 1/n
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com> Use RootDeviceEnvironment getHelper<ClCoreHelper> for - requiresNonAuxMode - requiresAuxResolves
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
05aea7ebc8
commit
1d4240a0c8
@ -27,7 +27,7 @@ cl_version ClHwHelper::makeDeviceIpVersion(uint16_t major, uint8_t minor, uint8_
|
||||
}
|
||||
|
||||
template <>
|
||||
ClHwHelper &RootDeviceEnvironment::getHelper<ClHwHelper>() const {
|
||||
ClCoreHelper &RootDeviceEnvironment::getHelper<ClCoreHelper>() const {
|
||||
auto &apiHelper = ClHwHelper::get(this->getHardwareInfo()->platform.eRenderCoreFamily);
|
||||
return apiHelper;
|
||||
}
|
||||
|
@ -24,13 +24,17 @@ struct ArgDescPointer;
|
||||
struct HardwareInfo;
|
||||
struct KernelInfo;
|
||||
struct MultiDispatchInfo;
|
||||
class ClHwHelper;
|
||||
struct RootDeviceEnvironment;
|
||||
|
||||
using ClCoreHelper = ClHwHelper;
|
||||
|
||||
class ClHwHelper {
|
||||
public:
|
||||
static ClHwHelper &get(GFXCORE_FAMILY gfxCore);
|
||||
|
||||
virtual bool requiresNonAuxMode(const ArgDescPointer &argAsPtr, const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool requiresAuxResolves(const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
|
||||
virtual bool requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
|
||||
virtual bool allowCompressionForContext(const ClDevice &clDevice, const Context &context) const = 0;
|
||||
virtual cl_command_queue_capabilities_intel getAdditionalDisabledQueueFamilyCapabilities(EngineGroupType type) const = 0;
|
||||
virtual bool getQueueFamilyName(std::string &name, EngineGroupType type) const = 0;
|
||||
@ -60,8 +64,8 @@ class ClHwHelperHw : public ClHwHelper {
|
||||
return clHwHelper;
|
||||
}
|
||||
|
||||
bool requiresNonAuxMode(const ArgDescPointer &argAsPtr, const HardwareInfo &hwInfo) const override;
|
||||
bool requiresAuxResolves(const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) const override;
|
||||
bool requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const override;
|
||||
bool requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const override;
|
||||
bool allowCompressionForContext(const ClDevice &clDevice, const Context &context) const override;
|
||||
cl_command_queue_capabilities_intel getAdditionalDisabledQueueFamilyCapabilities(EngineGroupType type) const override;
|
||||
bool getQueueFamilyName(std::string &name, EngineGroupType type) const override;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -14,12 +14,12 @@
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline bool ClHwHelperHw<GfxFamily>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const HardwareInfo &hwInfo) const {
|
||||
inline bool ClHwHelperHw<GfxFamily>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
return !argAsPtr.isPureStateful();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline bool ClHwHelperHw<GfxFamily>::requiresAuxResolves(const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) const {
|
||||
inline bool ClHwHelperHw<GfxFamily>::requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
return hasStatelessAccessToBuffer(kernelInfo);
|
||||
}
|
||||
|
||||
|
@ -138,14 +138,15 @@ cl_int Kernel::initialize() {
|
||||
auto rootDeviceIndex = pClDevice->getRootDeviceIndex();
|
||||
reconfigureKernel();
|
||||
auto &hwInfo = pClDevice->getHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
auto &rootDeviceEnvironment = pClDevice->getRootDeviceEnvironment();
|
||||
auto &coreHelper = rootDeviceEnvironment.getHelper<CoreHelper>();
|
||||
auto &kernelDescriptor = kernelInfo.kernelDescriptor;
|
||||
const auto &implicitArgs = kernelDescriptor.payloadMappings.implicitArgs;
|
||||
const auto &explicitArgs = kernelDescriptor.payloadMappings.explicitArgs;
|
||||
auto maxSimdSize = kernelInfo.getMaxSimdSize();
|
||||
const auto &heapInfo = kernelInfo.heapInfo;
|
||||
|
||||
if (maxSimdSize != 1 && maxSimdSize < hwHelper.getMinimalSIMDSize()) {
|
||||
if (maxSimdSize != 1 && maxSimdSize < coreHelper.getMinimalSIMDSize()) {
|
||||
return CL_INVALID_KERNEL;
|
||||
}
|
||||
|
||||
@ -238,15 +239,15 @@ cl_int Kernel::initialize() {
|
||||
|
||||
auto &threadArbitrationPolicy = const_cast<ThreadArbitrationPolicy &>(kernelInfo.kernelDescriptor.kernelAttributes.threadArbitrationPolicy);
|
||||
if (threadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent) {
|
||||
threadArbitrationPolicy = static_cast<ThreadArbitrationPolicy>(hwHelper.getDefaultThreadArbitrationPolicy());
|
||||
threadArbitrationPolicy = static_cast<ThreadArbitrationPolicy>(coreHelper.getDefaultThreadArbitrationPolicy());
|
||||
}
|
||||
if (false == kernelInfo.kernelDescriptor.kernelAttributes.flags.requiresSubgroupIndependentForwardProgress) {
|
||||
threadArbitrationPolicy = ThreadArbitrationPolicy::AgeBased;
|
||||
}
|
||||
|
||||
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
auto &clCoreHelper = rootDeviceEnvironment.getHelper<ClCoreHelper>();
|
||||
|
||||
auxTranslationRequired = !program->getIsBuiltIn() && HwHelper::compressedBuffersSupported(hwInfo) && clHwHelper.requiresAuxResolves(kernelInfo, hwInfo);
|
||||
auxTranslationRequired = !program->getIsBuiltIn() && HwHelper::compressedBuffersSupported(hwInfo) && clCoreHelper.requiresAuxResolves(kernelInfo, rootDeviceEnvironment);
|
||||
|
||||
if (DebugManager.flags.ForceAuxTranslationEnabled.get() != -1) {
|
||||
auxTranslationRequired &= !!DebugManager.flags.ForceAuxTranslationEnabled.get();
|
||||
@ -919,8 +920,8 @@ cl_int Kernel::setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocatio
|
||||
bool disableL3 = false;
|
||||
bool forceNonAuxMode = false;
|
||||
bool isAuxTranslationKernel = (AuxTranslationDirection::None != auxTranslationDirection);
|
||||
auto &hwInfo = getDevice().getHardwareInfo();
|
||||
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
auto &rootDeviceEnvironment = getDevice().getRootDeviceEnvironment();
|
||||
auto &clCoreHelper = rootDeviceEnvironment.getHelper<ClCoreHelper>();
|
||||
|
||||
if (isAuxTranslationKernel) {
|
||||
if (((AuxTranslationDirection::AuxToNonAux == auxTranslationDirection) && argIndex == 1) ||
|
||||
@ -928,7 +929,7 @@ cl_int Kernel::setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocatio
|
||||
forceNonAuxMode = true;
|
||||
}
|
||||
disableL3 = (argIndex == 0);
|
||||
} else if (svmAlloc && svmAlloc->isCompressionEnabled() && clHwHelper.requiresNonAuxMode(argAsPtr, hwInfo)) {
|
||||
} else if (svmAlloc && svmAlloc->isCompressionEnabled() && clCoreHelper.requiresNonAuxMode(argAsPtr, rootDeviceEnvironment)) {
|
||||
forceNonAuxMode = true;
|
||||
}
|
||||
|
||||
@ -1476,8 +1477,8 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex,
|
||||
bool forceNonAuxMode = false;
|
||||
bool isAuxTranslationKernel = (AuxTranslationDirection::None != auxTranslationDirection);
|
||||
auto graphicsAllocation = buffer->getGraphicsAllocation(rootDeviceIndex);
|
||||
auto &hwInfo = pClDevice->getHardwareInfo();
|
||||
auto &clHwHelper = ClHwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
auto &rootDeviceEnvironment = getDevice().getRootDeviceEnvironment();
|
||||
auto &clCoreHelper = rootDeviceEnvironment.getHelper<ClCoreHelper>();
|
||||
|
||||
if (isAuxTranslationKernel) {
|
||||
if (((AuxTranslationDirection::AuxToNonAux == auxTranslationDirection) && argIndex == 1) ||
|
||||
@ -1485,7 +1486,7 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex,
|
||||
forceNonAuxMode = true;
|
||||
}
|
||||
disableL3 = (argIndex == 0);
|
||||
} else if (graphicsAllocation->isCompressionEnabled() && clHwHelper.requiresNonAuxMode(argAsPtr, hwInfo)) {
|
||||
} else if (graphicsAllocation->isCompressionEnabled() && clCoreHelper.requiresNonAuxMode(argAsPtr, rootDeviceEnvironment)) {
|
||||
forceNonAuxMode = true;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/populate_factory.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/xe_hp_core/hw_cmds.h"
|
||||
@ -26,8 +27,11 @@ void populateFactoryTable<ClHwHelperHw<Family>>() {
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ClHwHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const HardwareInfo &hwInfo) const {
|
||||
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) {
|
||||
bool ClHwHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
|
||||
if (productHelper.allowStatelessCompression(hwInfo)) {
|
||||
return false;
|
||||
} else {
|
||||
return !argAsPtr.isPureStateful();
|
||||
@ -35,8 +39,11 @@ bool ClHwHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, co
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ClHwHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) const {
|
||||
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) {
|
||||
bool ClHwHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
|
||||
if (productHelper.allowStatelessCompression(hwInfo)) {
|
||||
return false;
|
||||
} else {
|
||||
return hasStatelessAccessToBuffer(kernelInfo);
|
||||
|
@ -25,7 +25,7 @@ void populateFactoryTable<ClHwHelperHw<Family>>() {
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ClHwHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) const {
|
||||
bool ClHwHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,11 @@ void populateFactoryTable<ClHwHelperHw<Family>>() {
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ClHwHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const HardwareInfo &hwInfo) const {
|
||||
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) {
|
||||
bool ClHwHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
|
||||
if (productHelper.allowStatelessCompression(hwInfo)) {
|
||||
return false;
|
||||
} else {
|
||||
return !argAsPtr.isPureStateful();
|
||||
@ -35,8 +38,11 @@ bool ClHwHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, co
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ClHwHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const HardwareInfo &hwInfo) const {
|
||||
if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->allowStatelessCompression(hwInfo)) {
|
||||
bool ClHwHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
|
||||
if (productHelper.allowStatelessCompression(hwInfo)) {
|
||||
return false;
|
||||
} else {
|
||||
return hasStatelessAccessToBuffer(kernelInfo);
|
||||
|
@ -74,7 +74,6 @@ struct BlitEnqueueTests : public ::testing::Test {
|
||||
if (is32bit) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
REQUIRE_AUX_RESOLVES();
|
||||
|
||||
DebugManager.flags.EnableTimestampPacket.set(timestampPacketEnabled);
|
||||
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
|
||||
@ -83,7 +82,11 @@ struct BlitEnqueueTests : public ::testing::Test {
|
||||
DebugManager.flags.ForceGpgpuSubmissionForBcsEnqueue.set(1);
|
||||
DebugManager.flags.CsrDispatchMode.set(static_cast<int32_t>(DispatchMode::ImmediateDispatch));
|
||||
DebugManager.flags.EnableLocalMemory.set(1);
|
||||
|
||||
device = std::make_unique<MockClDevice>(MockClDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
REQUIRE_AUX_RESOLVES(device->getRootDeviceEnvironment());
|
||||
|
||||
auto &capabilityTable = device->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable;
|
||||
bool createBcsEngine = !capabilityTable.blitterOperationsSupported;
|
||||
capabilityTable.blitterOperationsSupported = true;
|
||||
|
@ -362,7 +362,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueScratchSpaceTests, GivenKernelRequiringScratc
|
||||
// Generically validate this command
|
||||
PARSE::template validateCommand<MEDIA_VFE_STATE *>(cmdList.begin(), itorCmd);
|
||||
|
||||
//skip if size to big 4MB, no point in stressing memory allocator.
|
||||
// skip if size to big 4MB, no point in stressing memory allocator.
|
||||
if (allocationSize > 4194304) {
|
||||
return;
|
||||
}
|
||||
@ -382,7 +382,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueScratchSpaceTests, GivenKernelRequiringScratc
|
||||
if constexpr (is64bit) {
|
||||
ASSERT_NE(itorCmdForStateBase, itorCmd);
|
||||
} else {
|
||||
//no SBA not dirty
|
||||
// no SBA not dirty
|
||||
ASSERT_EQ(itorCmdForStateBase, cmdList.end());
|
||||
}
|
||||
|
||||
@ -511,7 +511,7 @@ HWCMDTEST_P(IGFX_GEN8_CORE, EnqueueKernelWithScratch, givenDeviceForcing32bitAll
|
||||
|
||||
EXPECT_EQ(memoryManager->getExternalHeapBaseAddress(graphicsAllocation->getRootDeviceIndex(), graphicsAllocation->isAllocatedInLocalMemoryPool()), gsHaddress);
|
||||
|
||||
//now re-try to see if SBA is not programmed
|
||||
// now re-try to see if SBA is not programmed
|
||||
|
||||
scratchSize *= 2;
|
||||
mockKernel.kernelInfo.setPerThreadScratchSize(scratchSize, 0);
|
||||
@ -841,7 +841,8 @@ HWTEST_F(EnqueueAuxKernelTests, givenKernelWithRequiredAuxTranslationAndWithoutA
|
||||
}
|
||||
|
||||
HWTEST_F(EnqueueAuxKernelTests, givenMultipleArgsWhenAuxTranslationIsRequiredThenPickOnlyApplicableBuffers) {
|
||||
REQUIRE_AUX_RESOLVES();
|
||||
|
||||
REQUIRE_AUX_RESOLVES(this->getRootDeviceEnvironment());
|
||||
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
#include "shared/source/built_ins/sip.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_hw_helper.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace NEO {
|
||||
@ -42,6 +44,10 @@ MockDevice *ClDeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) {
|
||||
return MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo, rootDeviceIndex);
|
||||
}
|
||||
|
||||
const RootDeviceEnvironment &ClDeviceFixture::getRootDeviceEnvironment() const {
|
||||
return pClDevice->getRootDeviceEnvironment();
|
||||
}
|
||||
|
||||
template <typename HelperType>
|
||||
HelperType &ClDeviceFixture::getHelper() const {
|
||||
auto &helper = pClDevice->getRootDeviceEnvironment().getHelper<HelperType>();
|
||||
@ -50,5 +56,5 @@ HelperType &ClDeviceFixture::getHelper() const {
|
||||
|
||||
template ProductHelper &ClDeviceFixture::getHelper() const;
|
||||
template CoreHelper &ClDeviceFixture::getHelper() const;
|
||||
|
||||
template ClCoreHelper &ClDeviceFixture::getHelper() const;
|
||||
} // namespace NEO
|
||||
|
@ -31,6 +31,8 @@ struct ClDeviceFixture {
|
||||
OsContext *osContext = nullptr;
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
MockClExecutionEnvironment *pClExecutionEnvironment = nullptr;
|
||||
|
||||
const RootDeviceEnvironment &getRootDeviceEnvironment() const;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -12,16 +12,17 @@
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_hw_helper.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_platform.h"
|
||||
|
||||
#include "engine_node.h"
|
||||
|
||||
using HwHelperTestGen12Lp = HwHelperTest;
|
||||
using ClHwHelperTestsGen12Lp = Test<ClDeviceFixture>;
|
||||
|
||||
GEN12LPTEST_F(HwHelperTestGen12Lp, givenTglLpThenAuxTranslationIsRequired) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
GEN12LPTEST_F(ClHwHelperTestsGen12Lp, givenTglLpThenAuxTranslationIsRequired) {
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
|
||||
for (auto accessedUsingStatelessAddressingMode : {true, false}) {
|
||||
KernelInfo kernelInfo{};
|
||||
@ -30,10 +31,12 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, givenTglLpThenAuxTranslationIsRequired) {
|
||||
arg.as<ArgDescPointer>(true).accessedUsingStatelessAddressingMode = accessedUsingStatelessAddressingMode;
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.push_back(std::move(arg));
|
||||
|
||||
EXPECT_EQ(accessedUsingStatelessAddressingMode, clHwHelper.requiresAuxResolves(kernelInfo, hardwareInfo));
|
||||
EXPECT_EQ(accessedUsingStatelessAddressingMode, clCoreHelper.requiresAuxResolves(kernelInfo, getRootDeviceEnvironment()));
|
||||
}
|
||||
}
|
||||
|
||||
using HwHelperTestGen12Lp = HwHelperTest;
|
||||
|
||||
GEN12LPTEST_F(HwHelperTestGen12Lp, WhenGettingMaxBarriersPerSliceThenCorrectSizeIsReturned) {
|
||||
auto &helper = getHelper<CoreHelper>();
|
||||
EXPECT_EQ(32u, helper.getMaxBarrierRegisterPerSlice());
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "opencl/source/helpers/cl_helper.h"
|
||||
#include "opencl/source/helpers/cl_hw_helper.h"
|
||||
#include "opencl/source/mem_obj/image.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
|
||||
#include <array>
|
||||
@ -106,30 +107,29 @@ HWTEST_F(HwHelperTest, givenHwHelperWhenIsLinearStoragePreferredThenReturnValidV
|
||||
}
|
||||
}
|
||||
|
||||
using ClHwHelperTest = ::testing::Test;
|
||||
using ClHwHelperTest = Test<ClDeviceFixture>;
|
||||
HWTEST_F(ClHwHelperTest, givenKernelInfoWhenCheckingRequiresAuxResolvesThenCorrectValuesAreReturned) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
KernelInfo kernelInfo{};
|
||||
|
||||
ArgDescriptor argDescriptorValue(ArgDescriptor::ArgType::ArgTValue);
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptorValue);
|
||||
EXPECT_FALSE(clHwHelper.requiresAuxResolves(kernelInfo, hwInfo));
|
||||
EXPECT_FALSE(clCoreHelper.requiresAuxResolves(kernelInfo, getRootDeviceEnvironment()));
|
||||
|
||||
ArgDescriptor argDescriptorPointer(ArgDescriptor::ArgType::ArgTPointer);
|
||||
argDescriptorPointer.as<ArgDescPointer>().accessedUsingStatelessAddressingMode = true;
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.push_back(argDescriptorPointer);
|
||||
EXPECT_TRUE(clHwHelper.requiresAuxResolves(kernelInfo, hwInfo));
|
||||
EXPECT_TRUE(clCoreHelper.requiresAuxResolves(kernelInfo, getRootDeviceEnvironment()));
|
||||
}
|
||||
|
||||
TEST_F(ClHwHelperTest, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequireNonAuxMode) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
|
||||
for (auto isPureStateful : {false, true}) {
|
||||
ArgDescPointer argAsPtr{};
|
||||
argAsPtr.accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
|
||||
EXPECT_EQ(!argAsPtr.isPureStateful(), clHwHelper.requiresNonAuxMode(argAsPtr, *defaultHwInfo));
|
||||
EXPECT_EQ(!argAsPtr.isPureStateful(), clCoreHelper.requiresNonAuxMode(argAsPtr, getRootDeviceEnvironment()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2517,11 +2517,14 @@ TEST(KernelTest, givenFtrRenderCompressedBuffersWhenInitializingArgsWithNonState
|
||||
|
||||
capabilityTable.ftrRenderCompressedBuffers = true;
|
||||
kernel.mockKernel->initialize();
|
||||
EXPECT_EQ(ClHwHelper::get(hwInfo->platform.eRenderCoreFamily).requiresAuxResolves(kernel.kernelInfo, *hwInfo), kernel.mockKernel->isAuxTranslationRequired());
|
||||
|
||||
auto &rootDeviceEnvironment = device->getRootDeviceEnvironment();
|
||||
auto &clCoreHelper = rootDeviceEnvironment.getHelper<ClCoreHelper>();
|
||||
EXPECT_EQ(clCoreHelper.requiresAuxResolves(kernel.kernelInfo, rootDeviceEnvironment), kernel.mockKernel->isAuxTranslationRequired());
|
||||
|
||||
DebugManager.flags.ForceAuxTranslationEnabled.set(-1);
|
||||
kernel.mockKernel->initialize();
|
||||
EXPECT_EQ(ClHwHelper::get(hwInfo->platform.eRenderCoreFamily).requiresAuxResolves(kernel.kernelInfo, *hwInfo), kernel.mockKernel->isAuxTranslationRequired());
|
||||
EXPECT_EQ(clCoreHelper.requiresAuxResolves(kernel.kernelInfo, rootDeviceEnvironment), kernel.mockKernel->isAuxTranslationRequired());
|
||||
|
||||
DebugManager.flags.ForceAuxTranslationEnabled.set(0);
|
||||
kernel.mockKernel->initialize();
|
||||
@ -2544,7 +2547,10 @@ TEST(KernelTest, WhenAuxTranslationIsRequiredThenKernelSetsRequiredResolvesInCon
|
||||
|
||||
kernel.mockKernel->initialize();
|
||||
|
||||
if (ClHwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily).requiresAuxResolves(kernel.kernelInfo, *hwInfo)) {
|
||||
auto &rootDeviceEnvironment = device->getRootDeviceEnvironment();
|
||||
auto &clCoreHelper = rootDeviceEnvironment.getHelper<ClCoreHelper>();
|
||||
|
||||
if (clCoreHelper.requiresAuxResolves(kernel.kernelInfo, rootDeviceEnvironment)) {
|
||||
EXPECT_TRUE(context->getResolvesRequiredInKernels());
|
||||
} else {
|
||||
EXPECT_FALSE(context->getResolvesRequiredInKernels());
|
||||
@ -2587,7 +2593,10 @@ TEST(KernelTest, givenDebugVariableSetWhenKernelHasStatefulBufferAccessThenMarkK
|
||||
|
||||
kernel.mockKernel->initialize();
|
||||
|
||||
if (ClHwHelper::get(localHwInfo.platform.eRenderCoreFamily).requiresAuxResolves(kernel.kernelInfo, localHwInfo)) {
|
||||
auto &rootDeviceEnvironment = device->getRootDeviceEnvironment();
|
||||
auto &clCoreHelper = rootDeviceEnvironment.getHelper<ClCoreHelper>();
|
||||
|
||||
if (clCoreHelper.requiresAuxResolves(kernel.kernelInfo, rootDeviceEnvironment)) {
|
||||
EXPECT_TRUE(kernel.mockKernel->isAuxTranslationRequired());
|
||||
} else {
|
||||
EXPECT_FALSE(kernel.mockKernel->isAuxTranslationRequired());
|
||||
|
@ -31,11 +31,11 @@ bool TestChecks::supportsOcl21(const std::unique_ptr<HardwareInfo> &pHardwareInf
|
||||
pHardwareInfo->capabilityTable.supportsIndependentForwardProgress);
|
||||
}
|
||||
|
||||
bool TestChecks::supportsAuxResolves() {
|
||||
bool TestChecks::supportsAuxResolves(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
KernelInfo kernelInfo{};
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.resize(1);
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs[0].as<ArgDescPointer>(true).accessedUsingStatelessAddressingMode = true;
|
||||
|
||||
auto &clHwHelper = ClHwHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
|
||||
return clHwHelper.requiresAuxResolves(kernelInfo, *defaultHwInfo);
|
||||
auto &clCoreHelper = rootDeviceEnvironment.getHelper<ClCoreHelper>();
|
||||
return clCoreHelper.requiresAuxResolves(kernelInfo, rootDeviceEnvironment);
|
||||
}
|
||||
|
@ -13,13 +13,14 @@ namespace NEO {
|
||||
class ClDevice;
|
||||
class Context;
|
||||
struct HardwareInfo;
|
||||
struct RootDeviceEnvironment;
|
||||
|
||||
namespace TestChecks {
|
||||
bool supportsSvm(const ClDevice *pClDevice);
|
||||
bool supportsImages(const Context *pContext);
|
||||
bool supportsOcl21(const std::unique_ptr<HardwareInfo> &pHardwareInfo);
|
||||
bool supportsPipes(const ClDevice *pClDevice);
|
||||
bool supportsAuxResolves();
|
||||
bool supportsAuxResolves(const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
} // namespace TestChecks
|
||||
|
||||
} // namespace NEO
|
||||
@ -37,7 +38,7 @@ bool supportsAuxResolves();
|
||||
GTEST_SKIP(); \
|
||||
}
|
||||
|
||||
#define REQUIRE_AUX_RESOLVES() \
|
||||
if (NEO::TestChecks::supportsAuxResolves() == false) { \
|
||||
GTEST_SKIP(); \
|
||||
#define REQUIRE_AUX_RESOLVES(rootDeviceEnvironment) \
|
||||
if (NEO::TestChecks::supportsAuxResolves(rootDeviceEnvironment) == false) { \
|
||||
GTEST_SKIP(); \
|
||||
}
|
||||
|
@ -19,55 +19,58 @@
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_hw_helper.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
|
||||
|
||||
using HwHelperTestXE_HP_CORE = HwHelperTest;
|
||||
using ClHwHelperTestsXeHpCore = Test<ClDeviceFixture>;
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequireNonAuxMode) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
XE_HP_CORE_TEST_F(ClHwHelperTestsXeHpCore, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequireNonAuxMode) {
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
|
||||
for (auto isPureStateful : {false, true}) {
|
||||
ArgDescPointer argAsPtr{};
|
||||
argAsPtr.accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
|
||||
EXPECT_EQ(!argAsPtr.isPureStateful(), clHwHelper.requiresNonAuxMode(argAsPtr, *defaultHwInfo));
|
||||
EXPECT_EQ(!argAsPtr.isPureStateful(), clCoreHelper.requiresNonAuxMode(argAsPtr, getRootDeviceEnvironment()));
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenGenHelperWhenEnableStatelessCompressionThenDontRequireNonAuxMode) {
|
||||
XE_HP_CORE_TEST_F(ClHwHelperTestsXeHpCore, givenGenHelperWhenEnableStatelessCompressionThenDontRequireNonAuxMode) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableStatelessCompression.set(1);
|
||||
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
|
||||
for (auto isPureStateful : {false, true}) {
|
||||
ArgDescPointer argAsPtr{};
|
||||
argAsPtr.accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
EXPECT_FALSE(clHwHelper.requiresNonAuxMode(argAsPtr, *defaultHwInfo));
|
||||
EXPECT_FALSE(clCoreHelper.requiresNonAuxMode(argAsPtr, getRootDeviceEnvironment()));
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenXE_HP_COREThenAuxTranslationIsRequired) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
XE_HP_CORE_TEST_F(ClHwHelperTestsXeHpCore, givenXE_HP_COREThenAuxTranslationIsRequired) {
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
|
||||
for (auto isPureStateful : {false, true}) {
|
||||
KernelInfo kernelInfo{};
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.resize(1);
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs[0].as<ArgDescPointer>(true).accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
EXPECT_EQ(!isPureStateful, clHwHelper.requiresAuxResolves(kernelInfo, *defaultHwInfo));
|
||||
EXPECT_EQ(!isPureStateful, clCoreHelper.requiresAuxResolves(kernelInfo, getRootDeviceEnvironment()));
|
||||
}
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenXE_HP_COREWhenEnableStatelessCompressionThenAuxTranslationIsNotRequired) {
|
||||
XE_HP_CORE_TEST_F(ClHwHelperTestsXeHpCore, givenXE_HP_COREWhenEnableStatelessCompressionThenAuxTranslationIsNotRequired) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableStatelessCompression.set(1);
|
||||
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
KernelInfo kernelInfo{};
|
||||
|
||||
EXPECT_FALSE(clHwHelper.requiresAuxResolves(kernelInfo, *defaultHwInfo));
|
||||
EXPECT_FALSE(clCoreHelper.requiresAuxResolves(kernelInfo, getRootDeviceEnvironment()));
|
||||
}
|
||||
|
||||
using HwHelperTestXE_HP_CORE = HwHelperTest;
|
||||
|
||||
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenDifferentBufferSizesWhenEnableStatelessCompressionThenEveryBufferSizeIsSuitableForCompression) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableStatelessCompression.set(1);
|
||||
|
@ -27,10 +27,10 @@
|
||||
using HwHelperTestsXeHpcCore = Test<ClDeviceFixture>;
|
||||
|
||||
XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenXeHpcThenAuxTranslationIsNotRequired) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
KernelInfo kernelInfo{};
|
||||
|
||||
EXPECT_FALSE(clHwHelper.requiresAuxResolves(kernelInfo, *defaultHwInfo));
|
||||
EXPECT_FALSE(clCoreHelper.requiresAuxResolves(kernelInfo, getRootDeviceEnvironment()));
|
||||
}
|
||||
|
||||
XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenHwHelperwhenAskingForDcFlushThenReturnFalse) {
|
||||
|
@ -12,12 +12,13 @@
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/cl_device/cl_device.h"
|
||||
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h"
|
||||
#include "opencl/test/unit_test/mocks/mock_context.h"
|
||||
|
||||
#include "hw_cmds_xe_hpg_core_base.h"
|
||||
|
||||
using ClHwHelperTestsXeHpgCore = ::testing::Test;
|
||||
using ClHwHelperTestsXeHpgCore = Test<ClDeviceFixture>;
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
@ -30,13 +31,13 @@ XE_HPG_CORETEST_F(ClHwHelperTestsXeHpgCore, WhenGettingDeviceIpVersionThenMakeCo
|
||||
}
|
||||
|
||||
XE_HPG_CORETEST_F(ClHwHelperTestsXeHpgCore, givenGenHelperWhenKernelArgumentIsNotPureStatefulThenRequireNonAuxMode) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
|
||||
for (auto isPureStateful : ::testing::Bool()) {
|
||||
ArgDescPointer argAsPtr{};
|
||||
argAsPtr.accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
|
||||
EXPECT_EQ(!argAsPtr.isPureStateful(), clHwHelper.requiresNonAuxMode(argAsPtr, *defaultHwInfo));
|
||||
EXPECT_EQ(!argAsPtr.isPureStateful(), clCoreHelper.requiresNonAuxMode(argAsPtr, getRootDeviceEnvironment()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,23 +45,23 @@ XE_HPG_CORETEST_F(ClHwHelperTestsXeHpgCore, givenGenHelperWhenEnableStatelessCom
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableStatelessCompression.set(1);
|
||||
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
|
||||
for (auto isPureStateful : ::testing::Bool()) {
|
||||
ArgDescPointer argAsPtr{};
|
||||
argAsPtr.accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
EXPECT_FALSE(clHwHelper.requiresNonAuxMode(argAsPtr, *defaultHwInfo));
|
||||
EXPECT_FALSE(clCoreHelper.requiresNonAuxMode(argAsPtr, getRootDeviceEnvironment()));
|
||||
}
|
||||
}
|
||||
|
||||
XE_HPG_CORETEST_F(ClHwHelperTestsXeHpgCore, givenGenHelperWhenCheckAuxTranslationThenAuxResolvesIsRequired) {
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
|
||||
for (auto isPureStateful : ::testing::Bool()) {
|
||||
KernelInfo kernelInfo{};
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs.resize(1);
|
||||
kernelInfo.kernelDescriptor.payloadMappings.explicitArgs[0].as<ArgDescPointer>(true).accessedUsingStatelessAddressingMode = !isPureStateful;
|
||||
EXPECT_EQ(!isPureStateful, clHwHelper.requiresAuxResolves(kernelInfo, *defaultHwInfo));
|
||||
EXPECT_EQ(!isPureStateful, clCoreHelper.requiresAuxResolves(kernelInfo, getRootDeviceEnvironment()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,10 +69,10 @@ XE_HPG_CORETEST_F(ClHwHelperTestsXeHpgCore, givenGenHelperWhenEnableStatelessCom
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.EnableStatelessCompression.set(1);
|
||||
|
||||
auto &clHwHelper = ClHwHelper::get(renderCoreFamily);
|
||||
auto &clCoreHelper = getHelper<ClCoreHelper>();
|
||||
KernelInfo kernelInfo{};
|
||||
|
||||
EXPECT_FALSE(clHwHelper.requiresAuxResolves(kernelInfo, *defaultHwInfo));
|
||||
EXPECT_FALSE(clCoreHelper.requiresAuxResolves(kernelInfo, getRootDeviceEnvironment()));
|
||||
}
|
||||
|
||||
XE_HPG_CORETEST_F(ClHwHelperTestsXeHpgCore, givenDifferentCLImageFormatsWhenCallingAllowImageCompressionThenCorrectValueReturned) {
|
||||
|
Reference in New Issue
Block a user