Skip to content

Commit 762b34b

Browse files
fix: ulls overflow
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com> Source: c18305d
1 parent 704b230 commit 762b34b

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
@@ -490,6 +490,7 @@ DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionPrintBuffers, false, "Print address
490490
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.")
491491
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerIdleDetection, -1, "Terminate direct submission only if CSR is idle. -1: default, 0 - disable, 1 - enable.")
492492
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerContextGroupIdleDetection, -1, "Terminate direct submission only if all CSRs in group are idle. -1: default, 0 - disable, 1 - enable.")
493+
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionInitialSemaphoreValue, -1, "-1: default, >0: initial semaphore counter value")
493494
/*FEATURE FLAGS*/
494495
DECLARE_DEBUG_VARIABLE(bool, RegisterPageFaultHandlerOnMigration, false, "Register handler on migration to GPU when current is not from pagefault manager")
495496
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
@@ -196,6 +196,8 @@ class DirectSubmissionHw {
196196
virtual bool isCompleted(uint32_t ringBufferIndex) = 0;
197197

198198
void updateRelaxedOrderingQueueSize(uint32_t newSize);
199+
uint32_t getInitialSemaphoreValue() const;
200+
void handleSemaphoreDataOverflow();
199201

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

shared/source/direct_submission/direct_submission_hw.inl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(const DirectSubmis
8181
if (Dispatcher::isCopy() && relaxedOrderingEnabled) {
8282
relaxedOrderingEnabled = (debugManager.flags.DirectSubmissionRelaxedOrderingForBcs.get() != 0);
8383
}
84+
85+
currentQueueWorkCount = getInitialSemaphoreValue();
8486
}
8587

8688
template <typename GfxFamily, typename Dispatcher>
@@ -514,8 +516,27 @@ void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchUllsState() {
514516
}
515517
}
516518

519+
template <typename GfxFamily, typename Dispatcher>
520+
uint32_t DirectSubmissionHw<GfxFamily, Dispatcher>::getInitialSemaphoreValue() const {
521+
return debugManager.flags.DirectSubmissionInitialSemaphoreValue.getIfNotDefault<uint32_t>(1);
522+
}
523+
524+
template <typename GfxFamily, typename Dispatcher>
525+
void DirectSubmissionHw<GfxFamily, Dispatcher>::handleSemaphoreDataOverflow() {
526+
stopRingBuffer(true);
527+
currentQueueWorkCount = 0;
528+
unblockGpu(); // set gpu allocation to 0
529+
530+
currentQueueWorkCount = getInitialSemaphoreValue();
531+
}
532+
517533
template <typename GfxFamily, typename Dispatcher>
518534
bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffer &batchBuffer, FlushStampTracker &flushStamp) {
535+
// Handle overflow earlier (uint32_max - 3), in case of additional ring starts/stops
536+
if ((currentQueueWorkCount + 1) >= (std::numeric_limits<uint32_t>::max() - 3)) {
537+
handleSemaphoreDataOverflow();
538+
}
539+
519540
this->handleRingRestartForUllsLightResidency(batchBuffer.allocationsForResidency);
520541

521542
lastSubmittedThrottle = batchBuffer.throttle;

shared/test/common/test_files/igdrcl.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,4 +682,5 @@ Enable512NumGrfs = 1
682682
EnableUsmPoolResidencyTracking = -1
683683
EnableUsmPoolLazyInit = -1
684684
InitialCounterBasedEventValue = -1
685+
DirectSubmissionInitialSemaphoreValue = -1
685686
# Please don't edit below this line

0 commit comments

Comments
 (0)