mirror of
https://github.com/intel/compute-runtime.git
synced 2025-11-10 05:49:51 +08:00
Track new resource bound per VM
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
3e6b3cd780
commit
a3d970ee24
@@ -118,6 +118,9 @@ class DrmCommandStreamEnhancedTemplate : public ::testing::Test {
|
||||
*executionEnvironment);
|
||||
ASSERT_NE(nullptr, mm);
|
||||
executionEnvironment->memoryManager.reset(mm);
|
||||
constructPlatform()->peekExecutionEnvironment()->prepareRootDeviceEnvironments(1u);
|
||||
constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
|
||||
constructPlatform()->peekExecutionEnvironment()->initializeMemoryManager();
|
||||
device.reset(MockDevice::create<MockDevice>(executionEnvironment, rootDeviceIndex));
|
||||
device->resetCommandStreamReceiver(csr);
|
||||
ASSERT_NE(nullptr, device);
|
||||
|
||||
@@ -93,7 +93,7 @@ bool DrmDirectSubmission<GfxFamily, Dispatcher>::handleResidency() {
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
bool DrmDirectSubmission<GfxFamily, Dispatcher>::isNewResourceHandleNeeded() {
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
|
||||
auto newResourcesBound = osContextLinux->getDrm().getNewResourceBound();
|
||||
auto newResourcesBound = osContextLinux->getNewResourceBound();
|
||||
|
||||
if (DebugManager.flags.DirectSubmissionNewResourceTlbFlush.get() != -1) {
|
||||
newResourcesBound = DebugManager.flags.DirectSubmissionNewResourceTlbFlush.get();
|
||||
@@ -109,9 +109,7 @@ void DrmDirectSubmission<GfxFamily, Dispatcher>::handleNewResourcesSubmission()
|
||||
}
|
||||
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
|
||||
if (!EngineHelpers::isBcs(osContextLinux->getEngineType())) {
|
||||
osContextLinux->getDrm().setNewResourceBound(false);
|
||||
}
|
||||
osContextLinux->setNewResourceBound(false);
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "shared/source/os_interface/linux/drm_gem_close_worker.h"
|
||||
#include "shared/source/os_interface/linux/drm_memory_manager.h"
|
||||
#include "shared/source/os_interface/linux/hw_device_id.h"
|
||||
#include "shared/source/os_interface/linux/os_context_linux.h"
|
||||
#include "shared/source/os_interface/linux/os_inc.h"
|
||||
#include "shared/source/os_interface/linux/pci_path.h"
|
||||
#include "shared/source/os_interface/linux/sys_calls.h"
|
||||
@@ -639,6 +640,19 @@ uint32_t Drm::getVirtualMemoryAddressSpace(uint32_t vmId) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Drm::setNewResourceBoundToVM(uint32_t vmHandleId) {
|
||||
const auto &engines = this->rootDeviceEnvironment.executionEnvironment.memoryManager->getRegisteredEngines();
|
||||
for (const auto &engine : engines) {
|
||||
if (engine.osContext->getDeviceBitfield().test(vmHandleId)) {
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(engine.osContext);
|
||||
|
||||
if (&osContextLinux->getDrm() == this) {
|
||||
osContextLinux->setNewResourceBound(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Drm::translateTopologyInfo(const drm_i915_query_topology_info *queryTopologyInfo, QueryTopologyData &data, TopologyMapping &mapping) {
|
||||
int sliceCount = 0;
|
||||
int subSliceCount = 0;
|
||||
|
||||
@@ -223,8 +223,7 @@ class Drm : public DriverModel {
|
||||
};
|
||||
MOCKABLE_VIRTUAL int waitUserFence(uint32_t ctxId, uint64_t address, uint64_t value, ValueWidth dataWidth, int64_t timeout, uint16_t flags);
|
||||
|
||||
void setNewResourceBound(bool value) { this->newResourceBound = value; };
|
||||
bool getNewResourceBound() { return this->newResourceBound; };
|
||||
void setNewResourceBoundToVM(uint32_t vmHandleId);
|
||||
|
||||
const std::vector<int> &getSliceMappings(uint32_t deviceIndex);
|
||||
const TopologyMap &getTopologyMap();
|
||||
@@ -312,7 +311,6 @@ class Drm : public DriverModel {
|
||||
bool bindAvailable = false;
|
||||
bool directSubmissionActive = false;
|
||||
bool contextDebugSupported = false;
|
||||
bool newResourceBound = false;
|
||||
|
||||
private:
|
||||
int getParamIoctl(int param, int *dstValue);
|
||||
|
||||
@@ -23,6 +23,8 @@ 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; }
|
||||
void setNewResourceBound(bool value) { this->newResourceBound = value; };
|
||||
bool getNewResourceBound() { return this->newResourceBound; };
|
||||
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
|
||||
Drm &getDrm() const;
|
||||
void waitForPagingFence();
|
||||
@@ -32,6 +34,7 @@ class OsContextLinux : public OsContext {
|
||||
void initializeContext() override;
|
||||
|
||||
unsigned int engineFlag = 0;
|
||||
bool newResourceBound = false;
|
||||
std::vector<uint32_t> drmContextIds;
|
||||
std::vector<uint32_t> drmVmIds;
|
||||
Drm &drm;
|
||||
|
||||
@@ -204,8 +204,7 @@ HWTEST_F(DrmDirectSubmissionTest, givenNewResourceBoundhWhenDispatchCommandBuffe
|
||||
bool ret = directSubmission.allocateResources();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
auto drm = static_cast<DrmMock *>(executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>());
|
||||
drm->setNewResourceBound(true);
|
||||
osContext->setNewResourceBound(true);
|
||||
|
||||
EXPECT_EQ(directSubmission.getSizeNewResourceHandler(), sizeof(PIPE_CONTROL));
|
||||
|
||||
@@ -218,12 +217,12 @@ HWTEST_F(DrmDirectSubmissionTest, givenNewResourceBoundhWhenDispatchCommandBuffe
|
||||
auto *pipeControl = hwParse.getCommand<PIPE_CONTROL>();
|
||||
EXPECT_TRUE(pipeControl->getTlbInvalidate());
|
||||
EXPECT_TRUE(pipeControl->getTextureCacheInvalidationEnable());
|
||||
EXPECT_FALSE(drm->getNewResourceBound());
|
||||
EXPECT_FALSE(osContext->getNewResourceBound());
|
||||
|
||||
EXPECT_EQ(directSubmission.getSizeNewResourceHandler(), 0u);
|
||||
}
|
||||
|
||||
HWTEST_F(DrmDirectSubmissionTest, givennoNewResourceBoundhWhenDispatchCommandBufferThenTlbIsNotFlushed) {
|
||||
HWTEST_F(DrmDirectSubmissionTest, givenNoNewResourceBoundhWhenDispatchCommandBufferThenTlbIsNotFlushed) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
using Dispatcher = RenderDispatcher<FamilyType>;
|
||||
|
||||
@@ -236,8 +235,7 @@ HWTEST_F(DrmDirectSubmissionTest, givennoNewResourceBoundhWhenDispatchCommandBuf
|
||||
bool ret = directSubmission.allocateResources();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
auto drm = static_cast<DrmMock *>(executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>());
|
||||
drm->setNewResourceBound(false);
|
||||
osContext->setNewResourceBound(false);
|
||||
|
||||
EXPECT_EQ(directSubmission.getSizeNewResourceHandler(), 0u);
|
||||
|
||||
@@ -249,7 +247,7 @@ HWTEST_F(DrmDirectSubmissionTest, givennoNewResourceBoundhWhenDispatchCommandBuf
|
||||
hwParse.findHardwareCommands<FamilyType>();
|
||||
auto *pipeControl = hwParse.getCommand<PIPE_CONTROL>();
|
||||
EXPECT_EQ(pipeControl, nullptr);
|
||||
EXPECT_FALSE(drm->getNewResourceBound());
|
||||
EXPECT_FALSE(osContext->getNewResourceBound());
|
||||
|
||||
EXPECT_EQ(directSubmission.getSizeNewResourceHandler(), 0u);
|
||||
}
|
||||
@@ -267,8 +265,7 @@ HWTEST_F(DrmDirectSubmissionTest, givenDirectSubmissionNewResourceTlbFlusZeroAnd
|
||||
bool ret = directSubmission.allocateResources();
|
||||
EXPECT_TRUE(ret);
|
||||
|
||||
auto drm = static_cast<DrmMock *>(executionEnvironment.rootDeviceEnvironments[0]->osInterface->getDriverModel()->as<Drm>());
|
||||
drm->setNewResourceBound(true);
|
||||
osContext->setNewResourceBound(true);
|
||||
|
||||
EXPECT_EQ(directSubmission.getSizeNewResourceHandler(), 0u);
|
||||
|
||||
@@ -280,7 +277,7 @@ HWTEST_F(DrmDirectSubmissionTest, givenDirectSubmissionNewResourceTlbFlusZeroAnd
|
||||
hwParse.findHardwareCommands<FamilyType>();
|
||||
auto *pipeControl = hwParse.getCommand<PIPE_CONTROL>();
|
||||
EXPECT_EQ(pipeControl, nullptr);
|
||||
EXPECT_FALSE(drm->getNewResourceBound());
|
||||
EXPECT_FALSE(osContext->getNewResourceBound());
|
||||
|
||||
EXPECT_EQ(directSubmission.getSizeNewResourceHandler(), 0u);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user