Move isMidThreadPreemptionSupported helper to hwHelper

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2021-09-07 16:07:23 +00:00
committed by Compute-Runtime-Automation
parent 361a35e8a2
commit ae88789bce
12 changed files with 34 additions and 28 deletions

View File

@@ -1046,6 +1046,19 @@ HWTEST2_F(HwHelperTest, givenDefaultHwHelperHwWhenGettingIsBlitCopyRequiredForLo
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(*defaultHwInfo, graphicsAllocation)); EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(*defaultHwInfo, graphicsAllocation));
} }
HWTEST_F(HwHelperTest, whenIsMidThreadPreemptionSupportedIsCalledThenCorrectResultIsReturned) {
auto hwInfo = *defaultHwInfo;
const auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt = true;
auto midThreadPreemptionSupported = hwHelper.isMidThreadPreemptionSupported(hwInfo);
EXPECT_TRUE(midThreadPreemptionSupported);
hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt = false;
midThreadPreemptionSupported = hwHelper.isMidThreadPreemptionSupported(hwInfo);
EXPECT_FALSE(midThreadPreemptionSupported);
}
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, WhenIsFusedEuDispatchEnabledIsCalledThenFalseIsReturned) { HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, WhenIsFusedEuDispatchEnabledIsCalledThenFalseIsReturned) {
if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) { if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
GTEST_SKIP(); GTEST_SKIP();

View File

@@ -162,19 +162,6 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenAskedForPageTableManagerSupportT
EXPECT_EQ(hwInfoConfig.isPageTableManagerSupported(pInHwInfo), UnitTestHelper<FamilyType>::isPageTableManagerSupported(pInHwInfo)); EXPECT_EQ(hwInfoConfig.isPageTableManagerSupported(pInHwInfo), UnitTestHelper<FamilyType>::isPageTableManagerSupported(pInHwInfo));
} }
HWTEST_F(HwInfoConfigTest, whenIsMidThreadPreemptionSupportedIsCalledThenCorrectResultIsReturned) {
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);
auto hwInfo = pInHwInfo;
hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt = true;
auto midThreadPreemptionSupported = hwInfoConfig.isMidThreadPreemptionSupported(hwInfo);
EXPECT_TRUE(midThreadPreemptionSupported);
hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt = false;
midThreadPreemptionSupported = hwInfoConfig.isMidThreadPreemptionSupported(hwInfo);
EXPECT_FALSE(midThreadPreemptionSupported);
}
HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConversionIsCorrect) { HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConversionIsCorrect) {
const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily); const auto &hwInfoConfig = *HwInfoConfig::get(pInHwInfo.platform.eProductFamily);

View File

@@ -11,6 +11,7 @@
#include "shared/source/os_interface/os_interface.h" #include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "opencl/extensions/public/cl_ext_private.h" #include "opencl/extensions/public/cl_ext_private.h"
@@ -311,13 +312,16 @@ TEST_F(HwInfoConfigTestLinuxDummy, whenConfigureHwInfoIsCalledAndPersitentContex
EXPECT_FALSE(drm->areNonPersistentContextsSupported()); EXPECT_FALSE(drm->areNonPersistentContextsSupported());
} }
TEST_F(HwInfoConfigTestLinuxDummy, GivenPreemptionDrmEnabledMidThreadOnWhenConfiguringHwInfoThenPreemptionIsSupported) { HWTEST_F(HwInfoConfigTestLinuxDummy, GivenPreemptionDrmEnabledMidThreadOnWhenConfiguringHwInfoThenPreemptionIsSupported) {
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread; pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
drm->storedPreemptionSupport = drm->storedPreemptionSupport =
I915_SCHEDULER_CAP_ENABLED | I915_SCHEDULER_CAP_ENABLED |
I915_SCHEDULER_CAP_PRIORITY | I915_SCHEDULER_CAP_PRIORITY |
I915_SCHEDULER_CAP_PREEMPTION; I915_SCHEDULER_CAP_PREEMPTION;
drm->storedDeviceID = hwConfigTestMidThreadBit; drm->storedDeviceID = hwConfigTestMidThreadBit;
UnitTestHelper<FamilyType>::setExtraMidThreadPreemptionFlag(pInHwInfo);
int ret = hwConfig.configureHwInfoDrm(&pInHwInfo, &outHwInfo, osInterface); int ret = hwConfig.configureHwInfoDrm(&pInHwInfo, &outHwInfo, osInterface);
EXPECT_EQ(0, ret); EXPECT_EQ(0, ret);
EXPECT_EQ(PreemptionMode::MidThread, outHwInfo.capabilityTable.defaultPreemptionMode); EXPECT_EQ(PreemptionMode::MidThread, outHwInfo.capabilityTable.defaultPreemptionMode);

View File

@@ -141,6 +141,7 @@ class HwHelper {
virtual uint32_t getPlanarYuvMaxHeight() const = 0; virtual uint32_t getPlanarYuvMaxHeight() const = 0;
virtual bool isBlitterForImagesSupported(const HardwareInfo &hwInfo) const = 0; virtual bool isBlitterForImagesSupported(const HardwareInfo &hwInfo) const = 0;
virtual size_t getPreemptionAllocationAlignment() const = 0; virtual size_t getPreemptionAllocationAlignment() const = 0;
virtual bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const = 0;
virtual std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator(const std::vector<uint32_t> &rootDeviceIndices, MemoryManager *memoryManager, virtual std::unique_ptr<TagAllocatorBase> createTimestampPacketAllocator(const std::vector<uint32_t> &rootDeviceIndices, MemoryManager *memoryManager,
size_t initialTagCount, CommandStreamReceiverType csrType, size_t initialTagCount, CommandStreamReceiverType csrType,
DeviceBitfield deviceBitfield) const = 0; DeviceBitfield deviceBitfield) const = 0;
@@ -382,6 +383,8 @@ class HwHelperHw : public HwHelper {
bool additionalPipeControlArgsRequired() const override; bool additionalPipeControlArgsRequired() const override;
bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const override;
bool isEngineTypeRemappingToHwSpecificRequired() const override; bool isEngineTypeRemappingToHwSpecificRequired() const override;
bool isSipKernelAsHexadecimalArrayPreferred() const override; bool isSipKernelAsHexadecimalArrayPreferred() const override;

View File

@@ -651,6 +651,11 @@ bool HwHelperHw<GfxFamily>::isEngineTypeRemappingToHwSpecificRequired() const {
return false; return false;
} }
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const {
return static_cast<bool>(hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt);
}
template <typename GfxFamily> template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isSipKernelAsHexadecimalArrayPreferred() const { bool HwHelperHw<GfxFamily>::isSipKernelAsHexadecimalArrayPreferred() const {
return false; return false;

View File

@@ -40,7 +40,6 @@ class HwInfoConfig {
virtual uint64_t getSharedSystemMemCapabilities() = 0; virtual uint64_t getSharedSystemMemCapabilities() = 0;
virtual void convertTimestampsFromOaToCsDomain(uint64_t &timestampData) = 0; virtual void convertTimestampsFromOaToCsDomain(uint64_t &timestampData) = 0;
virtual uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) = 0; virtual uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) = 0;
virtual bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const = 0; virtual bool isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const = 0;
virtual bool isMaxThreadsForWorkgroupWARequired(const HardwareInfo &hwInfo) const = 0; virtual bool isMaxThreadsForWorkgroupWARequired(const HardwareInfo &hwInfo) const = 0;
virtual uint32_t getMaxThreadsForWorkgroupInDSSOrSS(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice, uint32_t maxNumEUsPerDualSubSlice) const = 0; virtual uint32_t getMaxThreadsForWorkgroupInDSSOrSS(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice, uint32_t maxNumEUsPerDualSubSlice) const = 0;
@@ -78,7 +77,6 @@ class HwInfoConfigHw : public HwInfoConfig {
void convertTimestampsFromOaToCsDomain(uint64_t &timestampData) override; void convertTimestampsFromOaToCsDomain(uint64_t &timestampData) override;
uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) override; uint32_t getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) override;
bool isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const override; bool isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const override;
bool isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const override;
bool isMaxThreadsForWorkgroupWARequired(const HardwareInfo &hwInfo) const override; bool isMaxThreadsForWorkgroupWARequired(const HardwareInfo &hwInfo) const override;
uint32_t getMaxThreadsForWorkgroupInDSSOrSS(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice, uint32_t maxNumEUsPerDualSubSlice) const override; 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; uint32_t getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const override;

View File

@@ -96,11 +96,6 @@ uint32_t HwInfoConfigHw<gfxProduct>::getMaxThreadsForWorkgroup(const HardwareInf
return maxNumEUsPerSubSlice * numThreadsPerEU; return maxNumEUsPerSubSlice * numThreadsPerEU;
} }
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const {
return static_cast<bool>(hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt);
}
template <PRODUCT_FAMILY gfxProduct> template <PRODUCT_FAMILY gfxProduct>
void HwInfoConfigHw<gfxProduct>::setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) {} void HwInfoConfigHw<gfxProduct>::setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) {}

View File

@@ -176,7 +176,7 @@ int HwInfoConfig::configureHwInfoDrm(const HardwareInfo *inHwInfo, HardwareInfo
drm->checkPreemptionSupport(); drm->checkPreemptionSupport();
bool preemption = drm->isPreemptionSupported(); bool preemption = drm->isPreemptionSupported();
PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable, PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable,
isMidThreadPreemptionSupported(*outHwInfo) && preemption, hwHelper.isMidThreadPreemptionSupported(*outHwInfo) && preemption,
static_cast<bool>(outHwInfo->featureTable.ftrGpGpuThreadGroupLevelPreempt) && preemption, static_cast<bool>(outHwInfo->featureTable.ftrGpGpuThreadGroupLevelPreempt) && preemption,
static_cast<bool>(outHwInfo->featureTable.ftrGpGpuMidBatchPreempt) && preemption); static_cast<bool>(outHwInfo->featureTable.ftrGpGpuMidBatchPreempt) && preemption);

View File

@@ -28,7 +28,7 @@ int HwInfoConfig::configureHwInfoWddm(const HardwareInfo *inHwInfo, HardwareInfo
outHwInfo->capabilityTable.ftrSupportsCoherency &= inHwInfo->featureTable.ftrL3IACoherency; outHwInfo->capabilityTable.ftrSupportsCoherency &= inHwInfo->featureTable.ftrL3IACoherency;
PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable, PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable,
isMidThreadPreemptionSupported(*outHwInfo), hwHelper.isMidThreadPreemptionSupported(*outHwInfo),
static_cast<bool>(outHwInfo->featureTable.ftrGpGpuThreadGroupLevelPreempt), static_cast<bool>(outHwInfo->featureTable.ftrGpGpuThreadGroupLevelPreempt),
static_cast<bool>(outHwInfo->featureTable.ftrGpGpuMidBatchPreempt)); static_cast<bool>(outHwInfo->featureTable.ftrGpGpuMidBatchPreempt));

View File

@@ -49,6 +49,8 @@ struct UnitTestHelper {
static bool requiresTimestampPacketsInSystemMemory(); static bool requiresTimestampPacketsInSystemMemory();
static void setExtraMidThreadPreemptionFlag(HardwareInfo &hwInfo);
static const bool tiledImagesSupported; static const bool tiledImagesSupported;
static const uint32_t smallestTestableSimdSize; static const uint32_t smallestTestableSimdSize;

View File

@@ -80,6 +80,10 @@ inline bool UnitTestHelper<GfxFamily>::requiresTimestampPacketsInSystemMemory()
return true; return true;
} }
template <typename GfxFamily>
void UnitTestHelper<GfxFamily>::setExtraMidThreadPreemptionFlag(HardwareInfo &hwInfo) {
}
template <typename GfxFamily> template <typename GfxFamily>
auto UnitTestHelper<GfxFamily>::getCoherencyTypeSupported(COHERENCY_TYPE coherencyType) -> decltype(coherencyType) { auto UnitTestHelper<GfxFamily>::getCoherencyTypeSupported(COHERENCY_TYPE coherencyType) -> decltype(coherencyType) {
return coherencyType; return coherencyType;

View File

@@ -13,11 +13,6 @@ template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) { void HwInfoConfigHw<IGFX_UNKNOWN>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
} }
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isMidThreadPreemptionSupported(const HardwareInfo &hwInfo) const {
return static_cast<bool>(hwInfo.featureTable.ftrGpGpuMidThreadLevelPreempt);
}
template <> template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::convertTimestampsFromOaToCsDomain(uint64_t &timestampData) { void HwInfoConfigHw<IGFX_UNKNOWN>::convertTimestampsFromOaToCsDomain(uint64_t &timestampData) {
} }