Skip to content

Commit 57344fc

Browse files
Enable task count update from wait on direct submission
Signed-off-by: Lukasz Jobczyk <[email protected]>
1 parent 555cb8f commit 57344fc

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

opencl/test/unit_test/command_stream/command_stream_receiver_tests.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,11 @@ HWTEST_F(CommandStreamReceiverTest, whenClearColorAllocationIsCreatedThenItIsDes
398398
EXPECT_EQ(nullptr, csr.clearColorAllocation);
399399
}
400400

401+
HWTEST_F(CommandStreamReceiverTest, givenNoDirectSubmissionWhenCheckTaskCountFromWaitEnabledThenReturnsFalse) {
402+
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
403+
EXPECT_FALSE(csr.isUpdateTagFromWaitEnabled());
404+
}
405+
401406
struct InitDirectSubmissionFixture {
402407
void SetUp() {
403408
DebugManager.flags.EnableDirectSubmission.set(1);
@@ -491,6 +496,44 @@ HWTEST_F(InitDirectSubmissionTest, whenDirectSubmissionEnabledOnRcsThenExpectFea
491496
csr.reset();
492497
}
493498

499+
HWTEST_F(InitDirectSubmissionTest, givenDirectSubmissionWhenCheckTaskCountFromWaitEnabledThenReturnsTrue) {
500+
auto csr = std::make_unique<CommandStreamReceiverHw<FamilyType>>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield());
501+
std::unique_ptr<OsContext> osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), 0,
502+
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_RCS, EngineUsage::Regular},
503+
PreemptionMode::ThreadGroup, device->getDeviceBitfield())));
504+
osContext->ensureContextInitialized();
505+
osContext->setDefaultContext(true);
506+
auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo();
507+
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
508+
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].submitOnInit = false;
509+
510+
bool ret = csr->initDirectSubmission(*device, *osContext.get());
511+
EXPECT_TRUE(ret);
512+
513+
EXPECT_TRUE(csr->isUpdateTagFromWaitEnabled());
514+
515+
csr.reset();
516+
}
517+
518+
HWTEST_F(InitDirectSubmissionTest, givenBlitterDirectSubmissionWhenCheckTaskCountFromWaitEnabledThenReturnsTrue) {
519+
auto csr = std::make_unique<CommandStreamReceiverHw<FamilyType>>(*device->executionEnvironment, device->getRootDeviceIndex(), device->getDeviceBitfield());
520+
std::unique_ptr<OsContext> osContext(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), 0,
521+
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::Regular},
522+
PreemptionMode::ThreadGroup, device->getDeviceBitfield())));
523+
osContext->ensureContextInitialized();
524+
osContext->setDefaultContext(true);
525+
auto hwInfo = device->getRootDeviceEnvironment().getMutableHardwareInfo();
526+
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = true;
527+
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].submitOnInit = false;
528+
529+
bool ret = csr->initDirectSubmission(*device, *osContext.get());
530+
EXPECT_TRUE(ret);
531+
532+
EXPECT_TRUE(csr->isUpdateTagFromWaitEnabled());
533+
534+
csr.reset();
535+
}
536+
494537
template <class Type>
495538
class CommandStreamReceiverHwDirectSubmissionMock : public CommandStreamReceiverHw<Type> {
496539
public:

shared/source/command_stream/command_stream_receiver_hw_base.inl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ uint32_t CommandStreamReceiverHw<GfxFamily>::blitBuffer(const BlitPropertiesCont
11341134
flush(batchBuffer, getResidencyAllocations());
11351135
makeSurfacePackNonResident(getResidencyAllocations());
11361136

1137-
if (!isUpdateTagFromWaitEnabled()) {
1137+
if (updateTag) {
11381138
latestFlushedTaskCount = newTaskCount;
11391139
}
11401140

@@ -1341,7 +1341,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushHandler(BatchBuffer &batchB
13411341

13421342
template <typename GfxFamily>
13431343
inline bool CommandStreamReceiverHw<GfxFamily>::isUpdateTagFromWaitEnabled() {
1344-
bool enabled = false;
1344+
bool enabled = isDirectSubmissionEnabled() || isBlitterDirectSubmissionEnabled();
13451345

13461346
if (DebugManager.flags.UpdateTaskCountFromWait.get() != -1) {
13471347
enabled = DebugManager.flags.UpdateTaskCountFromWait.get();

0 commit comments

Comments
 (0)