Skip to content

Commit 14b06bb

Browse files
fix: ulls overflow
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com> Source: c18305d
1 parent 2cfa921 commit 14b06bb

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

shared/source/debug_settings/debug_variables_base.inl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionPrintBuffers, false, "Print address
485485
DECLARE_DEBUG_VARIABLE(int32_t, WaitForPagingFenceInController, -1, "Instead of waiting for paging fence on user thread, program additional semaphore which will be signaled by direct submission controller when paging fence reaches required value -1: default, 0 - disable, 1 - enable.")
486486
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerIdleDetection, -1, "Terminate direct submission only if CSR is idle. -1: default, 0 - disable, 1 - enable.")
487487
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerContextGroupIdleDetection, -1, "Terminate direct submission only if all CSRs in group are idle. -1: default, 0 - disable, 1 - enable.")
488+
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionInitialSemaphoreValue, -1, "-1: default, >0: initial semaphore counter value")
488489
/*FEATURE FLAGS*/
489490
DECLARE_DEBUG_VARIABLE(bool, RegisterPageFaultHandlerOnMigration, false, "Register handler on migration to GPU when current is not from pagefault manager")
490491
DECLARE_DEBUG_VARIABLE(bool, EnableNV12, true, "Enables NV12 extension")

shared/source/direct_submission/direct_submission_hw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ class DirectSubmissionHw {
195195
virtual bool isCompleted(uint32_t ringBufferIndex) = 0;
196196

197197
void updateRelaxedOrderingQueueSize(uint32_t newSize);
198+
uint32_t getInitialSemaphoreValue() const;
199+
void handleSemaphoreDataOverflow();
198200

199201
virtual void makeGlobalFenceAlwaysResident(){};
200202
struct RingBufferUse {

shared/source/direct_submission/direct_submission_hw.inl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(const DirectSubmis
8787
if (Dispatcher::isCopy() && relaxedOrderingEnabled) {
8888
relaxedOrderingEnabled = (debugManager.flags.DirectSubmissionRelaxedOrderingForBcs.get() != 0);
8989
}
90+
91+
currentQueueWorkCount = getInitialSemaphoreValue();
9092
}
9193

9294
template <typename GfxFamily, typename Dispatcher>
@@ -520,8 +522,27 @@ void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchUllsState() {
520522
}
521523
}
522524

525+
template <typename GfxFamily, typename Dispatcher>
526+
uint32_t DirectSubmissionHw<GfxFamily, Dispatcher>::getInitialSemaphoreValue() const {
527+
return debugManager.flags.DirectSubmissionInitialSemaphoreValue.getIfNotDefault<uint32_t>(1);
528+
}
529+
530+
template <typename GfxFamily, typename Dispatcher>
531+
void DirectSubmissionHw<GfxFamily, Dispatcher>::handleSemaphoreDataOverflow() {
532+
stopRingBuffer(true);
533+
currentQueueWorkCount = 0;
534+
unblockGpu(); // set gpu allocation to 0
535+
536+
currentQueueWorkCount = getInitialSemaphoreValue();
537+
}
538+
523539
template <typename GfxFamily, typename Dispatcher>
524540
bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffer &batchBuffer, FlushStampTracker &flushStamp) {
541+
// Handle overflow earlier (uint32_max - 3), in case of additional ring starts/stops
542+
if ((currentQueueWorkCount + 1) >= (std::numeric_limits<uint32_t>::max() - 3)) {
543+
handleSemaphoreDataOverflow();
544+
}
545+
525546
this->handleRingRestartForUllsLightResidency(batchBuffer.allocationsForResidency);
526547

527548
lastSubmittedThrottle = batchBuffer.throttle;

shared/test/common/test_files/igdrcl.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,4 +676,5 @@ ForceTotalWMTPDataSize = -1
676676
CopyLockedMemoryBeforeWrite = 0
677677
SplitBcsPerEngineMaxSize = -1
678678
EnableUsmPoolResidencyTracking = -1
679+
DirectSubmissionInitialSemaphoreValue = -1
679680
# Please don't edit below this line

0 commit comments

Comments
 (0)