Skip to content

Commit ebbd042

Browse files
Add root CSR to engine groups
Signed-off-by: Maciej Dziuban <[email protected]> Related-To: NEO-5120
1 parent 55f3c8f commit ebbd042

File tree

6 files changed

+33
-24
lines changed

6 files changed

+33
-24
lines changed

opencl/source/cl_device/cl_device_caps.cpp

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2020 Intel Corporation
2+
* Copyright (C) 2018-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -361,24 +361,16 @@ void ClDevice::initializeCaps() {
361361
}
362362

363363
const std::vector<std::vector<EngineControl>> &queueFamilies = this->getDevice().getEngineGroups();
364-
if (queueFamilies.size() > 0) {
365-
for (int queueFamilyIndex = 0; queueFamilyIndex < static_cast<int>(EngineGroupType::MaxEngineGroups); queueFamilyIndex++) {
366-
const std::vector<EngineControl> &enginesInFamily = queueFamilies.at(queueFamilyIndex);
367-
if (enginesInFamily.size() > 0) {
368-
const auto engineGroupType = static_cast<EngineGroupType>(queueFamilyIndex);
369-
cl_queue_family_properties_intel properties;
370-
properties.capabilities = getQueueFamilyCapabilities(engineGroupType);
371-
properties.count = static_cast<cl_uint>(enginesInFamily.size());
372-
properties.properties = deviceInfo.queueOnHostProperties;
373-
deviceInfo.queueFamilyProperties.push_back(properties);
374-
}
364+
for (size_t queueFamilyIndex = 0u; queueFamilyIndex < queueFamilies.size(); queueFamilyIndex++) {
365+
const std::vector<EngineControl> &enginesInFamily = queueFamilies.at(queueFamilyIndex);
366+
if (enginesInFamily.size() > 0) {
367+
const auto engineGroupType = static_cast<EngineGroupType>(queueFamilyIndex);
368+
cl_queue_family_properties_intel properties;
369+
properties.capabilities = getQueueFamilyCapabilities(engineGroupType);
370+
properties.count = static_cast<cl_uint>(enginesInFamily.size());
371+
properties.properties = deviceInfo.queueOnHostProperties;
372+
deviceInfo.queueFamilyProperties.push_back(properties);
375373
}
376-
} else {
377-
cl_queue_family_properties_intel properties;
378-
properties.capabilities = CL_QUEUE_DEFAULT_CAPABILITIES_INTEL;
379-
properties.count = 1;
380-
properties.properties = deviceInfo.queueOnHostProperties;
381-
deviceInfo.queueFamilyProperties.push_back(properties);
382374
}
383375

384376
deviceInfo.preemptionSupported = false;

opencl/test/unit_test/command_queue/command_queue_tests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2020 Intel Corporation
2+
* Copyright (C) 2018-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -1347,6 +1347,8 @@ struct CommandQueueOnSpecificEngineTests : ::testing::Test {
13471347

13481348
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const override {
13491349
switch (engineType) {
1350+
case aub_stream::ENGINE_RCS:
1351+
return EngineGroupType::RenderCompute;
13501352
case aub_stream::ENGINE_CCS:
13511353
return EngineGroupType::Compute;
13521354
case aub_stream::ENGINE_BCS:

opencl/test/unit_test/device/device_tests.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -350,6 +350,13 @@ TEST(DeviceCreation, givenDeviceWhenCheckingParentDeviceThenCorrectValueIsReturn
350350
EXPECT_EQ(deviceFactory.rootDevices[1], deviceFactory.subDevices[3]->getParentDevice());
351351
}
352352

353+
TEST(DeviceCreation, givenRootDeviceWithSubDevicesWhenCheckingEngineGroupsThenItHasOneNonEmptyGroup) {
354+
UltDeviceFactory deviceFactory{1, 2};
355+
EXPECT_EQ(static_cast<size_t>(EngineGroupType::MaxEngineGroups), deviceFactory.rootDevices[0]->getEngineGroups().size());
356+
EXPECT_NE(nullptr, deviceFactory.rootDevices[0]->getNonEmptyEngineGroup(0));
357+
EXPECT_EQ(nullptr, deviceFactory.rootDevices[0]->getNonEmptyEngineGroup(1));
358+
}
359+
353360
using DeviceHwTest = ::testing::Test;
354361

355362
HWTEST_F(DeviceHwTest, givenHwHelperInputWhenInitializingCsrThenCreatePageTableManagerIfNeeded) {

opencl/test/unit_test/device/get_device_info_tests.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -696,6 +696,8 @@ class MockHwHelper : public HwHelperHw<GfxFamily> {
696696

697697
EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, const HardwareInfo &hwInfo) const override {
698698
switch (engineType) {
699+
case aub_stream::ENGINE_RCS:
700+
return EngineGroupType::RenderCompute;
699701
case aub_stream::ENGINE_CCS:
700702
return EngineGroupType::Compute;
701703
case aub_stream::ENGINE_BCS:

shared/source/device/root_device.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 Intel Corporation
2+
* Copyright (C) 2019-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -99,6 +99,7 @@ bool RootDevice::createEngines() {
9999
if (getNumSubDevices() < 2) {
100100
return Device::createEngines();
101101
} else {
102+
this->engineGroups.resize(static_cast<uint32_t>(EngineGroupType::MaxEngineGroups));
102103
initializeRootCommandStreamReceiver();
103104
}
104105
return true;
@@ -118,7 +119,10 @@ void RootDevice::initializeRootCommandStreamReceiver() {
118119
rootCommandStreamReceiver->initializeTagAllocation();
119120
rootCommandStreamReceiver->createGlobalFenceAllocation();
120121
commandStreamReceivers.push_back(std::move(rootCommandStreamReceiver));
121-
engines.emplace_back(commandStreamReceivers.back().get(), osContext);
122+
123+
EngineControl engine{commandStreamReceivers.back().get(), osContext};
124+
engines.push_back(engine);
125+
addEngineToEngineGroup(engine);
122126
}
123127

124128
} // namespace NEO

shared/test/unit_test/mocks/mock_device.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -31,6 +31,7 @@ MockDevice::MockDevice()
3131
this->executionEnvironment->memoryManager = std::move(this->mockMemoryManager);
3232
this->engines.resize(1);
3333
this->engines[0] = {commandStreamReceiver, nullptr};
34+
this->engineGroups.resize(static_cast<uint32_t>(EngineGroupType::MaxEngineGroups));
3435
initializeCaps();
3536
}
3637

@@ -45,6 +46,7 @@ MockDevice::MockDevice(ExecutionEnvironment *executionEnvironment, uint32_t root
4546
bool aubUsage = (testMode == TestMode::AubTests) || (testMode == TestMode::AubTestsWithTbx);
4647
this->mockMemoryManager.reset(new MemoryManagerCreate<OsAgnosticMemoryManager>(false, enableLocalMemory, aubUsage, *executionEnvironment));
4748
this->osTime = MockOSTime::create();
49+
this->engineGroups.resize(static_cast<uint32_t>(EngineGroupType::MaxEngineGroups));
4850
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(&hwInfo);
4951
executionEnvironment->initializeMemoryManager();
5052
initializeCaps();

0 commit comments

Comments
 (0)