fix: Set vmbind user fence when makeMemoryResident

Related-To: NEO-11977, GSD-10293

Signed-off-by: Chandio, Bibrak Qamar <bibrak.qamar.chandio@intel.com>
This commit is contained in:
Chandio, Bibrak Qamar
2025-02-05 06:40:13 +00:00
committed by Compute-Runtime-Automation
parent 18d7a22861
commit 7149743162
50 changed files with 619 additions and 339 deletions

View File

@@ -20,7 +20,7 @@ WddmMemoryOperationsHandler::WddmMemoryOperationsHandler(Wddm *wddm) : wddm(wddm
WddmMemoryOperationsHandler::~WddmMemoryOperationsHandler() = default;
MemoryOperationsStatus WddmMemoryOperationsHandler::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) {
MemoryOperationsStatus WddmMemoryOperationsHandler::makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) {
uint32_t totalHandlesCount = 0;
constexpr uint32_t stackAllocations = 64;
constexpr uint32_t stackHandlesCount = NEO::maxFragmentsCount * EngineLimits::maxHandleCount * stackAllocations;
@@ -45,7 +45,7 @@ MemoryOperationsStatus WddmMemoryOperationsHandler::makeResident(Device *device,
totalHandlesCount += wddmAllocation->getNumGmms();
}
}
return residentAllocations->makeResidentResources(handlesForResidency.begin(), totalHandlesCount, totalSize);
return residentAllocations->makeResidentResources(handlesForResidency.begin(), totalHandlesCount, totalSize, forcePagingFence);
}
MemoryOperationsStatus WddmMemoryOperationsHandler::evict(Device *device, GraphicsAllocation &gfxAllocation) {

View File

@@ -23,15 +23,15 @@ class WddmMemoryOperationsHandler : public MemoryOperationsHandler {
static std::unique_ptr<WddmMemoryOperationsHandler> create(Wddm *wddm, RootDeviceEnvironment *rootDeviceEnvironment, bool withAubDump);
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override;
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus isResident(Device *device, GraphicsAllocation &gfxAllocation) override;
MemoryOperationsStatus lock(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations) override {
return MemoryOperationsStatus::unsupported;
}
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
return makeResident(nullptr, gfxAllocations, false);
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
return makeResident(nullptr, gfxAllocations, false, forcePagingFence);
}
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override {
return evict(nullptr, gfxAllocation);

View File

@@ -36,9 +36,9 @@ class WddmMemoryOperationsHandlerWithAubDump : public BaseOperationsHandler {
~WddmMemoryOperationsHandlerWithAubDump() override = default;
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded) override {
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, isDummyExecNeeded);
return BaseOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded);
MemoryOperationsStatus makeResident(Device *device, ArrayRef<GraphicsAllocation *> gfxAllocations, bool isDummyExecNeeded, const bool forcePagingFence) override {
aubMemoryOperationsHandler->makeResident(device, gfxAllocations, isDummyExecNeeded, forcePagingFence);
return BaseOperationsHandler::makeResident(device, gfxAllocations, isDummyExecNeeded, forcePagingFence);
}
MemoryOperationsStatus evict(Device *device, GraphicsAllocation &gfxAllocation) override {
@@ -56,9 +56,9 @@ class WddmMemoryOperationsHandlerWithAubDump : public BaseOperationsHandler {
return BaseOperationsHandler::isResident(device, gfxAllocation);
}
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable) override {
aubMemoryOperationsHandler->makeResidentWithinOsContext(osContext, gfxAllocations, evictable);
return BaseOperationsHandler::makeResidentWithinOsContext(osContext, gfxAllocations, evictable);
MemoryOperationsStatus makeResidentWithinOsContext(OsContext *osContext, ArrayRef<GraphicsAllocation *> gfxAllocations, bool evictable, const bool forcePagingFence) override {
aubMemoryOperationsHandler->makeResidentWithinOsContext(osContext, gfxAllocations, evictable, forcePagingFence);
return BaseOperationsHandler::makeResidentWithinOsContext(osContext, gfxAllocations, evictable, forcePagingFence);
}
MemoryOperationsStatus evictWithinOsContext(OsContext *osContext, GraphicsAllocation &gfxAllocation) override {

View File

@@ -61,10 +61,10 @@ MemoryOperationsStatus WddmResidentAllocationsContainer::evictResources(const D3
}
MemoryOperationsStatus WddmResidentAllocationsContainer::makeResidentResource(const D3DKMT_HANDLE &handle, size_t size) {
return makeResidentResources(&handle, 1u, size);
return makeResidentResources(&handle, 1u, size, false);
}
MemoryOperationsStatus WddmResidentAllocationsContainer::makeResidentResources(const D3DKMT_HANDLE *handles, const uint32_t count, size_t size) {
MemoryOperationsStatus WddmResidentAllocationsContainer::makeResidentResources(const D3DKMT_HANDLE *handles, const uint32_t count, size_t size, const bool forcePagingFence) {
while (!wddm->makeResident(handles, count, false, nullptr, size)) {
if (evictAllResources() == MemoryOperationsStatus::success) {
continue;
@@ -80,7 +80,7 @@ MemoryOperationsStatus WddmResidentAllocationsContainer::makeResidentResources(c
resourceHandles.push_back(handles[i]);
}
lock.unlock();
wddm->waitOnPagingFenceFromCpu(false);
wddm->waitOnPagingFenceFromCpu(forcePagingFence);
return MemoryOperationsStatus::success;
}

View File

@@ -26,7 +26,7 @@ class WddmResidentAllocationsContainer {
MOCKABLE_VIRTUAL MemoryOperationsStatus evictResource(const D3DKMT_HANDLE &handle);
MemoryOperationsStatus evictResources(const D3DKMT_HANDLE *handles, const uint32_t count);
MOCKABLE_VIRTUAL MemoryOperationsStatus makeResidentResource(const D3DKMT_HANDLE &handle, size_t size);
MemoryOperationsStatus makeResidentResources(const D3DKMT_HANDLE *handles, const uint32_t count, size_t size);
MemoryOperationsStatus makeResidentResources(const D3DKMT_HANDLE *handles, const uint32_t count, size_t size, const bool forcePagingFence);
MOCKABLE_VIRTUAL void removeResource(const D3DKMT_HANDLE &handle);
protected: