mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-25 13:33:02 +08:00
feature: Dispatch monitor fence from wait
Resolves: NEO-8240 Related-To: NEO-8067 Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f3f623900a
commit
fc1f45b630
@@ -23,6 +23,8 @@ class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
|
||||
|
||||
~WddmDirectSubmission() override;
|
||||
|
||||
void flushMonitorFence() override;
|
||||
|
||||
protected:
|
||||
bool allocateOsResources() override;
|
||||
bool submit(uint64_t gpuAddress, size_t size) override;
|
||||
@@ -31,6 +33,7 @@ class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
|
||||
void handleCompletionFence(uint64_t completionValue, MonitoredFence &fence);
|
||||
void ensureRingCompletion() override;
|
||||
void handleSwitchRingBuffers() override;
|
||||
void handleStopRingBuffer() override;
|
||||
uint64_t updateTagValue() override;
|
||||
void getTagAddressValue(TagData &tagData) override;
|
||||
bool isCompleted(uint32_t ringBufferIndex) override;
|
||||
|
||||
@@ -41,6 +41,10 @@ WddmDirectSubmission<GfxFamily, Dispatcher>::WddmDirectSubmission(const DirectSu
|
||||
if (this->miMemFenceRequired) {
|
||||
this->gpuVaForAdditionalSynchronizationWA = this->completionFenceAllocation->getGpuAddress() + 8u;
|
||||
}
|
||||
|
||||
if (DebugManager.flags.DirectSubmissionDisableMonitorFence.get() != -1) {
|
||||
this->disableMonitorFence = DebugManager.flags.DirectSubmissionDisableMonitorFence.get();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
@@ -53,6 +57,31 @@ WddmDirectSubmission<GfxFamily, Dispatcher>::~WddmDirectSubmission() {
|
||||
wddm->getWddmInterface()->destroyMonitorFence(ringFence);
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
inline void WddmDirectSubmission<GfxFamily, Dispatcher>::flushMonitorFence() {
|
||||
this->startRingBuffer();
|
||||
|
||||
size_t requiredMinimalSize = this->getSizeSemaphoreSection(false) +
|
||||
Dispatcher::getSizeMonitorFence(this->rootDeviceEnvironment) +
|
||||
this->getSizeNewResourceHandler() +
|
||||
this->getSizeSwitchRingBufferSection() +
|
||||
this->getSizeEnd(false);
|
||||
this->switchRingBuffersNeeded(requiredMinimalSize);
|
||||
|
||||
this->handleNewResourcesSubmission();
|
||||
|
||||
TagData currentTagData = {};
|
||||
this->getTagAddressValue(currentTagData);
|
||||
Dispatcher::dispatchMonitorFence(this->ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->useNotifyForPostSync, this->partitionedMode, this->dcFlushRequired);
|
||||
|
||||
this->dispatchSemaphoreSection(this->currentQueueWorkCount + 1);
|
||||
this->handleResidency();
|
||||
this->unblockGpu();
|
||||
this->currentQueueWorkCount++;
|
||||
|
||||
this->updateTagValue();
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
void WddmDirectSubmission<GfxFamily, Dispatcher>::ensureRingCompletion() {
|
||||
WddmDirectSubmission<GfxFamily, Dispatcher>::handleCompletionFence(ringFence.lastSubmittedFence, ringFence);
|
||||
@@ -96,19 +125,38 @@ bool WddmDirectSubmission<GfxFamily, Dispatcher>::handleResidency() {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
void WddmDirectSubmission<GfxFamily, Dispatcher>::handleStopRingBuffer() {
|
||||
if (this->disableMonitorFence) {
|
||||
MonitoredFence ¤tFence = osContextWin->getResidencyController().getMonitoredFence();
|
||||
currentFence.lastSubmittedFence = currentFence.currentFenceValue;
|
||||
currentFence.currentFenceValue++;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
void WddmDirectSubmission<GfxFamily, Dispatcher>::handleSwitchRingBuffers() {
|
||||
if (this->disableMonitorFence) {
|
||||
MonitoredFence ¤tFence = osContextWin->getResidencyController().getMonitoredFence();
|
||||
currentFence.lastSubmittedFence = currentFence.currentFenceValue;
|
||||
currentFence.currentFenceValue++;
|
||||
|
||||
this->ringBuffers[this->currentRingBuffer].completionFence = currentFence.lastSubmittedFence;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
uint64_t WddmDirectSubmission<GfxFamily, Dispatcher>::updateTagValue() {
|
||||
MonitoredFence ¤tFence = osContextWin->getResidencyController().getMonitoredFence();
|
||||
if (!this->disableMonitorFence) {
|
||||
MonitoredFence ¤tFence = osContextWin->getResidencyController().getMonitoredFence();
|
||||
|
||||
currentFence.lastSubmittedFence = currentFence.currentFenceValue;
|
||||
currentFence.currentFenceValue++;
|
||||
this->ringBuffers[this->currentRingBuffer].completionFence = currentFence.lastSubmittedFence;
|
||||
currentFence.lastSubmittedFence = currentFence.currentFenceValue;
|
||||
currentFence.currentFenceValue++;
|
||||
this->ringBuffers[this->currentRingBuffer].completionFence = currentFence.lastSubmittedFence;
|
||||
|
||||
return currentFence.lastSubmittedFence;
|
||||
return currentFence.lastSubmittedFence;
|
||||
}
|
||||
return 0ull;
|
||||
}
|
||||
|
||||
template <typename GfxFamily, typename Dispatcher>
|
||||
|
||||
Reference in New Issue
Block a user