fix: define isDirectSubmissionSupported per HW release

Related-To: NEO-8187
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2023-09-20 13:08:46 +00:00 committed by Compute-Runtime-Automation
parent 9bb559d468
commit 3b2c41e5ee
32 changed files with 69 additions and 51 deletions

View File

@ -839,7 +839,7 @@ const CompilerProductHelper &Device::getCompilerProductHelper() const {
return getRootDeviceEnvironment().getHelper<CompilerProductHelper>();
}
const ReleaseHelper *Device::getReleaseHelper() const {
ReleaseHelper *Device::getReleaseHelper() const {
return getRootDeviceEnvironment().getReleaseHelper();
}

View File

@ -159,7 +159,7 @@ class Device : public ReferenceTrackedObject<Device> {
const GfxCoreHelper &getGfxCoreHelper() const;
const ProductHelper &getProductHelper() const;
const CompilerProductHelper &getCompilerProductHelper() const;
const ReleaseHelper *getReleaseHelper() const;
ReleaseHelper *getReleaseHelper() const;
uint32_t getNumberOfRegularContextsPerEngine() const { return numberOfRegularContextsPerEngine; }
bool isMultiRegularContextSelectionAllowed(aub_stream::EngineType engineType, EngineUsage engineUsage) const;

View File

@ -79,10 +79,11 @@ bool OsContextLinux::initializeContext() {
return true;
}
bool OsContextLinux::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
auto &productHelper = this->getDrm().getRootDeviceEnvironment().getHelper<ProductHelper>();
bool OsContextLinux::isDirectSubmissionSupported() const {
auto &rootDeviceEnvironment = this->getDrm().getRootDeviceEnvironment();
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
return this->getDrm().isVmBindAvailable() && productHelper.isDirectSubmissionSupported(hwInfo);
return this->getDrm().isVmBindAvailable() && productHelper.isDirectSubmissionSupported(rootDeviceEnvironment.getReleaseHelper());
}
Drm &OsContextLinux::getDrm() const {

View File

@ -27,7 +27,7 @@ class OsContextLinux : public OsContext {
void setEngineFlag(unsigned int engineFlag) { this->engineFlag = engineFlag; }
const std::vector<uint32_t> &getDrmContextIds() const { return drmContextIds; }
const std::vector<uint32_t> &getDrmVmIds() const { return drmVmIds; }
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
bool isDirectSubmissionSupported() const override;
Drm &getDrm() const;
void waitForPagingFence();
static OsContext *create(OSInterface *osInterface, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor);

View File

@ -65,7 +65,7 @@ bool OsContext::ensureContextInitialized() {
}
bool OsContext::isDirectSubmissionAvailable(const HardwareInfo &hwInfo, bool &submitOnInit) {
bool enableDirectSubmission = this->isDirectSubmissionSupported(hwInfo);
bool enableDirectSubmission = this->isDirectSubmissionSupported();
if (DebugManager.flags.SetCommandStreamReceiver.get() > 0) {
enableDirectSubmission = false;

View File

@ -40,7 +40,7 @@ class OsContext : public ReferenceTrackedObject<OsContext> {
bool isCooperativeEngine() const { return engineUsage == EngineUsage::Cooperative; }
bool isRootDevice() const { return rootDevice; }
bool isEngineInstanced() const { return engineInstancedDevice; }
virtual bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const { return false; }
virtual bool isDirectSubmissionSupported() const { return false; }
bool isDefaultContext() const { return defaultContext; }
void setDefaultContext(bool value) { defaultContext = value; }
bool isDirectSubmissionActive() { return directSubmissionActive; }

View File

@ -102,7 +102,7 @@ class ProductHelper {
virtual LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
virtual bool isAllocationSizeAdjustmentRequired(const HardwareInfo &hwInfo) const = 0;
virtual bool isNewResidencyModelSupported() const = 0;
virtual bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const = 0;
virtual bool isDirectSubmissionConstantCacheInvalidationNeeded(const HardwareInfo &hwInfo) const = 0;
virtual std::pair<bool, bool> isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs, const ReleaseHelper *releaseHelper) const = 0;
virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0;

View File

@ -333,7 +333,10 @@ bool ProductHelperHw<gfxProduct>::imagePitchAlignmentWARequired(const HardwareIn
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const {
if (releaseHelper) {
return releaseHelper->isDirectSubmissionSupported();
}
return false;
}

View File

@ -55,7 +55,7 @@ class ProductHelperHw : public ProductHelper {
LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
bool isAllocationSizeAdjustmentRequired(const HardwareInfo &hwInfo) const override;
bool isNewResidencyModelSupported() const override;
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
bool isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const override;
bool isDirectSubmissionConstantCacheInvalidationNeeded(const HardwareInfo &hwInfo) const override;
std::pair<bool, bool> isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs, const ReleaseHelper *releaseHelper) const override;
bool heapInLocalMem(const HardwareInfo &hwInfo) const override;

View File

@ -91,11 +91,12 @@ uint64_t OsContextWin::getOfflineDumpContextId(uint32_t deviceIndex) const {
return 0;
}
bool OsContextWin::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
auto &productHelper = wddm.getRootDeviceEnvironment().getHelper<ProductHelper>();
auto isWSL = wddm.getRootDeviceEnvironment().isWddmOnLinux();
bool OsContextWin::isDirectSubmissionSupported() const {
auto &rootDeviceEnvironment = wddm.getRootDeviceEnvironment();
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
auto isWSL = rootDeviceEnvironment.isWddmOnLinux();
return !isWSL && wddm.getWddmVersion() == WddmVersion::WDDM_2_0 && productHelper.isDirectSubmissionSupported(hwInfo);
return !isWSL && wddm.getWddmVersion() == WddmVersion::WDDM_2_0 && productHelper.isDirectSubmissionSupported(rootDeviceEnvironment.getReleaseHelper());
}
OsContextWin::~OsContextWin() {

View File

@ -31,7 +31,7 @@ class OsContextWin : public OsContext {
void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; }
HardwareQueue getHwQueue() const { return hardwareQueue; }
void setHwQueue(HardwareQueue hardwareQueue) { this->hardwareQueue = hardwareQueue; }
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
bool isDirectSubmissionSupported() const override;
Wddm *getWddm() const { return &wddm; }
MOCKABLE_VIRTUAL WddmResidencyController &getResidencyController() { return residencyController; }
static OsContext *create(OSInterface *osInterface, uint32_t rootDeviceIndex, uint32_t contextId, const EngineDescriptor &engineDescriptor);

View File

@ -39,6 +39,7 @@ class ReleaseHelper {
virtual bool isResolvingSubDeviceIDNeeded() const = 0;
virtual bool isCachingOnCpuAvailable() const = 0;
virtual bool shouldAdjustDepth() const = 0;
virtual bool isDirectSubmissionSupported() const = 0;
virtual std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const = 0;
protected:
@ -65,6 +66,7 @@ class ReleaseHelperHw : public ReleaseHelper {
bool isResolvingSubDeviceIDNeeded() const override;
bool isCachingOnCpuAvailable() const override;
bool shouldAdjustDepth() const override;
bool isDirectSubmissionSupported() const override;
std::optional<GfxMemoryAllocationMethod> getPreferredAllocationMethod(AllocationType allocationType) const override;
protected:

View File

@ -72,4 +72,9 @@ template <ReleaseType releaseType>
bool ReleaseHelperHw<releaseType>::shouldAdjustDepth() const {
return false;
}
template <ReleaseType releaseType>
bool ReleaseHelperHw<releaseType>::isDirectSubmissionSupported() const {
return false;
}
} // namespace NEO

View File

@ -24,4 +24,9 @@ bool ReleaseHelperHw<release>::isBFloat16ConversionSupported() const {
return true;
}
template <>
bool ReleaseHelperHw<release>::isDirectSubmissionSupported() const {
return true;
}
} // namespace NEO

View File

@ -31,4 +31,9 @@ bool ReleaseHelperHw<release>::isCachingOnCpuAvailable() const {
return false;
}
template <>
bool ReleaseHelperHw<release>::isDirectSubmissionSupported() const {
return true;
}
} // namespace NEO

View File

@ -12,7 +12,7 @@ std::string ProductHelperHw<gfxProduct>::getDeviceMemoryName() const {
}
template <>
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const {
return true;
}

View File

@ -26,11 +26,6 @@ constexpr static auto gfxProduct = IGFX_DG2;
namespace NEO {
template <>
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
return true;
}
template <>
int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const {
if (allowCompression(*hwInfo)) {

View File

@ -12,11 +12,4 @@ constexpr static auto gfxProduct = IGFX_METEORLAKE;
#include "shared/source/xe_hpg_core/xe_lpg/linux/product_helper_xe_lpg_linux.inl"
#include "shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl"
namespace NEO {
template <>
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
return true;
}
} // namespace NEO
template class NEO::ProductHelperHw<gfxProduct>;

View File

@ -24,6 +24,11 @@ constexpr static auto gfxProduct = IGFX_DG2;
namespace NEO {
template <>
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const {
return false;
}
template <>
bool ProductHelperHw<gfxProduct>::getUuid(NEO::DriverModel *driverModel, uint32_t subDeviceCount, uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const {

View File

@ -12,11 +12,4 @@ constexpr static auto gfxProduct = IGFX_METEORLAKE;
#include "shared/source/xe_hpg_core/xe_lpg/os_agnostic_product_helper_xe_lpg.inl"
#include "shared/source/xe_hpg_core/xe_lpg/windows/product_helper_xe_lpg_windows.inl"
namespace NEO {
template <>
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
return true;
}
} // namespace NEO
template class NEO::ProductHelperHw<gfxProduct>;

View File

@ -161,7 +161,7 @@ bool ProductHelperHw<IGFX_UNKNOWN>::allowCompression(const HardwareInfo &hwInfo)
}
template <>
bool ProductHelperHw<IGFX_UNKNOWN>::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
bool ProductHelperHw<IGFX_UNKNOWN>::isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const {
return false;
}

View File

@ -6,7 +6,6 @@
*/
#pragma once
#include "shared/source/memory_manager/allocation_type.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/test/common/test_macros/mock_method_macros.h"
@ -26,6 +25,7 @@ class MockReleaseHelper : public ReleaseHelper {
ADDMETHOD_CONST_NOBASE(isResolvingSubDeviceIDNeeded, bool, false, ());
ADDMETHOD_CONST_NOBASE(isCachingOnCpuAvailable, bool, false, ());
ADDMETHOD_CONST_NOBASE(shouldAdjustDepth, bool, false, ());
ADDMETHOD_CONST_NOBASE(getPreferredAllocationMethod, std::optional<GfxMemoryAllocationMethod>, GfxMemoryAllocationMethod::NotDefined;, (AllocationType allocationType));
ADDMETHOD_CONST_NOBASE(isDirectSubmissionSupported, bool, false, ());
ADDMETHOD_CONST_NOBASE(getPreferredAllocationMethod, std::optional<GfxMemoryAllocationMethod>, std::nullopt, (AllocationType allocationType));
};
} // namespace NEO

View File

@ -672,10 +672,10 @@ HWTEST_F(DrmDirectSubmissionTest, givenDisabledMonitorFenceWhenUpdateTagValueThe
}
HWTEST_F(DrmDirectSubmissionTest, whenCheckForDirectSubmissionSupportThenProperValueIsReturned) {
auto directSubmissionSupported = osContext->isDirectSubmissionSupported(device->getHardwareInfo());
auto directSubmissionSupported = osContext->isDirectSubmissionSupported();
auto &productHelper = device->getProductHelper();
EXPECT_EQ(directSubmissionSupported, productHelper.isDirectSubmissionSupported(device->getHardwareInfo()) && executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>()->isVmBindAvailable());
EXPECT_EQ(directSubmissionSupported, productHelper.isDirectSubmissionSupported(device->getReleaseHelper()) && executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>()->isVmBindAvailable());
}
HWTEST_F(DrmDirectSubmissionTest, givenDirectSubmissionNewResourceTlbFlushWhenDispatchCommandBufferThenTlbIsFlushed) {

View File

@ -75,10 +75,9 @@ TEST_F(OsContextWinTest, givenOsContextWinWhenQueryingForOfflineDumpContextIdThe
}
TEST_F(OsContextWinTest, givenWddm20AndProductSupportDirectSubmissionThenDirectSubmissionIsSupported) {
auto &hwInfo = *this->rootDeviceEnvironment->getHardwareInfo();
auto &productHelper = this->rootDeviceEnvironment->getHelper<ProductHelper>();
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engineTypeUsage, preemptionMode));
EXPECT_EQ(productHelper.isDirectSubmissionSupported(hwInfo), osContext->isDirectSubmissionSupported(hwInfo));
EXPECT_EQ(productHelper.isDirectSubmissionSupported(this->rootDeviceEnvironment->getReleaseHelper()), osContext->isDirectSubmissionSupported());
}
TEST_F(OsContextWinTest, givenWddm23ThenDirectSubmissionIsNotSupported) {
@ -88,7 +87,7 @@ TEST_F(OsContextWinTest, givenWddm23ThenDirectSubmissionIsNotSupported) {
auto wddm = static_cast<WddmMock *>(osInterface->getDriverModel()->as<Wddm>());
wddm->featureTable.get()->flags.ftrWddmHwQueues = 1;
osContext = std::make_unique<OsContextWin>(*wddm, 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engineTypeUsage, preemptionMode));
EXPECT_FALSE(osContext->isDirectSubmissionSupported(*this->rootDeviceEnvironment->getHardwareInfo()));
EXPECT_FALSE(osContext->isDirectSubmissionSupported());
}
TEST_F(OsContextWinTest, givenWddmOnLinuxThenDirectSubmissionIsNotSupported) {
@ -97,7 +96,7 @@ TEST_F(OsContextWinTest, givenWddmOnLinuxThenDirectSubmissionIsNotSupported) {
};
static_cast<MockRootDeviceEnvironment *>(this->rootDeviceEnvironment)->isWddmOnLinuxEnable = true;
osContext = std::make_unique<OsContextWin>(*osInterface->getDriverModel()->as<Wddm>(), 0, 0u, EngineDescriptorHelper::getDefaultDescriptor(engineTypeUsage, preemptionMode));
EXPECT_FALSE(osContext->isDirectSubmissionSupported(*this->rootDeviceEnvironment->getHardwareInfo()));
EXPECT_FALSE(osContext->isDirectSubmissionSupported());
}
struct OsContextWinTestNoCleanup : public WddmTestWithMockGdiDllNoCleanup {

View File

@ -32,6 +32,7 @@ TEST_F(ReleaseHelper1255Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_TRUE(releaseHelper->isBFloat16ConversionSupported());
EXPECT_TRUE(releaseHelper->isResolvingSubDeviceIDNeeded());
EXPECT_TRUE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
}
}

View File

@ -32,6 +32,7 @@ TEST_F(ReleaseHelper1256Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_TRUE(releaseHelper->isBFloat16ConversionSupported());
EXPECT_TRUE(releaseHelper->isResolvingSubDeviceIDNeeded());
EXPECT_TRUE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
}
}

View File

@ -32,6 +32,7 @@ TEST_F(ReleaseHelper1257Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_TRUE(releaseHelper->isBFloat16ConversionSupported());
EXPECT_TRUE(releaseHelper->isResolvingSubDeviceIDNeeded());
EXPECT_TRUE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
}
}

View File

@ -33,6 +33,7 @@ TEST_F(ReleaseHelper1270Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_FALSE(releaseHelper->isBFloat16ConversionSupported());
EXPECT_TRUE(releaseHelper->isResolvingSubDeviceIDNeeded());
EXPECT_FALSE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
}
}

View File

@ -33,6 +33,7 @@ TEST_F(ReleaseHelper1271Tests, whenGettingCapabilitiesThenCorrectPropertiesAreRe
EXPECT_FALSE(releaseHelper->isBFloat16ConversionSupported());
EXPECT_TRUE(releaseHelper->isResolvingSubDeviceIDNeeded());
EXPECT_FALSE(releaseHelper->isCachingOnCpuAvailable());
EXPECT_TRUE(releaseHelper->isDirectSubmissionSupported());
}
}

View File

@ -169,8 +169,7 @@ PVCTEST_F(PvcProductHelper, givenProductHelperWhenAskedIfPipeControlPriorToNonPi
}
PVCTEST_F(PvcProductHelper, givenPvcProductHelperWhenCheckDirectSubmissionSupportedThenTrueIsReturned) {
auto hwInfo = *defaultHwInfo;
EXPECT_TRUE(productHelper->isDirectSubmissionSupported(hwInfo));
EXPECT_TRUE(productHelper->isDirectSubmissionSupported(releaseHelper));
}
PVCTEST_F(PvcProductHelper, givenPvcProductHelperWhenCheckDirectSubmissionConstantCacheInvalidationNeededThenFalseIsReturned) {

View File

@ -31,7 +31,7 @@ DG2TEST_F(Dg2ProductHelperLinux, WhenConfiguringHwInfoThenZeroIsReturned) {
}
DG2TEST_F(Dg2ProductHelperLinux, givenProductHelperWhenCheckDirectSubmissionSupportedThenTrueIsReturned) {
EXPECT_TRUE(productHelper->isDirectSubmissionSupported(pInHwInfo));
EXPECT_TRUE(productHelper->isDirectSubmissionSupported(releaseHelper));
}
DG2TEST_F(Dg2ProductHelperLinux, GivenDg2WhenConfigureHardwareCustomThenKmdNotifyIsEnabled) {

View File

@ -27,9 +27,12 @@ struct XeLpgProductHelperTests : public ::Test<DeviceFixture> {
::Test<DeviceFixture>::SetUp();
productHelper = &pDevice->getProductHelper();
gfxCoreHelper = &pDevice->getGfxCoreHelper();
ASSERT_NE(nullptr, pDevice->getReleaseHelper());
releaseHelper = pDevice->getReleaseHelper();
}
ProductHelper const *productHelper = nullptr;
GfxCoreHelper const *gfxCoreHelper = nullptr;
ReleaseHelper *releaseHelper = nullptr;
const ProductHelper *productHelper = nullptr;
const GfxCoreHelper *gfxCoreHelper = nullptr;
};
using XeLpgHwInfoTests = ::testing::Test;
@ -326,3 +329,7 @@ HWTEST2_F(XeLpgProductHelperTests, givenCompilerProductHelperWhenGetDefaultHwIpV
auto compilerProductHelper = CompilerProductHelper::create(hwInfo.platform.eProductFamily);
EXPECT_EQ(compilerProductHelper->getDefaultHwIpVersion(), AOT::MTL_M_A0);
}
HWTEST2_F(XeLpgProductHelperTests, whenCheckDirectSubmissionSupportedThenValueFromReleaseHelperIsReturned, IsXeLpg) {
EXPECT_EQ(productHelper->isDirectSubmissionSupported(releaseHelper), releaseHelper->isDirectSubmissionSupported());
}