mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Add infrastructure to enable direct submission
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
889f1d0ae5
commit
1921bfb3dc
@@ -136,6 +136,7 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
|
||||
{
|
||||
OsContextLinux osContext1(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false);
|
||||
@@ -158,6 +159,7 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
|
||||
TEST(DrmTest, whenCreatingDrmContextWithVirtualMemoryAddressSpaceThenProperVmIdIsSet) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
ASSERT_EQ(1u, drmMock.virtualMemoryIds.size());
|
||||
@@ -170,6 +172,7 @@ TEST(DrmTest, whenCreatingDrmContextWithVirtualMemoryAddressSpaceThenProperVmIdI
|
||||
TEST(DrmTest, whenCreatingDrmContextWithNoVirtualMemoryAddressSpaceThenProperContextIdIsSet) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drmMock.destroyVirtualMemoryAddressSpace();
|
||||
|
||||
@@ -184,6 +187,7 @@ TEST(DrmTest, whenCreatingDrmContextWithNoVirtualMemoryAddressSpaceThenProperCon
|
||||
TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextIsCreatedThenReceivedContextParamRequestCountReturnsCorrectValue) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto expectedCount = 0u;
|
||||
|
||||
@@ -207,6 +211,7 @@ TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextI
|
||||
TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContextThenCallSetContextPriorityIoctl) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
drmMock.preemptionSupported = false;
|
||||
|
||||
@@ -231,6 +236,7 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext
|
||||
TEST(DrmTest, givenDirectSubmissionEnabledOnBlitterWhenCreateBcsEngineThenLowPriorityIsSet) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false);
|
||||
@@ -254,6 +260,7 @@ TEST(DrmTest, givenDirectSubmissionEnabledOnBlitterWhenCreateBcsEngineThenLowPri
|
||||
TEST(DrmTest, givenDirectSubmissionEnabledOnBlitterAndDirectSubmissionLowPriorityBlitterSetZeroWhenCreateBcsEngineThenLowPriorityIsNotSet) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false);
|
||||
@@ -452,6 +459,7 @@ TEST(HwDeviceId, whenHwDeviceIdIsDestroyedThenFileDescriptorIsClosed) {
|
||||
TEST(DrmTest, givenDrmWhenCreatingOsContextThenCreateDrmContextWithVmId) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
OsContextLinux osContext(drmMock, 0u, 1, EngineTypeUsage{aub_stream::ENGINE_RCS, EngineUsage::Regular}, PreemptionMode::Disabled, false);
|
||||
|
||||
@@ -497,6 +505,7 @@ TEST(DrmTest, givenDrmWithPerContextVMRequiredWhenCreatingOsContextsThenImplicit
|
||||
TEST(DrmTest, givenNoPerContextVmsDrmWhenCreatingOsContextsThenVmIdIsNotQueriedAndStored) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
|
||||
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
EXPECT_FALSE(drmMock.requirePerContextVM);
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ class HwHelper {
|
||||
virtual bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isNewResidencyModelSupported() const = 0;
|
||||
virtual bool isDirectSubmissionSupported() 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 HardwareInfo &hwInfo) const = 0;
|
||||
@@ -333,6 +334,8 @@ class HwHelperHw : public HwHelper {
|
||||
|
||||
bool isNewResidencyModelSupported() const override;
|
||||
|
||||
bool isDirectSubmissionSupported() const override;
|
||||
|
||||
bool isCopyOnlyEngineType(EngineGroupType type) const override;
|
||||
|
||||
void adjustAddressWidthForCanonize(uint32_t &addressWidth) const override;
|
||||
|
||||
@@ -560,6 +560,11 @@ bool HwHelperHw<GfxFamily>::isNewResidencyModelSupported() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isDirectSubmissionSupported() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isCopyOnlyEngineType(EngineGroupType type) const {
|
||||
return NEO::EngineGroupType::Copy == type;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#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/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/os_interface.h"
|
||||
@@ -77,6 +78,11 @@ OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield devi
|
||||
}
|
||||
}
|
||||
|
||||
bool OsContextLinux::isDirectSubmissionSupported(const HardwareInfo &hwInfo) const {
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
return this->getDrm().isVmBindAvailable() && hwHelper.isDirectSubmissionSupported();
|
||||
}
|
||||
|
||||
Drm &OsContextLinux::getDrm() const {
|
||||
return this->drm;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ class OsContextLinux : public OsContext {
|
||||
unsigned int getEngineFlag() const { return 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;
|
||||
Drm &getDrm() const;
|
||||
void waitForPagingFence();
|
||||
|
||||
|
||||
@@ -14,7 +14,13 @@
|
||||
|
||||
namespace NEO {
|
||||
bool OsContext::isDirectSubmissionAvailable(const HardwareInfo &hwInfo, bool &submitOnInit) {
|
||||
if (DebugManager.flags.EnableDirectSubmission.get() == 1) {
|
||||
bool enableDirectSubmission = this->isDirectSubmissionSupported(hwInfo);
|
||||
|
||||
if (DebugManager.flags.EnableDirectSubmission.get() != -1) {
|
||||
enableDirectSubmission = DebugManager.flags.EnableDirectSubmission.get();
|
||||
}
|
||||
|
||||
if (enableDirectSubmission) {
|
||||
auto contextEngineType = this->getEngineType();
|
||||
const DirectSubmissionProperties &directSubmissionProperty =
|
||||
hwInfo.capabilityTable.directSubmissionEngines.data[contextEngineType];
|
||||
|
||||
@@ -36,6 +36,7 @@ class OsContext : public ReferenceTrackedObject<OsContext> {
|
||||
bool isInternalEngine() const { return engineUsage == EngineUsage::Internal; }
|
||||
bool isRootDevice() const { return rootDevice; }
|
||||
virtual bool isInitialized() const { return true; }
|
||||
virtual bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const { return false; }
|
||||
bool isDefaultContext() const { return defaultContext; }
|
||||
void setDefaultContext(bool value) { defaultContext = value; }
|
||||
bool isDirectSubmissionActive() { return directSubmissionActive; }
|
||||
|
||||
@@ -94,3 +94,10 @@ HWTEST_F(DrmDirectSubmissionTest, givenDrmDirectSubmissionWhenDestructObjectThen
|
||||
|
||||
EXPECT_EQ(drm->ioctlCallsCount, 3u);
|
||||
}
|
||||
|
||||
HWTEST_F(DrmDirectSubmissionTest, whenCheckForDirectSubmissionSupportThenProperValueIsReturned) {
|
||||
auto directSubmissionSupported = osContext->isDirectSubmissionSupported(device->getHardwareInfo());
|
||||
|
||||
auto &hwHelper = HwHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily);
|
||||
EXPECT_EQ(directSubmissionSupported, hwHelper.isDirectSubmissionSupported() && executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->getDrm()->isVmBindAvailable());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user