Move obtainBlitterPreference function from HwHelper to HwInfoConfig

Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
Related-To: NEO-4541
This commit is contained in:
Rafal Maziejuk
2021-08-17 12:00:35 +00:00
committed by Compute-Runtime-Automation
parent f88ac7ce56
commit 63a578f5a4
15 changed files with 53 additions and 28 deletions

View File

@@ -12,6 +12,7 @@
#include "shared/source/helpers/timestamp_packet.h"
#include "shared/source/memory_manager/internal_allocation_storage.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/helpers/variable_backup.h"
@@ -1144,7 +1145,7 @@ TEST(CommandQueue, givenBlitterOperationsSupportedWhenCreatingQueueThenTimestamp
MockContext context{};
HardwareInfo *hwInfo = context.getDevice(0)->getRootDeviceEnvironment().getMutableHardwareInfo();
if (!HwHelper::get(hwInfo->platform.eDisplayCoreFamily).obtainBlitterPreference(*hwInfo)) {
if (!HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->obtainBlitterPreference(*defaultHwInfo.get())) {
GTEST_SKIP();
}

View File

@@ -93,12 +93,6 @@ DG1TEST_F(HwHelperTestDg1, givenDg1WhenSteppingB0ThenIntegerDivisionEmulationIsN
EXPECT_FALSE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
}
DG1TEST_F(HwHelperTestDg1, givenDg1WhenObtainingBlitterPreferenceThenReturnFalse) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_FALSE(helper.obtainBlitterPreference(hardwareInfo));
}
DG1TEST_F(HwHelperTestDg1, givenDg1WhenGettingLocalMemoryAccessModeThenReturnCpuAccessDefault) {
struct MockHwHelper : HwHelperHw<FamilyType> {
using HwHelper::getDefaultLocalMemoryAccessMode;

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
@@ -78,3 +79,10 @@ DG1TEST_F(Dg1HwInfo, whenPlatformIsDg1ThenExpectSvmIsSet) {
const HardwareInfo &hardwareInfo = DG1::hwInfo;
EXPECT_TRUE(hardwareInfo.capabilityTable.ftrSvm);
}
DG1TEST_F(Dg1HwInfo, givenDg1WhenObtainingBlitterPreferenceThenReturnFalse) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
const auto &hardwareInfo = DG1::hwInfo;
EXPECT_FALSE(hwInfoConfig.obtainBlitterPreference(hardwareInfo));
}

View File

@@ -81,12 +81,6 @@ TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpAndVariousSteppingsWhenGettingIsWorka
}
}
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpWhenObtainingBlitterPreferenceThenReturnFalse) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_FALSE(helper.obtainBlitterPreference(hardwareInfo));
}
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpWhenGettingLocalMemoryAccessModeThenReturnCpuAccessDefault) {
struct MockHwHelper : HwHelperHw<FamilyType> {
using HwHelper::getDefaultLocalMemoryAccessMode;

View File

@@ -6,6 +6,7 @@
*/
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
@@ -164,3 +165,10 @@ TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeWhenPrepareDevice
memoryOperationHandlers.insert(memoryOperationInterface);
}
}
TGLLPTEST_F(TgllpHwInfo, givenTgllpWhenObtainingBlitterPreferenceThenReturnFalse) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
const auto &hardwareInfo = *defaultHwInfo;
EXPECT_FALSE(hwInfoConfig.obtainBlitterPreference(hardwareInfo));
}

View File

@@ -1131,7 +1131,7 @@ HWTEST2_F(HwInfoConfigCommonTest, givenBlitterPreferenceWhenEnablingBlitterOpera
hwInfoConfig->configureHardwareCustom(&hardwareInfo, nullptr);
const auto expectedBlitterSupport = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily).obtainBlitterPreference(hardwareInfo);
const auto expectedBlitterSupport = hwInfoConfig->obtainBlitterPreference(hardwareInfo);
EXPECT_EQ(expectedBlitterSupport, hardwareInfo.capabilityTable.blitterOperationsSupported);
}

View File

@@ -111,6 +111,11 @@ uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getMaxThreadsForWorkgroup(const HardwareI
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) {}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return false;
}
} // namespace NEO
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
@@ -626,3 +631,8 @@ HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwI
EXPECT_EQ(0, ret);
EXPECT_EQ(8u, outHwInfo.gtSystemInfo.MaxEuPerSubSlice);
}
HWTEST_F(HwInfoConfigTestLinuxDummy, givenHardwareInfoWhenCallingObtainBlitterPreferenceThenFalseIsReturned) {
bool ret = hwConfig.obtainBlitterPreference(outHwInfo);
EXPECT_FALSE(ret);
}

View File

@@ -90,6 +90,11 @@ uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getMaxThreadsForWorkgroup(const HardwareI
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) {}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return false;
}
HwInfoConfigTestWindows::HwInfoConfigTestWindows() {
this->executionEnvironment = std::make_unique<MockExecutionEnvironment>();
this->rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
@@ -167,4 +172,9 @@ HWTEST_F(HwInfoConfigTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoTh
EXPECT_EQ(initialCoherencyStatus, outHwInfo.capabilityTable.ftrSupportsCoherency);
}
HWTEST_F(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingObtainBlitterPreferenceThenFalseIsReturned) {
bool ret = hwConfig.obtainBlitterPreference(outHwInfo);
EXPECT_FALSE(ret);
}
} // namespace NEO

View File

@@ -68,7 +68,6 @@ class HwHelper {
virtual bool hvAlign4Required() const = 0;
virtual bool preferSmallWorkgroupSizeForKernel(const size_t size, const HardwareInfo &hwInfo) const = 0;
virtual bool isBufferSizeSuitableForRenderCompression(const size_t size, const HardwareInfo &hwInfo) const = 0;
virtual bool obtainBlitterPreference(const HardwareInfo &hwInfo) const = 0;
virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0;
virtual bool allowRenderCompression(const HardwareInfo &hwInfo) const = 0;
virtual bool allowStatelessCompression(const HardwareInfo &hwInfo) const = 0;
@@ -236,8 +235,6 @@ class HwHelperHw : public HwHelper {
bool isBufferSizeSuitableForRenderCompression(const size_t size, const HardwareInfo &hwInfo) const override;
bool obtainBlitterPreference(const HardwareInfo &hwInfo) const override;
bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) override;
bool timestampPacketWriteSupported() const override;

View File

@@ -50,11 +50,6 @@ bool HwHelperHw<GfxFamily>::timestampPacketWriteSupported() const {
return false;
}
template <typename Family>
bool HwHelperHw<Family>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return false;
}
template <typename GfxFamily>
const HwHelper::EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
return {

View File

@@ -64,11 +64,6 @@ bool HwHelperHw<GfxFamily>::timestampPacketWriteSupported() const {
return true;
}
template <typename Family>
bool HwHelperHw<Family>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return true;
}
template <typename GfxFamily>
const HwHelper::EngineInstancesContainer HwHelperHw<GfxFamily>::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const {
auto defaultEngine = getChosenEngineType(hwInfo);

View File

@@ -44,6 +44,8 @@ class HwInfoConfig {
virtual uint32_t getMaxThreadsForWorkgroupInDSSOrSS(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice, uint32_t maxNumEUsPerDualSubSlice) const = 0;
virtual uint32_t getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const = 0;
virtual void setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) = 0;
virtual bool obtainBlitterPreference(const HardwareInfo &hwInfo) const = 0;
uint32_t threadsPerEu;
};
@@ -70,6 +72,7 @@ class HwInfoConfigHw : public HwInfoConfig {
uint32_t getMaxThreadsForWorkgroupInDSSOrSS(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice, uint32_t maxNumEUsPerDualSubSlice) const override;
uint32_t getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const override;
void setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) override;
bool obtainBlitterPreference(const HardwareInfo &hwInfo) const override;
protected:
HwInfoConfigHw() = default;

View File

@@ -42,7 +42,7 @@ void HwInfoConfigHw<gfxProduct>::adjustSamplerState(void *sampler, const Hardwar
template <PRODUCT_FAMILY gfxProduct>
void HwInfoConfigHw<gfxProduct>::enableBlitterOperationsSupport(HardwareInfo *hwInfo) {
hwInfo->capabilityTable.blitterOperationsSupported = HwHelper::get(hwInfo->platform.eRenderCoreFamily).obtainBlitterPreference(*hwInfo);
hwInfo->capabilityTable.blitterOperationsSupported = obtainBlitterPreference(*hwInfo);
if (DebugManager.flags.EnableBlitterOperationsSupport.get() != -1) {
hwInfo->capabilityTable.blitterOperationsSupported = !!DebugManager.flags.EnableBlitterOperationsSupport.get();

View File

@@ -30,4 +30,9 @@ uint32_t HwInfoConfigHw<gfxProduct>::getMaxThreadsForWorkgroupInDSSOrSS(const Ha
return getMaxThreadsForWorkgroup(hwInfo, maxNumEUsPerSubSlice);
}
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return false;
}
} // namespace NEO

View File

@@ -32,4 +32,9 @@ uint32_t HwInfoConfigHw<gfxProduct>::getMaxThreadsForWorkgroupInDSSOrSS(const Ha
return getMaxThreadsForWorkgroup(hwInfo, maxNumEUsPerDualSubSlice);
}
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return true;
}
} // namespace NEO