Queue stall mode for RelaxedOrdering

Related-To: NEO-7458

Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2022-11-19 18:25:04 +00:00
committed by Compute-Runtime-Automation
parent bb308c04ed
commit bc619fcbec
28 changed files with 549 additions and 200 deletions

View File

@@ -127,6 +127,9 @@ class DirectSubmissionHw {
void dispatchSwitchRingBufferSection(uint64_t nextBufferGpuAddress);
size_t getSizeSwitchRingBufferSection();
void dispatchRelaxedOrderingQueueStall();
size_t getSizeDispatchRelaxedOrderingQueueStall();
void dispatchTaskStoreSection(uint64_t taskStartSectionVa);
MOCKABLE_VIRTUAL void preinitializeTaskStoreSection();
@@ -221,5 +224,6 @@ class DirectSubmissionHw {
bool dcFlushRequired = false;
bool relaxedOrderingEnabled = false;
bool relaxedOrderingInitialized = false;
bool firstSubmissionAfterRingStart = true;
};
} // namespace NEO

View File

@@ -433,6 +433,8 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::startRingBuffer() {
ringStart = submit(gpuStartVa, startSize);
firstSubmissionAfterRingStart = true;
return ringStart;
}
@@ -442,6 +444,10 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::stopRingBuffer() {
return true;
}
if (this->relaxedOrderingEnabled && !firstSubmissionAfterRingStart) {
dispatchRelaxedOrderingQueueStall();
}
void *flushPtr = ringCommandStream.getSpace(0);
Dispatcher::dispatchCacheFlush(ringCommandStream, *hwInfo, gpuVaForMiFlush);
if (disableMonitorFence) {
@@ -546,6 +552,9 @@ inline size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeEnd() {
if (disableMonitorFence) {
size += Dispatcher::getSizeMonitorFence(*hwInfo);
}
if (this->relaxedOrderingEnabled) {
size += getSizeDispatchRelaxedOrderingQueueStall();
}
return size;
}
@@ -648,6 +657,17 @@ void *DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchWorkloadSection(BatchBu
return currentPosition;
}
template <typename GfxFamily, typename Dispatcher>
void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchRelaxedOrderingQueueStall() {
LriHelper<GfxFamily>::program(&ringCommandStream, CS_GPR_R5, 1, true);
dispatchSemaphoreSection(currentQueueWorkCount, false);
}
template <typename GfxFamily, typename Dispatcher>
size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getSizeDispatchRelaxedOrderingQueueStall() {
return getSizeSemaphoreSection(false) + sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM);
}
template <typename GfxFamily, typename Dispatcher>
void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchRelaxedOrderingReturnPtrRegs(LinearStream &cmdStream, uint64_t returnPtr) {
LriHelper<GfxFamily>::program(&cmdStream, CS_GPR_R4, static_cast<uint32_t>(returnPtr & 0xFFFF'FFFFULL), true);
@@ -736,6 +756,9 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffe
size_t cycleSize = getSizeSwitchRingBufferSection();
size_t requiredMinimalSize = dispatchSize + cycleSize + getSizeEnd();
if (this->relaxedOrderingEnabled) {
if (batchBuffer.hasStallingCmds && !firstSubmissionAfterRingStart) {
requiredMinimalSize += getSizeDispatchRelaxedOrderingQueueStall();
}
requiredMinimalSize += RelaxedOrderingHelper::getSizeTaskStoreSection<GfxFamily>() + RelaxedOrderingHelper::getSizeReturnPtrRegs<GfxFamily>();
}
@@ -745,6 +768,10 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffe
switchRingBuffers();
}
if (this->relaxedOrderingEnabled && batchBuffer.hasStallingCmds && !firstSubmissionAfterRingStart) {
dispatchRelaxedOrderingQueueStall();
}
handleNewResourcesSubmission();
void *currentPosition = dispatchWorkloadSection(batchBuffer);
@@ -771,6 +798,8 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffe
uint64_t flushValue = updateTagValue();
flushStamp.setStamp(flushValue);
firstSubmissionAfterRingStart = false;
return ringStart;
}