fix: signal notify field before KMD wait

Related-To: NEO-13870

Currently all monitor fences are triggering
interrupt due to Notify Enable field.
With this change, such field is programmed
right before KMD wait.

Signed-off-by: Szymon Morek <szymon.morek@intel.com>
This commit is contained in:
Szymon Morek
2025-03-04 13:29:33 +00:00
committed by Compute-Runtime-Automation
parent fffe8f8027
commit ff4da67979
21 changed files with 130 additions and 51 deletions

View File

@@ -96,7 +96,7 @@ class DirectSubmissionHw {
return relaxedOrderingEnabled;
}
virtual void flushMonitorFence(){};
virtual void flushMonitorFence(bool notifyKmd){};
QueueThrottle getLastSubmittedThrottle() {
return this->lastSubmittedThrottle;
@@ -263,5 +263,6 @@ class DirectSubmissionHw {
bool relaxedOrderingInitialized = false;
bool relaxedOrderingSchedulerRequired = false;
bool inputMonitorFenceDispatchRequirement = true;
bool notifyKmdDuringMonitorFence = false;
};
} // namespace NEO

View File

@@ -531,7 +531,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::stopRingBuffer(bool blocking) {
if (disableMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
}
Dispatcher::dispatchStopCommandBuffer(ringCommandStream);
@@ -618,7 +618,7 @@ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSwitchRingBufferS
if (disableMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
}
Dispatcher::dispatchStartCommandBuffer(ringCommandStream, nextBufferGpuAddress);
}
@@ -767,7 +767,7 @@ void *DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchWorkloadSection(BatchBu
if (dispatchMonitorFence) {
TagData currentTagData = {};
getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired);
Dispatcher::dispatchMonitorFence(ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, this->notifyKmdDuringMonitorFence);
}
dispatchSemaphoreSection(currentQueueWorkCount + 1);

View File

@@ -24,7 +24,8 @@ class BlitterDispatcher : public Dispatcher<GfxFamily> {
uint64_t immediateData,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool partitionedWorkload,
bool dcFlushRequired);
bool dcFlushRequired,
bool notifyKmd);
static size_t getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address);

View File

@@ -29,11 +29,12 @@ inline void BlitterDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmd
uint64_t immediateData,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool partitionedWorkload,
bool dcFlushRequired) {
bool dcFlushRequired,
bool notifyKmd) {
NEO::EncodeDummyBlitWaArgs waArgs{false, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
MiFlushArgs args{waArgs};
args.commandWithPostSync = true;
args.notifyEnable = true;
args.notifyEnable = notifyKmd;
EncodeMiFlushDW<GfxFamily>::programWithWa(cmdBuffer, gpuAddress, immediateData, args);
}

View File

@@ -24,7 +24,8 @@ class RenderDispatcher : public Dispatcher<GfxFamily> {
uint64_t immediateData,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool partitionedWorkload,
bool dcFlushRequired);
bool dcFlushRequired,
bool notifyKmd);
static size_t getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment);
static void dispatchCacheFlush(LinearStream &cmdBuffer, const RootDeviceEnvironment &rootDeviceEnvironment, uint64_t address);

View File

@@ -30,11 +30,12 @@ inline void RenderDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdB
uint64_t immediateData,
const RootDeviceEnvironment &rootDeviceEnvironment,
bool partitionedWorkload,
bool dcFlushRequired) {
bool dcFlushRequired,
bool notifyKmd) {
PipeControlArgs args;
args.dcFlushEnable = dcFlushRequired;
args.workloadPartitionOffset = partitionedWorkload;
args.notifyEnable = true;
args.notifyEnable = notifyKmd;
args.textureCacheInvalidationEnable = true;
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation(

View File

@@ -90,6 +90,7 @@ DrmDirectSubmission<GfxFamily, Dispatcher>::DrmDirectSubmission(const DirectSubm
}
}
}
this->notifyKmdDuringMonitorFence = true;
}
template <typename GfxFamily, typename Dispatcher>

View File

@@ -24,7 +24,7 @@ class WddmDirectSubmission : public DirectSubmissionHw<GfxFamily, Dispatcher> {
~WddmDirectSubmission() override;
void flushMonitorFence() override;
void flushMonitorFence(bool notifyKmd) override;
void unblockPagingFenceSemaphore(uint64_t pagingFenceValue) override;
protected:

View File

@@ -54,7 +54,7 @@ WddmDirectSubmission<GfxFamily, Dispatcher>::~WddmDirectSubmission() {
}
template <typename GfxFamily, typename Dispatcher>
inline void WddmDirectSubmission<GfxFamily, Dispatcher>::flushMonitorFence() {
inline void WddmDirectSubmission<GfxFamily, Dispatcher>::flushMonitorFence(bool notifyKmd) {
auto needStart = !this->ringStart;
size_t requiredMinimalSize = this->getSizeSemaphoreSection(false) +
@@ -70,7 +70,7 @@ inline void WddmDirectSubmission<GfxFamily, Dispatcher>::flushMonitorFence() {
TagData currentTagData = {};
this->getTagAddressValue(currentTagData);
Dispatcher::dispatchMonitorFence(this->ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired);
Dispatcher::dispatchMonitorFence(this->ringCommandStream, currentTagData.tagAddress, currentTagData.tagValue, this->rootDeviceEnvironment, this->partitionedMode, this->dcFlushRequired, notifyKmd);
this->dispatchSemaphoreSection(this->currentQueueWorkCount + 1);
this->submitCommandBufferToGpu(needStart, startVA, requiredMinimalSize, true, nullptr);