Skip to content

Commit a046de5

Browse files
Improve BCS waiting logic to satisfy AUB/TBX mode
Change-Id: I52b44959b8bdc1cc66f136a4785233b95870fd0b Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
1 parent c6e13fd commit a046de5

File tree

12 files changed

+80
-30
lines changed

12 files changed

+80
-30
lines changed

runtime/command_queue/command_queue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void CommandQueue::waitUntilComplete(uint32_t taskCountToWait, FlushStamp flushS
149149
getGpgpuCommandStreamReceiver().waitForTaskCountAndCleanAllocationList(taskCountToWait, TEMPORARY_ALLOCATION);
150150

151151
if (auto bcsCsr = getBcsCommandStreamReceiver()) {
152-
auto bcsTaskCount = *bcsCsr->getTagAddress();
152+
bcsCsr->waitForTaskCountWithKmdNotifyFallback(bcsTaskCount, 0, false, false);
153153
bcsCsr->waitForTaskCountAndCleanAllocationList(bcsTaskCount, TEMPORARY_ALLOCATION);
154154
}
155155

runtime/command_queue/command_queue.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
406406

407407
bool isMultiEngineQueue() const { return this->multiEngineQueue; }
408408

409+
void updateBcsTaskCount(uint32_t newBcsTaskCount) { this->bcsTaskCount = newBcsTaskCount; }
410+
409411
// taskCount of last task
410412
uint32_t taskCount = 0;
411413

@@ -455,6 +457,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
455457
QueuePriority priority = QueuePriority::MEDIUM;
456458
QueueThrottle throttle = QueueThrottle::MEDIUM;
457459
uint64_t sliceCount = QueueSliceCount::defaultSliceCount;
460+
uint32_t bcsTaskCount = 0;
458461

459462
bool perfCountersEnabled = false;
460463

runtime/command_queue/enqueue_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueCommandWithoutKernel(
865865
enqueueProperties.blitProperties->csrDependencies.makeResident(*bcsCsr);
866866
previousTimestampPacketNodes->makeResident(*bcsCsr);
867867
timestampPacketContainer->makeResident(*bcsCsr);
868-
bcsCsr->blitBuffer(*enqueueProperties.blitProperties);
868+
this->bcsTaskCount = bcsCsr->blitBuffer(*enqueueProperties.blitProperties);
869869
}
870870

871871
DispatchFlags dispatchFlags(

runtime/command_stream/command_stream_receiver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class CommandStreamReceiver {
176176
this->latestSentTaskCount = latestSentTaskCount;
177177
}
178178

179-
virtual void blitBuffer(const BlitProperties &blitProperites) = 0;
179+
virtual uint32_t blitBuffer(const BlitProperties &blitProperites) = 0;
180180

181181
ScratchSpaceController *getScratchSpaceController() const {
182182
return scratchSpaceController.get();

runtime/command_stream/command_stream_receiver_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class CommandStreamReceiverHw : public CommandStreamReceiver {
7373
return CommandStreamReceiverType::CSR_HW;
7474
}
7575

76-
void blitBuffer(const BlitProperties &blitProperites) override;
76+
uint32_t blitBuffer(const BlitProperties &blitProperites) override;
7777

7878
bool isMultiOsContextCapable() const override;
7979

runtime/command_stream/command_stream_receiver_hw_base.inl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ bool CommandStreamReceiverHw<GfxFamily>::detectInitProgrammingFlagsRequired(cons
795795
}
796796

797797
template <typename GfxFamily>
798-
void CommandStreamReceiverHw<GfxFamily>::blitBuffer(const BlitProperties &blitProperites) {
798+
uint32_t CommandStreamReceiverHw<GfxFamily>::blitBuffer(const BlitProperties &blitProperites) {
799799
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
800800
using MI_FLUSH_DW = typename GfxFamily::MI_FLUSH_DW;
801801

@@ -845,6 +845,8 @@ void CommandStreamReceiverHw<GfxFamily>::blitBuffer(const BlitProperties &blitPr
845845
waitForTaskCountWithKmdNotifyFallback(newTaskCount, flushStampToWait, false, false);
846846
internalAllocationStorage->cleanAllocationList(newTaskCount, TEMPORARY_ALLOCATION);
847847
}
848+
849+
return newTaskCount;
848850
}
849851

850852
template <typename GfxFamily>

runtime/helpers/task_information.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ void CommandWithoutKernel::dispatchBlitOperation() {
257257
blitProperties.csrDependencies.push_back(barrierTimestampPacketNodes.get());
258258
blitProperties.outputTimestampPacket = currentTimestampPacketNodes.get();
259259

260-
bcsCsr->blitBuffer(blitProperties);
260+
auto bcsTaskCount = bcsCsr->blitBuffer(blitProperties);
261+
262+
commandQueue.updateBcsTaskCount(bcsTaskCount);
261263
}
262264

263265
CompletionStamp &CommandWithoutKernel::submit(uint32_t taskLevel, bool terminated) {

unit_tests/kernel/kernel_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ class CommandStreamReceiverMock : public CommandStreamReceiver {
489489

490490
void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool quickKmdSleep, bool forcePowerSavingMode) override {
491491
}
492-
void blitBuffer(const BlitProperties &blitProperites) override{};
492+
uint32_t blitBuffer(const BlitProperties &blitProperites) override { return taskCount; };
493493

494494
CompletionStamp flushTask(
495495
LinearStream &commandStream,

unit_tests/libult/ult_aub_command_stream_receiver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ class UltAubCommandStreamReceiver : public AUBCommandStreamReceiverHw<GfxFamily>
3838
return csr;
3939
}
4040

41-
void blitBuffer(const BlitProperties &blitProperites) override {
41+
uint32_t blitBuffer(const BlitProperties &blitProperites) override {
4242
blitBufferCalled++;
43-
BaseClass::blitBuffer(blitProperites);
43+
return BaseClass::blitBuffer(blitProperites);
4444
}
4545

4646
uint32_t blitBufferCalled = 0;

unit_tests/libult/ult_command_stream_receiver.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
173173
return CommandStreamReceiverHw<GfxFamily>::obtainUniqueOwnership();
174174
}
175175

176-
void blitBuffer(const BlitProperties &blitProperites) override {
176+
uint32_t blitBuffer(const BlitProperties &blitProperites) override {
177177
blitBufferCalled++;
178-
CommandStreamReceiverHw<GfxFamily>::blitBuffer(blitProperites);
178+
return CommandStreamReceiverHw<GfxFamily>::blitBuffer(blitProperites);
179179
}
180180

181181
bool createPerDssBackedBuffer(Device &device) override {
@@ -210,4 +210,4 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
210210
DispatchFlags recordedDispatchFlags;
211211
bool multiOsContextCapable = false;
212212
};
213-
} // namespace NEO
213+
} // namespace NEO

0 commit comments

Comments
 (0)