Skip to content

Commit 3f5b9df

Browse files
Pass EngineUsage to getEngine
Signed-off-by: Maciej Dziuban <[email protected]> Related-To: NEO-5610
1 parent 274d2ff commit 3f5b9df

File tree

18 files changed

+40
-39
lines changed

18 files changed

+40
-39
lines changed

level_zero/core/test/unit_tests/sources/kernel/test_kernel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ TEST_F(KernelIsaTests, givenKernelAllocationInLocalMemoryWhenCreatingWithoutAllo
994994

995995
KernelImmutableData kernelImmutableData(device);
996996

997-
auto bcsCsr = device->getNEODevice()->getEngine(aub_stream::EngineType::ENGINE_BCS, false, false).commandStreamReceiver;
997+
auto bcsCsr = device->getNEODevice()->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver;
998998
auto initialTaskCount = bcsCsr->peekTaskCount();
999999

10001000
kernelImmutableData.initialize(&kernelInfo, device, 0, nullptr, nullptr, false);
@@ -1020,7 +1020,7 @@ TEST_F(KernelIsaTests, givenKernelAllocationInLocalMemoryWhenCreatingWithAllowed
10201020

10211021
KernelImmutableData kernelImmutableData(device);
10221022

1023-
auto bcsCsr = device->getNEODevice()->getEngine(aub_stream::EngineType::ENGINE_BCS, false, false).commandStreamReceiver;
1023+
auto bcsCsr = device->getNEODevice()->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver;
10241024
auto initialTaskCount = bcsCsr->peekTaskCount();
10251025

10261026
kernelImmutableData.initialize(&kernelInfo, device, 0, nullptr, nullptr, false);
@@ -1044,7 +1044,7 @@ TEST_F(KernelIsaTests, givenKernelAllocationInLocalMemoryWhenCreatingWithDisallo
10441044

10451045
KernelImmutableData kernelImmutableData(device);
10461046

1047-
auto bcsCsr = device->getNEODevice()->getEngine(aub_stream::EngineType::ENGINE_BCS, false, false).commandStreamReceiver;
1047+
auto bcsCsr = device->getNEODevice()->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver;
10481048
auto initialTaskCount = bcsCsr->peekTaskCount();
10491049

10501050
kernelImmutableData.initialize(&kernelInfo, device, 0, nullptr, nullptr, false);

opencl/source/cl_device/cl_device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ ClDevice *ClDevice::getDeviceById(uint32_t deviceId) {
139139
bool ClDevice::getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const { return device.getDeviceAndHostTimer(deviceTimestamp, hostTimestamp); }
140140
bool ClDevice::getHostTimer(uint64_t *hostTimestamp) const { return device.getHostTimer(hostTimestamp); }
141141
const HardwareInfo &ClDevice::getHardwareInfo() const { return device.getHardwareInfo(); }
142-
EngineControl &ClDevice::getEngine(aub_stream::EngineType engineType, bool lowPriority, bool internalUsage) { return device.getEngine(engineType, lowPriority, internalUsage); }
142+
EngineControl &ClDevice::getEngine(aub_stream::EngineType engineType, EngineUsage engineUsage) { return device.getEngine(engineType, engineUsage); }
143143
EngineControl &ClDevice::getDefaultEngine() { return device.getDefaultEngine(); }
144144
EngineControl &ClDevice::getInternalEngine() { return device.getInternalEngine(); }
145145
std::atomic<uint32_t> &ClDevice::getSelectorCopyEngine() { return device.getSelectorCopyEngine(); }

opencl/source/cl_device/cl_device.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#pragma once
99
#include "shared/source/command_stream/preemption_mode.h"
1010
#include "shared/source/helpers/common_types.h"
11+
#include "shared/source/helpers/engine_node_helper.h"
1112
#include "shared/source/utilities/reference_tracked_object.h"
1213

1314
#include "opencl/source/api/cl_types.h"
@@ -65,7 +66,7 @@ class ClDevice : public BaseObject<_cl_device_id> {
6566
bool getDeviceAndHostTimer(uint64_t *deviceTimestamp, uint64_t *hostTimestamp) const;
6667
bool getHostTimer(uint64_t *hostTimestamp) const;
6768
const HardwareInfo &getHardwareInfo() const;
68-
EngineControl &getEngine(aub_stream::EngineType engineType, bool lowPriority, bool internalUsage);
69+
EngineControl &getEngine(aub_stream::EngineType engineType, EngineUsage engineUsage);
6970
EngineControl &getDefaultEngine();
7071
EngineControl &getInternalEngine();
7172
std::atomic<uint32_t> &getSelectorCopyEngine();

opencl/source/command_queue/command_queue.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ CommandQueue::CommandQueue(Context *context, ClDevice *device, const cl_queue_pr
8181
}
8282
if (bcsAllowed) {
8383
auto &selectorCopyEngine = device->getDeviceById(0)->getSelectorCopyEngine();
84-
bcsEngine = &device->getDeviceById(0)->getEngine(EngineHelpers::getBcsEngineType(hwInfo, selectorCopyEngine), false, false);
84+
bcsEngine = &device->getDeviceById(0)->getEngine(EngineHelpers::getBcsEngineType(hwInfo, selectorCopyEngine), EngineUsage::Regular);
8585
}
8686
}
8787

@@ -870,11 +870,11 @@ void CommandQueue::overrideEngine(aub_stream::EngineType engineType) {
870870
const bool isEngineCopyOnly = hwHelper.isCopyOnlyEngineType(engineGroupType);
871871

872872
if (isEngineCopyOnly) {
873-
bcsEngine = &device->getEngine(engineType, false, false);
873+
bcsEngine = &device->getEngine(engineType, EngineUsage::Regular);
874874
timestampPacketContainer = std::make_unique<TimestampPacketContainer>();
875875
isCopyOnly = true;
876876
} else {
877-
gpgpuEngine = &device->getEngine(engineType, false, false);
877+
gpgpuEngine = &device->getEngine(engineType, EngineUsage::Regular);
878878
}
879879
}
880880

opencl/source/command_queue/command_queue_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CommandQueueHw : public CommandQueue {
4242

4343
if (clPriority & static_cast<cl_queue_priority_khr>(CL_QUEUE_PRIORITY_LOW_KHR)) {
4444
priority = QueuePriority::LOW;
45-
this->gpgpuEngine = &device->getDeviceById(0)->getEngine(getChosenEngineType(device->getHardwareInfo()), true, false);
45+
this->gpgpuEngine = &device->getDeviceById(0)->getEngine(getChosenEngineType(device->getHardwareInfo()), EngineUsage::LowPriority);
4646
} else if (clPriority & static_cast<cl_queue_priority_khr>(CL_QUEUE_PRIORITY_MED_KHR)) {
4747
priority = QueuePriority::MEDIUM;
4848
} else if (clPriority & static_cast<cl_queue_priority_khr>(CL_QUEUE_PRIORITY_HIGH_KHR)) {

opencl/test/unit_test/api/cl_create_command_queue_with_properties_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ HWTEST_F(LowPriorityCommandQueueTest, GivenDeviceWithSubdevicesWhenCreatingLowPr
562562

563563
auto commandQueueObj = castToObject<CommandQueue>(cmdQ);
564564
auto subDevice = context.getDevice(0)->getDeviceById(0);
565-
auto engine = subDevice->getEngine(getChosenEngineType(subDevice->getHardwareInfo()), true, false);
565+
auto engine = subDevice->getEngine(getChosenEngineType(subDevice->getHardwareInfo()), EngineUsage::LowPriority);
566566

567567
EXPECT_EQ(engine.commandStreamReceiver, &commandQueueObj->getGpgpuCommandStreamReceiver());
568568
EXPECT_EQ(engine.osContext, &commandQueueObj->getGpgpuCommandStreamReceiver().getOsContext());

opencl/test/unit_test/command_queue/blit_enqueue_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct BlitEnqueueTests : public ::testing::Test {
8888
capabilityTable.blitterOperationsSupported = true;
8989

9090
if (createBcsEngine) {
91-
auto &engine = device->getEngine(getChosenEngineType(device->getHardwareInfo()), true, false);
91+
auto &engine = device->getEngine(getChosenEngineType(device->getHardwareInfo()), EngineUsage::LowPriority);
9292
bcsOsContext.reset(OsContext::create(nullptr, 1, device->getDeviceBitfield(), EngineTypeUsage{aub_stream::ENGINE_BCS, EngineUsage::Regular}, PreemptionMode::Disabled, false));
9393
engine.osContext = bcsOsContext.get();
9494
engine.commandStreamReceiver->setupContext(*bcsOsContext);

opencl/test/unit_test/command_queue/command_queue_tests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ HWTEST_P(CommandQueueWithBlitOperationsTests, givenDeviceWithSubDevicesSupportin
256256
std::unique_ptr<OsContext> bcsOsContext;
257257

258258
auto subDevice = device->getDeviceById(0);
259-
auto bcsEngine = subDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, false, false);
259+
auto bcsEngine = subDevice->getEngine(aub_stream::EngineType::ENGINE_BCS, EngineUsage::Regular);
260260

261261
MockCommandQueue cmdQ(nullptr, device.get(), 0);
262262
auto cmdType = GetParam();
@@ -1552,7 +1552,7 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenMultipleFamiliesWhenCreatingQue
15521552
cl_command_queue_properties properties[5] = {};
15531553

15541554
fillProperties(properties, 0, 0);
1555-
EngineControl &engineCcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_CCS, false, false);
1555+
EngineControl &engineCcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_CCS, EngineUsage::Regular);
15561556
MockCommandQueue queueRcs(&context, context.getDevice(0), properties);
15571557
EXPECT_EQ(&engineCcs, &queueRcs.getGpgpuEngine());
15581558
EXPECT_FALSE(queueRcs.isCopyOnly);
@@ -1561,7 +1561,7 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenMultipleFamiliesWhenCreatingQue
15611561
EXPECT_EQ(properties[3], queueRcs.getQueueIndexWithinFamily());
15621562

15631563
fillProperties(properties, 1, 0);
1564-
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, false, false);
1564+
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::Regular);
15651565
MockCommandQueue queueBcs(&context, context.getDevice(0), properties);
15661566
EXPECT_EQ(engineBcs.commandStreamReceiver, queueBcs.getBcsCommandStreamReceiver());
15671567
EXPECT_TRUE(queueBcs.isCopyOnly);
@@ -1594,7 +1594,7 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenSubDeviceAndMultipleFamiliesWhe
15941594
cl_command_queue_properties properties[5] = {};
15951595

15961596
fillProperties(properties, 0, 0);
1597-
EngineControl &engineCcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_CCS, false, false);
1597+
EngineControl &engineCcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_CCS, EngineUsage::Regular);
15981598
MockCommandQueue queueRcs(&context, context.getDevice(0), properties);
15991599
EXPECT_EQ(&engineCcs, &queueRcs.getGpgpuEngine());
16001600
EXPECT_FALSE(queueRcs.isCopyOnly);
@@ -1603,7 +1603,7 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenSubDeviceAndMultipleFamiliesWhe
16031603
EXPECT_EQ(properties[3], queueRcs.getQueueIndexWithinFamily());
16041604

16051605
fillProperties(properties, 1, 0);
1606-
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, false, false);
1606+
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::Regular);
16071607
MockCommandQueue queueBcs(&context, context.getDevice(0), properties);
16081608
EXPECT_EQ(engineBcs.commandStreamReceiver, queueBcs.getBcsCommandStreamReceiver());
16091609
EXPECT_TRUE(queueBcs.isCopyOnly);
@@ -1619,7 +1619,7 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenBcsFamilySelectedWhenCreatingQu
16191619
cl_command_queue_properties properties[5] = {};
16201620

16211621
fillProperties(properties, 0, 0);
1622-
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, false, false);
1622+
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::Regular);
16231623
MockCommandQueue queueBcs(&context, context.getDevice(0), properties);
16241624
EXPECT_EQ(engineBcs.commandStreamReceiver, queueBcs.getBcsCommandStreamReceiver());
16251625
EXPECT_TRUE(queueBcs.isCopyOnly);

opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDCountKernel
249249

250250
HwHelper &hwHelper = HwHelper::get(pClDevice->getDevice().getHardwareInfo().platform.eRenderCoreFamily);
251251
if (!hwHelper.isCooperativeDispatchSupported(pCmdQ2->getGpgpuEngine().getEngineType(), pClDevice->getDevice().getHardwareInfo().platform.eProductFamily)) {
252-
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, true, false).osContext;
252+
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext;
253253
}
254254

255255
auto kernel = Kernel::create(pProgram, pProgram->getKernelInfosForKernel("CopyBuffer"), &retVal);
@@ -294,7 +294,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenNotAllArgsAreSetButSetKernelArgIsCalled
294294

295295
HwHelper &hwHelper = HwHelper::get(pClDevice->getDevice().getHardwareInfo().platform.eRenderCoreFamily);
296296
if (!hwHelper.isCooperativeDispatchSupported(pCmdQ2->getGpgpuEngine().getEngineType(), pClDevice->getDevice().getHardwareInfo().platform.eProductFamily)) {
297-
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, true, false).osContext;
297+
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext;
298298
}
299299

300300
auto kernel = Kernel::create(pProgram, pProgram->getKernelInfosForKernel("CopyBuffer"), &retVal);
@@ -339,7 +339,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenSetKernelArgIsCalledForEachArgButAtLeas
339339

340340
HwHelper &hwHelper = HwHelper::get(pClDevice->getDevice().getHardwareInfo().platform.eRenderCoreFamily);
341341
if (!hwHelper.isCooperativeDispatchSupported(pCmdQ2->getGpgpuEngine().getEngineType(), pClDevice->getDevice().getHardwareInfo().platform.eProductFamily)) {
342-
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, true, false).osContext;
342+
pCmdQ2->getGpgpuEngine().osContext = pCmdQ2->getDevice().getEngine(aub_stream::ENGINE_CCS, EngineUsage::LowPriority).osContext;
343343
}
344344

345345
auto kernel = Kernel::create(pProgram, pProgram->getKernelInfosForKernel("CopyBuffer"), &retVal);

opencl/test/unit_test/command_stream/command_stream_receiver_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,9 +1218,9 @@ HWTEST_F(CommandStreamReceiverTest, whenCreatingWorkPartitionAllocationThenIniti
12181218
rootDevice.getRootDeviceEnvironment().getMutableHardwareInfo()->featureTable.ftrBcsInfo = 1;
12191219
UltCommandStreamReceiver<FamilyType> &csr = rootDevice.getUltCommandStreamReceiver<FamilyType>();
12201220
UltCommandStreamReceiver<FamilyType> *bcsCsrs[] = {
1221-
reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(rootDevice.getDeviceById(0)->getEngine(aub_stream::ENGINE_BCS, false, false).commandStreamReceiver),
1222-
reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(rootDevice.getDeviceById(1)->getEngine(aub_stream::ENGINE_BCS, false, false).commandStreamReceiver),
1223-
reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(rootDevice.getDeviceById(2)->getEngine(aub_stream::ENGINE_BCS, false, false).commandStreamReceiver),
1221+
reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(rootDevice.getDeviceById(0)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver),
1222+
reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(rootDevice.getDeviceById(1)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver),
1223+
reinterpret_cast<UltCommandStreamReceiver<FamilyType> *>(rootDevice.getDeviceById(2)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::Regular).commandStreamReceiver),
12241224
};
12251225
const size_t bcsStarts[] = {
12261226
bcsCsrs[0]->commandStream.getUsed(),

0 commit comments

Comments
 (0)