mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
fix: Don't program redundant paging fence semaphores
Related-To: NEO-12197 Don't program semaphore to wait for paging fence if it was already programmed with the same value Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
490b474ce7
commit
a915ef4b7b
@@ -44,8 +44,12 @@ class WddmCommandStreamReceiver : public DeviceCommandStreamReceiver<GfxFamily>
|
||||
protected:
|
||||
void kmDafLockAllocations(ResidencyContainer &allocationsForResidency);
|
||||
void addToEvictionContainer(GraphicsAllocation &gfxAllocation) override;
|
||||
bool validForEnqueuePagingFence(uint64_t pagingFenceValue) const;
|
||||
|
||||
Wddm *wddm;
|
||||
COMMAND_BUFFER_HEADER_REC *commandBufferHeader;
|
||||
|
||||
bool requiresBlockingResidencyHandling = true;
|
||||
uint64_t lastEnqueuedPagingFenceValue = 0;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -84,13 +84,16 @@ SubmissionStatus WddmCommandStreamReceiver<GfxFamily>::flush(BatchBuffer &batchB
|
||||
}
|
||||
batchBuffer.allocationsForResidency = &allocationsForResidency;
|
||||
|
||||
// Enqueue wait for paging fence only if it's valid and there's actual paging fence to wait for
|
||||
auto mustWaitForResidency = this->requiresBlockingResidencyHandling;
|
||||
mustWaitForResidency |= !this->executionEnvironment.directSubmissionController.get();
|
||||
batchBuffer.pagingFenceSemInfo.requiresBlockingResidencyHandling = mustWaitForResidency;
|
||||
|
||||
auto pagingFenceValue = this->wddm->getCurrentPagingFenceValue();
|
||||
if (!this->requiresBlockingResidencyHandling && pagingFenceValue > *this->wddm->getPagingFenceAddress()) {
|
||||
if (this->validForEnqueuePagingFence(pagingFenceValue)) {
|
||||
auto waitEnqueued = this->enqueueWaitForPagingFence(pagingFenceValue);
|
||||
if (waitEnqueued) {
|
||||
batchBuffer.pagingFenceSemInfo.requiresBlockingResidencyHandling = false;
|
||||
batchBuffer.pagingFenceSemInfo.pagingFenceValue = pagingFenceValue;
|
||||
this->lastEnqueuedPagingFenceValue = pagingFenceValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,4 +231,11 @@ void WddmCommandStreamReceiver<GfxFamily>::addToEvictionContainer(GraphicsAlloca
|
||||
this->getEvictionAllocations().push_back(&gfxAllocation);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool WddmCommandStreamReceiver<GfxFamily>::validForEnqueuePagingFence(uint64_t pagingFenceValue) const {
|
||||
return !this->requiresBlockingResidencyHandling &&
|
||||
pagingFenceValue > *this->wddm->getPagingFenceAddress() &&
|
||||
pagingFenceValue > this->lastEnqueuedPagingFenceValue;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user