Skip to content

Commit a3fe50c

Browse files
Revert "Assign BCS at first blit enqueue"
This reverts commit 0469034. Signed-off-by: Compute-Runtime-Validation <[email protected]>
1 parent 85b4747 commit a3fe50c

File tree

8 files changed

+22
-91
lines changed

8 files changed

+22
-91
lines changed

opencl/source/command_queue/command_queue.cpp

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,19 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
7373
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
7474
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
7575

76-
bcsAllowed = hwInfoConfig->isBlitterFullySupported(hwInfo) &&
77-
hwHelper.isSubDeviceEngineSupported(hwInfo, device->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS);
76+
bool bcsAllowed = hwInfoConfig->isBlitterFullySupported(hwInfo) &&
77+
hwHelper.isSubDeviceEngineSupported(hwInfo, device->getDeviceBitfield(), aub_stream::EngineType::ENGINE_BCS);
7878

7979
if (bcsAllowed || device->getDefaultEngine().commandStreamReceiver->peekTimestampPacketWriteEnabled()) {
8080
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
8181
deferredTimestampPackets = std::make_unique<TimestampPacketContainer>();
8282
}
83-
84-
auto deferCmdQBcsInitialization = true;
85-
86-
if (DebugManager.flags.DeferCmdQBcsInitialization.get() != -1) {
87-
deferCmdQBcsInitialization = DebugManager.flags.DeferCmdQBcsInitialization.get();
88-
}
89-
90-
if (!deferCmdQBcsInitialization) {
91-
this->initializeBcsEngine(internalUsage);
83+
if (bcsAllowed) {
84+
auto &neoDevice = device->getNearestGenericSubDevice(0)->getDevice();
85+
auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine();
86+
auto bcsEngineType = EngineHelpers::getBcsEngineType(hwInfo, device->getDeviceBitfield(), selectorCopyEngine, internalUsage);
87+
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)] = neoDevice.tryGetEngine(bcsEngineType, EngineUsage::Regular);
88+
bcsEngineTypes.push_back(bcsEngineType);
9289
}
9390
}
9491

@@ -184,8 +181,7 @@ CommandStreamReceiver &CommandQueue::getGpgpuCommandStreamReceiver() const {
184181
return *gpgpuEngine->commandStreamReceiver;
185182
}
186183

187-
CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) {
188-
initializeBcsEngine(isSpecial());
184+
CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) const {
189185
const EngineControl *engine = this->bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)];
190186
if (engine == nullptr) {
191187
return nullptr;
@@ -194,8 +190,7 @@ CommandStreamReceiver *CommandQueue::getBcsCommandStreamReceiver(aub_stream::Eng
194190
}
195191
}
196192

197-
CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() {
198-
initializeBcsEngine(isSpecial());
193+
CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() const {
199194
for (const EngineControl *engine : this->bcsEngines) {
200195
if (engine != nullptr) {
201196
return engine->commandStreamReceiver;
@@ -204,8 +199,7 @@ CommandStreamReceiver *CommandQueue::getBcsForAuxTranslation() {
204199
return nullptr;
205200
}
206201

207-
CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelectionArgs &args) {
208-
initializeBcsEngine(isSpecial());
202+
CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const {
209203
if (isCopyOnly) {
210204
return *getBcsCommandStreamReceiver(bcsEngineTypes[0]);
211205
}
@@ -273,21 +267,6 @@ CommandStreamReceiver &CommandQueue::selectCsrForBuiltinOperation(const CsrSelec
273267
return *selectedCsr;
274268
}
275269

276-
void CommandQueue::initializeBcsEngine(bool internalUsage) {
277-
if (bcsAllowed && !bcsInitialized) {
278-
auto &neoDevice = device->getNearestGenericSubDevice(0)->getDevice();
279-
auto &selectorCopyEngine = neoDevice.getSelectorCopyEngine();
280-
auto bcsEngineType = EngineHelpers::getBcsEngineType(device->getHardwareInfo(), device->getDeviceBitfield(), selectorCopyEngine, internalUsage);
281-
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)] = neoDevice.tryGetEngine(bcsEngineType, EngineUsage::Regular);
282-
bcsEngineTypes.push_back(bcsEngineType);
283-
bcsInitialized = true;
284-
if (bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)]) {
285-
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)]->osContext->ensureContextInitialized();
286-
bcsEngines[EngineHelpers::getBcsIndex(bcsEngineType)]->commandStreamReceiver->initDirectSubmission();
287-
}
288-
}
289-
}
290-
291270
Device &CommandQueue::getDevice() const noexcept {
292271
return device->getDevice();
293272
}
@@ -301,7 +280,7 @@ volatile uint32_t *CommandQueue::getHwTagAddress() const {
301280
return getGpgpuCommandStreamReceiver().getTagAddress();
302281
}
303282

304-
bool CommandQueue::isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState) {
283+
bool CommandQueue::isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState) const {
305284
DEBUG_BREAK_IF(getHwTag() == CompletionStamp::notReady);
306285

307286
if (getGpgpuCommandStreamReceiver().testTaskCountReady(getHwTagAddress(), gpgpuTaskCount)) {
@@ -1049,7 +1028,6 @@ void CommandQueue::overrideEngine(aub_stream::EngineType engineType, EngineUsage
10491028
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
10501029
deferredTimestampPackets = std::make_unique<TimestampPacketContainer>();
10511030
isCopyOnly = true;
1052-
bcsInitialized = true;
10531031
} else {
10541032
gpgpuEngine = &device->getEngine(engineType, engineUsage);
10551033
}

opencl/source/command_queue/command_queue.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
202202

203203
volatile uint32_t *getHwTagAddress() const;
204204

205-
bool isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState);
205+
bool isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState) const;
206206

207207
bool isWaitForTimestampsEnabled() const;
208208
virtual bool waitForTimestamps(Range<CopyEngineState> copyEnginesToWait, uint32_t taskCount) = 0;
@@ -225,10 +225,9 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
225225
void initializeGpgpu() const;
226226
void initializeGpgpuInternals() const;
227227
MOCKABLE_VIRTUAL CommandStreamReceiver &getGpgpuCommandStreamReceiver() const;
228-
MOCKABLE_VIRTUAL CommandStreamReceiver *getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType);
229-
CommandStreamReceiver *getBcsForAuxTranslation();
230-
MOCKABLE_VIRTUAL CommandStreamReceiver &selectCsrForBuiltinOperation(const CsrSelectionArgs &args);
231-
void initializeBcsEngine(bool internalUsage);
228+
MOCKABLE_VIRTUAL CommandStreamReceiver *getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) const;
229+
CommandStreamReceiver *getBcsForAuxTranslation() const;
230+
MOCKABLE_VIRTUAL CommandStreamReceiver &selectCsrForBuiltinOperation(const CsrSelectionArgs &args) const;
232231
Device &getDevice() const noexcept;
233232
ClDevice &getClDevice() const { return *device; }
234233
Context &getContext() const { return *context; }
@@ -414,8 +413,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
414413
bool perfCountersEnabled = false;
415414

416415
bool isCopyOnly = false;
417-
bool bcsAllowed = false;
418-
bool bcsInitialized = false;
419416

420417
LinearStream *commandStream = nullptr;
421418

opencl/test/unit_test/command_queue/command_queue_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ struct WaitUntilCompletionTests : public ::testing::Test {
10671067

10681068
MyCmdQueue(Context *context, ClDevice *device) : CommandQueueHw<Family>(context, device, nullptr, false){};
10691069

1070-
CommandStreamReceiver *getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) override {
1070+
CommandStreamReceiver *getBcsCommandStreamReceiver(aub_stream::EngineType bcsEngineType) const override {
10711071
return bcsCsrToReturn;
10721072
}
10731073

opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -84,46 +84,6 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenAdditionalBcsWhenCreatingCommandQue
8484
EXPECT_EQ(1u, queue->countBcsEngines());
8585
}
8686

87-
HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQBcsInitializationEnabledWhenCreateCommandQueueThenBcsCountIsZero, IsAtLeastXeHpcCore) {
88-
DebugManagerStateRestore restorer;
89-
DebugManager.flags.DeferCmdQBcsInitialization.set(1u);
90-
91-
HardwareInfo hwInfo = *defaultHwInfo;
92-
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
93-
hwInfo.capabilityTable.blitterOperationsSupported = true;
94-
MockDevice *device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0);
95-
MockClDevice clDevice{device};
96-
cl_device_id clDeviceId = static_cast<cl_device_id>(&clDevice);
97-
ClDeviceVector clDevices{&clDeviceId, 1u};
98-
cl_int retVal{};
99-
auto context = std::unique_ptr<Context>{Context::create<Context>(nullptr, clDevices, nullptr, nullptr, retVal)};
100-
EXPECT_EQ(CL_SUCCESS, retVal);
101-
102-
auto queue = std::make_unique<MockCommandQueue>(*context);
103-
104-
EXPECT_EQ(0u, queue->countBcsEngines());
105-
}
106-
107-
HWTEST2_F(CommandQueuePvcAndLaterTests, givenDeferCmdQBcsInitializationDisabledWhenCreateCommandQueueThenBcsIsInitialized, IsAtLeastXeHpcCore) {
108-
DebugManagerStateRestore restorer;
109-
DebugManager.flags.DeferCmdQBcsInitialization.set(0u);
110-
111-
HardwareInfo hwInfo = *defaultHwInfo;
112-
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
113-
hwInfo.capabilityTable.blitterOperationsSupported = true;
114-
MockDevice *device = MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0);
115-
MockClDevice clDevice{device};
116-
cl_device_id clDeviceId = static_cast<cl_device_id>(&clDevice);
117-
ClDeviceVector clDevices{&clDeviceId, 1u};
118-
cl_int retVal{};
119-
auto context = std::unique_ptr<Context>{Context::create<Context>(nullptr, clDevices, nullptr, nullptr, retVal)};
120-
EXPECT_EQ(CL_SUCCESS, retVal);
121-
122-
auto queue = std::make_unique<MockCommandQueue>(*context);
123-
124-
EXPECT_NE(0u, queue->countBcsEngines());
125-
}
126-
12787
HWTEST2_F(CommandQueuePvcAndLaterTests, givenQueueWithMainBcsIsReleasedWhenNewQueueIsCreatedThenMainBcsCanBeUsedAgain, IsAtLeastXeHpcCore) {
12888
HardwareInfo hwInfo = *defaultHwInfo;
12989
hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9);
@@ -142,9 +102,9 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenQueueWithMainBcsIsReleasedWhenNewQu
142102
auto queue4 = std::make_unique<MockCommandQueue>(*context);
143103

144104
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, queue1->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS)->getOsContext().getEngineType());
145-
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS2, queue2->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2)->getOsContext().getEngineType());
146-
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS1, queue3->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1)->getOsContext().getEngineType());
147-
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS2, queue4->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2)->getOsContext().getEngineType());
105+
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS1, queue2->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1)->getOsContext().getEngineType());
106+
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS2, queue3->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2)->getOsContext().getEngineType());
107+
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS1, queue4->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1)->getOsContext().getEngineType());
148108

149109
// Releasing main BCS. Next creation should be able to grab it
150110
queue1.reset();
@@ -154,7 +114,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenQueueWithMainBcsIsReleasedWhenNewQu
154114
// Releasing link BCS. Shouldn't change anything
155115
queue2.reset();
156116
queue2 = std::make_unique<MockCommandQueue>(*context);
157-
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS1, queue2->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1)->getOsContext().getEngineType());
117+
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS2, queue2->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2)->getOsContext().getEngineType());
158118
}
159119

160120
HWTEST2_F(CommandQueuePvcAndLaterTests, givenCooperativeEngineUsageHintAndCcsWhenCreatingCommandQueueThenCreateQueueWithCooperativeEngine, IsAtLeastXeHpcCore) {
@@ -531,10 +491,10 @@ HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenMultipleEnginesInQueueWhenSelec
531491
aub_stream::ENGINE_BCS7,
532492
aub_stream::ENGINE_BCS8,
533493
});
534-
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2), &queue->selectCsrForBuiltinOperation(args));
535494
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1), &queue->selectCsrForBuiltinOperation(args));
536495
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2), &queue->selectCsrForBuiltinOperation(args));
537496
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS1), &queue->selectCsrForBuiltinOperation(args));
497+
EXPECT_EQ(queue->getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS2), &queue->selectCsrForBuiltinOperation(args));
538498
}
539499
}
540500

opencl/test/unit_test/event/event_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ TEST(Event, givenBcsCsrSetInEventWhenPeekingBcsTaskCountThenReturnCorrectTaskCou
144144
new MockClDevice{MockDevice::createWithNewExecutionEnvironment<MockAlignedMallocManagerDevice>(&hwInfo)}};
145145
MockContext context{device.get()};
146146
MockCommandQueue queue{context};
147-
queue.initializeBcsEngine(false);
148147
queue.updateBcsTaskCount(queue.bcsEngines[0]->getEngineType(), 19);
149148
Event event{&queue, CL_COMMAND_READ_BUFFER, 0, 0};
150149

opencl/test/unit_test/mocks/mock_command_queue.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ class MockCommandQueueHw : public CommandQueueHw<GfxFamily> {
257257
MockCommandQueueHw(Context *context,
258258
ClDevice *device,
259259
cl_queue_properties *properties) : BaseClass(context, device, properties, false) {
260-
this->initializeBcsEngine(false);
261260
}
262261

263262
void clearBcsEngines() {

opencl/test/unit_test/test_files/igdrcl.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ MakeIndirectAllocationsResidentAsPack = -1
383383
MakeEachAllocationResident = -1
384384
AssignBCSAtEnqueue = -1
385385
DeferCmdQGpgpuInitialization = -1
386-
DeferCmdQBcsInitialization = -1
387386
ReuseKernelBinaries = -1
388387
EnableChipsetUniqueUUID = -1
389388
ForceSimdMessageSizeInWalker = -1

shared/source/debug_settings/debug_variables_base.inl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ DECLARE_DEBUG_VARIABLE(int32_t, MakeIndirectAllocationsResidentAsPack, -1, "-1:
268268
DECLARE_DEBUG_VARIABLE(int32_t, MakeEachAllocationResident, -1, "-1: default, 0: disabled, 1: bind every allocation at creation time, 2: bind all created allocations in flush")
269269
DECLARE_DEBUG_VARIABLE(int32_t, AssignBCSAtEnqueue, -1, "-1: default, 0:disabled, 1: enabled.")
270270
DECLARE_DEBUG_VARIABLE(int32_t, DeferCmdQGpgpuInitialization, -1, "-1: default, 0:disabled, 1: enabled.")
271-
DECLARE_DEBUG_VARIABLE(int32_t, DeferCmdQBcsInitialization, -1, "-1: default, 0:disabled, 1: enabled.")
272271
DECLARE_DEBUG_VARIABLE(int32_t, ReuseKernelBinaries, -1, "-1: default, 0:disabled, 1: enabled. If enabled, driver reuses kernel binaries.")
273272

274273
/*DIRECT SUBMISSION FLAGS*/

0 commit comments

Comments
 (0)