mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 00:24:58 +08:00
Add immediate extension to new residency model
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
a414a3524d
commit
083f8ae02c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -24,7 +24,11 @@ inline std::unique_ptr<DirectSubmissionHw<GfxFamily, Dispatcher>> DirectSubmissi
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(Device &device,
|
||||
OsContext &osContext)
|
||||
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext){};
|
||||
: DirectSubmissionHw<GfxFamily, Dispatcher>(device, osContext) {
|
||||
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
|
||||
osContextLinux->getDrm().setDirectSubmissionActive(true);
|
||||
};
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
inline DrmDirectSubmission<GfxFamily, Dispatcher>::~DrmDirectSubmission() {
|
||||
@@ -55,6 +59,8 @@ bool DrmDirectSubmission<GfxFamily, Dispatcher>::submit(uint64_t gpuAddress, siz
|
||||
|
||||
drm_i915_gem_exec_object2 execObject{};
|
||||
|
||||
this->handleResidency();
|
||||
|
||||
bool ret = false;
|
||||
uint32_t drmContextId = 0u;
|
||||
for (auto drmIterator = 0u; drmIterator < osContextLinux->getDeviceBitfield().size(); drmIterator++) {
|
||||
@@ -78,6 +84,8 @@ bool DrmDirectSubmission<GfxFamily, Dispatcher>::submit(uint64_t gpuAddress, siz
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
bool DrmDirectSubmission<GfxFamily, Dispatcher>::handleResidency() {
|
||||
auto osContextLinux = static_cast<OsContextLinux *>(&this->osContext);
|
||||
osContextLinux->waitForPagingFence();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ constexpr const char *getIoctlParamString(int param) {
|
||||
} // namespace IoctlHelper
|
||||
|
||||
Drm::Drm(std::unique_ptr<HwDeviceId> hwDeviceIdIn, RootDeviceEnvironment &rootDeviceEnvironment) : hwDeviceId(std::move(hwDeviceIdIn)), rootDeviceEnvironment(rootDeviceEnvironment) {
|
||||
pagingFence.fill(0u);
|
||||
fenceVal.fill(0u);
|
||||
}
|
||||
|
||||
int Drm::ioctl(unsigned long request, void *arg) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "shared/source/utilities/stackvec.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
#include "engine_limits.h"
|
||||
#include "engine_node.h"
|
||||
#include "igfxfmid.h"
|
||||
|
||||
@@ -125,6 +126,9 @@ class Drm {
|
||||
bool isContextDebugSupported() { return contextDebugSupported; }
|
||||
MOCKABLE_VIRTUAL void setContextDebugFlag(uint32_t drmContextId);
|
||||
|
||||
void setDirectSubmissionActive(bool value) { this->directSubmissionActive = value; }
|
||||
bool isDirectSubmissionActive() { return this->directSubmissionActive; }
|
||||
|
||||
MOCKABLE_VIRTUAL bool isVmBindAvailable();
|
||||
MOCKABLE_VIRTUAL bool registerResourceClasses();
|
||||
|
||||
@@ -169,6 +173,10 @@ class Drm {
|
||||
return hwDeviceId->getPciPath();
|
||||
}
|
||||
|
||||
void waitForBind(uint32_t vmHandleId);
|
||||
uint64_t getNextFenceVal(uint32_t vmHandleId) { return ++fenceVal[vmHandleId]; }
|
||||
uint64_t *getFenceAddr(uint32_t vmHandleId) { return &pagingFence[vmHandleId]; }
|
||||
|
||||
protected:
|
||||
int getQueueSliceCount(drm_i915_gem_context_param_sseu *sseu);
|
||||
bool translateTopologyInfo(const drm_i915_query_topology_info *queryTopologyInfo, int &sliceCount, int &subSliceCount, int &euCount);
|
||||
@@ -180,6 +188,7 @@ class Drm {
|
||||
bool nonPersistentContextsSupported = false;
|
||||
bool requirePerContextVM = false;
|
||||
bool bindAvailable = false;
|
||||
bool directSubmissionActive = false;
|
||||
bool contextDebugSupported = false;
|
||||
std::once_flag checkBindOnce;
|
||||
std::unique_ptr<HwDeviceId> hwDeviceId;
|
||||
@@ -196,6 +205,9 @@ class Drm {
|
||||
std::unique_ptr<MemoryInfo> memoryInfo;
|
||||
std::vector<uint32_t> virtualMemoryIds;
|
||||
|
||||
std::array<uint64_t, EngineLimits::maxHandleCount> pagingFence;
|
||||
std::array<uint64_t, EngineLimits::maxHandleCount> fenceVal;
|
||||
|
||||
std::string getSysFsPciPath();
|
||||
std::unique_ptr<uint8_t[]> query(uint32_t queryId, uint32_t queryItemFlags, int32_t &length);
|
||||
|
||||
|
||||
@@ -63,6 +63,9 @@ int Drm::unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObj
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Drm::waitForBind(uint32_t vmHandleId) {
|
||||
}
|
||||
|
||||
bool Drm::isVmBindAvailable() {
|
||||
return this->bindAvailable;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,9 @@ int Drm::unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObj
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Drm::waitForBind(uint32_t vmHandleId) {
|
||||
}
|
||||
|
||||
bool Drm::isVmBindAvailable() {
|
||||
return this->bindAvailable;
|
||||
}
|
||||
|
||||
@@ -64,6 +64,14 @@ Drm &OsContextLinux::getDrm() const {
|
||||
return this->drm;
|
||||
}
|
||||
|
||||
void OsContextLinux::waitForPagingFence() {
|
||||
for (auto drmIterator = 0u; drmIterator < this->deviceBitfield.size(); drmIterator++) {
|
||||
if (this->deviceBitfield.test(drmIterator)) {
|
||||
drm.waitForBind(drmIterator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OsContextLinux::~OsContextLinux() {
|
||||
for (auto drmContextId : drmContextIds) {
|
||||
drm.destroyDrmContext(drmContextId);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -26,6 +26,7 @@ class OsContextLinux : public OsContext {
|
||||
const std::vector<uint32_t> &getDrmContextIds() const { return drmContextIds; }
|
||||
const std::vector<uint32_t> &getDrmVmIds() const { return drmVmIds; }
|
||||
Drm &getDrm() const;
|
||||
void waitForPagingFence();
|
||||
|
||||
protected:
|
||||
unsigned int engineFlag = 0;
|
||||
|
||||
@@ -88,9 +88,9 @@ HWTEST_F(DrmDirectSubmissionTest, givenDrmDirectSubmissionWhenDestructObjectThen
|
||||
auto drmDirectSubmission = std::make_unique<MockDrmDirectSubmission<FamilyType, RenderDispatcher<FamilyType>>>(*device.get(),
|
||||
*osContext.get());
|
||||
auto drm = static_cast<DrmMock *>(executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->getDrm());
|
||||
drm->ioctlCallsCount = 0u;
|
||||
drmDirectSubmission->initialize(true);
|
||||
drm->ioctlCallsCount = 0u;
|
||||
drmDirectSubmission.reset();
|
||||
|
||||
EXPECT_EQ(drm->ioctlCallsCount, 11u);
|
||||
EXPECT_EQ(drm->ioctlCallsCount, 7u);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user