Refactor isDirectSubmissionSupported

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2021-11-22 12:49:26 +00:00
committed by Compute-Runtime-Automation
parent 6893ca5ffa
commit fb376639ee
14 changed files with 57 additions and 43 deletions

View File

@ -286,27 +286,6 @@ XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenHwHelperWhenGettingThreadsPerEUCo
EXPECT_EQ(8U, configs[1]);
}
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, givenXeHpCoreHelperWhenCheckDirectSubmissionSupportedThenTrueIsReturned) {
HardwareInfo hwInfo = *defaultHwInfo;
auto &helper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
{
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hwInfo);
EXPECT_FALSE(helper.isDirectSubmissionSupported(hwInfo));
}
{
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A1, hwInfo);
EXPECT_FALSE(helper.isDirectSubmissionSupported(hwInfo));
}
{
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
EXPECT_TRUE(helper.isDirectSubmissionSupported(hwInfo));
}
}
XE_HP_CORE_TEST_F(HwHelperTestXE_HP_CORE, WhenGettingDeviceIpVersionThenMakeCorrectDeviceIpVersion) {
EXPECT_EQ(ClHwHelperMock::makeDeviceIpVersion(12, 5, 1), ClHwHelper::get(renderCoreFamily).getDeviceIpVersion(*defaultHwInfo));
}

View File

@ -29,6 +29,12 @@ DG2TEST_F(Dg2HwInfoConfig, givenHwInfoErrorneousConfigStringThenThrow) {
EXPECT_EQ(0u, gtSystemInfo.EUCount);
}
DG2TEST_F(Dg2HwInfoConfig, givenDg2HwInfoConfigWhenCheckDirectSubmissionSupportedThenTrueIsReturned) {
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
auto hwInfo = *defaultHwInfo;
EXPECT_TRUE(hwInfoConfig.isDirectSubmissionSupported(hwInfo));
}
DG2TEST_F(Dg2HwInfoConfig, givenHwInfoConfigWhenAdditionalKernelExecInfoSupportCheckedThenCorrectValueIsReturned) {
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
auto hwInfo = *defaultHwInfo;

View File

@ -119,7 +119,6 @@ class HwHelper {
virtual bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const = 0;
virtual bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const = 0;
virtual aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const = 0;
virtual uint32_t getDefaultRevisionId(const HardwareInfo &hwInfo) const = 0;
virtual uint32_t getNumCacheRegions() const = 0;
@ -332,8 +331,6 @@ class HwHelperHw : public HwHelper {
bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override;
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
bool isCopyOnlyEngineType(EngineGroupType type) const override;
bool isSipWANeeded(const HardwareInfo &hwInfo) const override;

View File

@ -625,11 +625,6 @@ bool HwHelperHw<GfxFamily>::isCooperativeEngineSupported(const HardwareInfo &hwI
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isCopyOnlyEngineType(EngineGroupType type) const {
return NEO::EngineGroupType::Copy == type;

View File

@ -62,6 +62,7 @@ class HwInfoConfig {
virtual bool isAllocationSizeAdjustmentRequired(const HardwareInfo &hwInfo) const = 0;
virtual bool isPrefetchDisablingRequired(const HardwareInfo &hwInfo) const = 0;
virtual bool isNewResidencyModelSupported() const = 0;
virtual bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs) const = 0;
virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0;
virtual void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) = 0;
@ -123,6 +124,7 @@ class HwInfoConfigHw : public HwInfoConfig {
bool isAllocationSizeAdjustmentRequired(const HardwareInfo &hwInfo) const override;
bool isPrefetchDisablingRequired(const HardwareInfo &hwInfo) const override;
bool isNewResidencyModelSupported() const override;
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
bool isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs) const override;
bool heapInLocalMem(const HardwareInfo &hwInfo) const override;
void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) override;

View File

@ -231,6 +231,11 @@ bool HwInfoConfigHw<gfxProduct>::imagePitchAlignmentWARequired(const HardwareInf
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
bool HwInfoConfigHw<gfxProduct>::isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo) const {
return false;

View File

@ -11,8 +11,8 @@
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/engine_node_helper.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/linux/drm_neo.h"
#include "shared/source/os_interface/os_context.h"
#include "shared/source/os_interface/os_interface.h"
@ -80,8 +80,8 @@ void OsContextLinux::initializeContext() {
}
bool OsContextLinux::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
return this->getDrm().isVmBindAvailable() && hwHelper.isDirectSubmissionSupported(hwInfo);
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
return this->getDrm().isVmBindAvailable() && hwInfoConfig->isDirectSubmissionSupported(hwInfo);
}
Drm &OsContextLinux::getDrm() const {

View File

@ -48,14 +48,6 @@ inline bool HwHelperHw<Family>::isSpecialWorkgroupSizeRequired(const HardwareInf
}
}
template <>
bool HwHelperHw<Family>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
if (hwInfo.platform.usRevId < HwInfoConfig::get(hwInfo.platform.eProductFamily)->getHwRevIdFromStepping(REVISION_B, hwInfo)) {
return false;
}
return true;
}
template <>
uint32_t HwHelperHw<Family>::computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) {
using SHARED_LOCAL_MEMORY_SIZE = typename Family::INTERFACE_DESCRIPTOR_DATA::SHARED_LOCAL_MEMORY_SIZE;

View File

@ -54,6 +54,14 @@ std::string HwInfoConfigHw<gfxProduct>::getDeviceMemoryName() const {
return "HBM";
}
template <>
bool HwInfoConfigHw<gfxProduct>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
if (hwInfo.platform.usRevId < HwInfoConfig::get(hwInfo.platform.eProductFamily)->getHwRevIdFromStepping(REVISION_B, hwInfo)) {
return false;
}
return true;
}
template <>
bool HwInfoConfigHw<gfxProduct>::isDisableOverdispatchAvailable(const HardwareInfo &hwInfo) const {
return getSteppingFromHwRevId(hwInfo) >= REVISION_B;

View File

@ -34,7 +34,7 @@ const PLATFORM DG2::platform = {
const RuntimeCapabilityTable DG2::capabilityTable{
EngineDirectSubmissionInitVec{
{aub_stream::ENGINE_RCS, {true, false, false, true}},
{aub_stream::ENGINE_RCS, {false, false, false, false}},
{aub_stream::ENGINE_CCS, {true, false, false, true}},
{aub_stream::ENGINE_CCS1, {true, false, true, true}},
{aub_stream::ENGINE_CCS2, {true, false, true, true}},

View File

@ -52,6 +52,11 @@ uint32_t HwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &
return CommonConstants::invalidStepping;
}
template <>
bool HwInfoConfigHw<gfxProduct>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
return true;
}
template <>
bool HwInfoConfigHw<gfxProduct>::isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const {
uint32_t stepping = getSteppingFromHwRevId(hwInfo);

View File

@ -148,6 +148,11 @@ bool HwInfoConfigHw<IGFX_UNKNOWN>::allowStatelessCompression(const HardwareInfo
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
return false;
}
template <>
LocalMemoryAccessMode HwInfoConfigHw<IGFX_UNKNOWN>::getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
return LocalMemoryAccessMode::Default;

View File

@ -52,6 +52,26 @@ XEHPTEST_F(TestXeHPHwInfoConfig, givenHwInfoConfigWhenRevisionIsAtLeastBThenAllo
}
}
XEHPTEST_F(TestXeHPHwInfoConfig, givenXeHpCoreHwInfoConfigWhenCheckDirectSubmissionSupportedThenTrueIsReturned) {
auto hwInfo = *defaultHwInfo;
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
{
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hwInfo);
EXPECT_FALSE(hwInfoConfig.isDirectSubmissionSupported(hwInfo));
}
{
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A1, hwInfo);
EXPECT_FALSE(hwInfoConfig.isDirectSubmissionSupported(hwInfo));
}
{
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
EXPECT_TRUE(hwInfoConfig.isDirectSubmissionSupported(hwInfo));
}
}
XEHPTEST_F(TestXeHPHwInfoConfig, givenHwInfoConfigWhenCreateMultipleSubDevicesThenDontAllowStatelessCompression) {
DebugManagerStateRestore restore;
DebugManager.flags.CreateMultipleSubDevices.set(2);

View File

@ -172,8 +172,8 @@ HWTEST_F(DrmDirectSubmissionTest, givenDisabledMonitorFenceWhenUpdateTagValueThe
HWTEST_F(DrmDirectSubmissionTest, whenCheckForDirectSubmissionSupportThenProperValueIsReturned) {
auto directSubmissionSupported = osContext->isDirectSubmissionSupported(device->getHardwareInfo());
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
EXPECT_EQ(directSubmissionSupported, hwHelper.isDirectSubmissionSupported(device->getHardwareInfo()) && executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>()->isVmBindAvailable());
auto hwInfoConfig = HwInfoConfig::get(device->getHardwareInfo().platform.eProductFamily);
EXPECT_EQ(directSubmissionSupported, hwInfoConfig->isDirectSubmissionSupported(device->getHardwareInfo()) && executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>()->isVmBindAvailable());
}
HWTEST_F(DrmDirectSubmissionTest, givenDirectSubmissionNewResourceTlbFlushWhenDispatchCommandBufferThenTlbIsFlushed) {