@@ -159,6 +159,19 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::makeResourcesResident(DirectSubm
159
159
return ret;
160
160
}
161
161
162
+ template <typename GfxFamily, typename Dispatcher>
163
+ inline void DirectSubmissionHw<GfxFamily, Dispatcher>::unblockGpu() {
164
+ if (sfenceMode >= DirectSubmissionSfenceMode::BeforeSemaphoreOnly) {
165
+ CpuIntrinsics::sfence ();
166
+ }
167
+
168
+ semaphoreData->QueueWorkCount = currentQueueWorkCount;
169
+
170
+ if (sfenceMode == DirectSubmissionSfenceMode::BeforeAndAfterSemaphore) {
171
+ CpuIntrinsics::sfence ();
172
+ }
173
+ }
174
+
162
175
template <typename GfxFamily, typename Dispatcher>
163
176
inline void DirectSubmissionHw<GfxFamily, Dispatcher>::cpuCachelineFlush(void *ptr, size_t size) {
164
177
if (disableCpuCacheFlush) {
@@ -273,8 +286,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::stopRingBuffer() {
273
286
EncodeNoop<GfxFamily>::alignToCacheLine (ringCommandStream);
274
287
275
288
cpuCachelineFlush (flushPtr, getSizeEnd ());
276
-
277
- semaphoreData->QueueWorkCount = currentQueueWorkCount;
289
+ this ->unblockGpu ();
278
290
cpuCachelineFlush (semaphorePtr, MemoryConstants::cacheLineSize);
279
291
280
292
this ->handleStopRingBuffer ();
@@ -478,16 +490,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchCommandBuffer(BatchBuffe
478
490
reserved = *ringBufferStart;
479
491
}
480
492
481
- if (sfenceMode >= DirectSubmissionSfenceMode::BeforeSemaphoreOnly) {
482
- CpuIntrinsics::sfence ();
483
- }
484
-
485
- // unblock GPU
486
- semaphoreData->QueueWorkCount = currentQueueWorkCount;
487
-
488
- if (sfenceMode == DirectSubmissionSfenceMode::BeforeAndAfterSemaphore) {
489
- CpuIntrinsics::sfence ();
490
- }
493
+ this ->unblockGpu ();
491
494
492
495
cpuCachelineFlush (semaphorePtr, MemoryConstants::cacheLineSize);
493
496
currentQueueWorkCount++;
0 commit comments