diff --git a/level_zero/core/source/device/device_imp.cpp b/level_zero/core/source/device/device_imp.cpp index 39c26b0a72..b652de4433 100644 --- a/level_zero/core/source/device/device_imp.cpp +++ b/level_zero/core/source/device/device_imp.cpp @@ -1586,11 +1586,8 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool device->populateSubDeviceCopyEngineGroups(); auto &productHelper = device->getProductHelper(); device->calculationForDisablingEuFusionWithDpasNeeded = productHelper.isCalculationForDisablingEuFusionWithDpasNeeded(hwInfo); - - auto numPriorities = static_cast(device->getNEODevice()->getGfxCoreHelper().getQueuePriorityLevels()); - - device->queuePriorityHigh = -(numPriorities + 1) / 2 + 1; - device->queuePriorityLow = (numPriorities) / 2; + device->queuePriorityHigh = gfxCoreHelper.getHighestQueuePriorityLevel(); + device->queuePriorityLow = gfxCoreHelper.getLowestQueuePriorityLevel(); return device; } @@ -1839,7 +1836,7 @@ ze_result_t DeviceImp::getCsrForOrdinalAndIndex(NEO::CommandStreamReceiver **csr if (priorityLevel.has_value()) { if (priorityLevel.value() <= 0) { priority = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH; - } else if (priorityLevel.value() > 0) { + } else { priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL; } } diff --git a/level_zero/core/test/unit_tests/mocks/mock_device.h b/level_zero/core/test/unit_tests/mocks/mock_device.h index 6aced1d8f2..ff4e26eceb 100644 --- a/level_zero/core/test/unit_tests/mocks/mock_device.h +++ b/level_zero/core/test/unit_tests/mocks/mock_device.h @@ -112,8 +112,6 @@ struct MockDeviceImp : public L0::DeviceImp { using Base::inOrderTimestampAllocator; using Base::neoDevice; using Base::queryPeerAccess; - using Base::queuePriorityHigh; - using Base::queuePriorityLow; using Base::subDeviceCopyEngineGroups; using Base::syncDispatchTokenAllocation; diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp index 327ec83731..b412df789d 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_6.cpp @@ -3406,11 +3406,11 @@ HWTEST2_F(ContextGroupStateBaseAddressGlobalStatelessTest, NEO::EngineTypeUsage engineTypeUsage; engineTypeUsage.first = hwInfo.capabilityTable.defaultEngineType; engineTypeUsage.second = NEO::EngineUsage::regular; - auto primaryCsr = neoDevice->getSecondaryEngineCsr(engineTypeUsage, 0, false)->commandStreamReceiver; + auto primaryCsr = neoDevice->getSecondaryEngineCsr(engineTypeUsage, std::nullopt, false)->commandStreamReceiver; EXPECT_EQ(nullptr, primaryCsr->getOsContext().getPrimaryContext()); EXPECT_TRUE(primaryCsr->getOsContext().isPartOfContextGroup()); - auto secondaryCsr = neoDevice->getSecondaryEngineCsr(engineTypeUsage, 0, false)->commandStreamReceiver; + auto secondaryCsr = neoDevice->getSecondaryEngineCsr(engineTypeUsage, std::nullopt, false)->commandStreamReceiver; ze_command_queue_desc_t desc = {}; auto otherCommandQueue = new MockCommandQueueHw(device, secondaryCsr, &desc); @@ -3457,11 +3457,11 @@ HWTEST2_F(ContextGroupStateBaseAddressGlobalStatelessTest, NEO::EngineTypeUsage engineTypeUsage; engineTypeUsage.first = hwInfo.capabilityTable.defaultEngineType; engineTypeUsage.second = NEO::EngineUsage::regular; - auto primaryCsr = neoDevice->getSecondaryEngineCsr(engineTypeUsage, 0, false)->commandStreamReceiver; + auto primaryCsr = neoDevice->getSecondaryEngineCsr(engineTypeUsage, std::nullopt, false)->commandStreamReceiver; EXPECT_EQ(nullptr, primaryCsr->getOsContext().getPrimaryContext()); EXPECT_TRUE(primaryCsr->getOsContext().isPartOfContextGroup()); - [[maybe_unused]] auto secondaryCsr = neoDevice->getSecondaryEngineCsr(engineTypeUsage, 0, false)->commandStreamReceiver; + [[maybe_unused]] auto secondaryCsr = neoDevice->getSecondaryEngineCsr(engineTypeUsage, std::nullopt, false)->commandStreamReceiver; ze_command_queue_desc_t queueDesc{ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC}; queueDesc.ordinal = 0u; diff --git a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp index f2cd20bf7f..6f5b661e09 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp @@ -4226,6 +4226,7 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor { MockExecutionEnvironment *executionEnvironment = new MockExecutionEnvironment{&hwInfo}; auto *neoMockDevice = NEO::MockDevice::createWithExecutionEnvironment(&hwInfo, executionEnvironment, rootDeviceIndex); + auto highestPriorityLevel = mockExecutionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHelper().getHighestQueuePriorityLevel(); MockDeviceImp deviceImp(neoMockDevice); NEO::CommandStreamReceiver *highPriorityCsr = nullptr; @@ -4249,7 +4250,7 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor ASSERT_TRUE(engineGroups[ordinalCopy].engineGroupType == NEO::EngineGroupType::copy); uint32_t index = 1; - auto result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, deviceImp.queuePriorityHigh, false); + auto result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, highestPriorityLevel, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); ASSERT_NE(nullptr, highPriorityCsr); @@ -4266,7 +4267,7 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor EXPECT_TRUE(highPriorityCsr->getOsContext().isPartOfContextGroup()); EXPECT_NE(nullptr, highPriorityCsr->getOsContext().getPrimaryContext()); - result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr2, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, deviceImp.queuePriorityHigh, false); + result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr2, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, highestPriorityLevel, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); ASSERT_NE(nullptr, highPriorityCsr2); EXPECT_NE(highPriorityCsr, highPriorityCsr2); @@ -4275,19 +4276,19 @@ HWTEST_F(DeviceTest, givenContextGroupSupportedWhenGettingHighPriorityCsrThenCor EXPECT_TRUE(highPriorityCsr2->getOsContext().isPartOfContextGroup()); index = 100; - result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, deviceImp.queuePriorityHigh, false); + result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, highestPriorityLevel, false); EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, result); index = 0; ordinal = 100; - result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, deviceImp.queuePriorityHigh, false); + result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, highestPriorityLevel, false); EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, result); // When no HP copy engine, then hp csr from group is returned NEO::CommandStreamReceiver *bcsEngine = nullptr, *bcsEngine2 = nullptr; EXPECT_EQ(nullptr, neoMockDevice->getHpCopyEngine()); - result = deviceImp.getCsrForOrdinalAndIndex(&bcsEngine, ordinalCopy, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, deviceImp.queuePriorityHigh, false); + result = deviceImp.getCsrForOrdinalAndIndex(&bcsEngine, ordinalCopy, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, highestPriorityLevel, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); ASSERT_NE(nullptr, bcsEngine); EXPECT_TRUE(bcsEngine->getOsContext().isHighPriority()); @@ -4395,7 +4396,7 @@ HWTEST2_F(DeviceTest, givenHpCopyEngineWhenGettingHighPriorityCsrThenCorrectCsrA ordinal = i; uint32_t index = 0; - auto result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, 0, false); + auto result = deviceImp.getCsrForOrdinalAndIndex(&highPriorityCsr, ordinal, index, ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH, std::nullopt, false); EXPECT_EQ(ZE_RESULT_SUCCESS, result); ASSERT_NE(nullptr, highPriorityCsr); diff --git a/opencl/source/command_queue/command_queue.cpp b/opencl/source/command_queue/command_queue.cpp index b8054addfa..2a699b66ba 100644 --- a/opencl/source/command_queue/command_queue.cpp +++ b/opencl/source/command_queue/command_queue.cpp @@ -178,7 +178,7 @@ CommandQueue::~CommandQueue() { } void tryAssignSecondaryEngine(Device &device, EngineControl *&engineControl, EngineTypeUsage engineTypeUsage) { - auto newEngine = device.getSecondaryEngineCsr(engineTypeUsage, 0, false); + auto newEngine = device.getSecondaryEngineCsr(engineTypeUsage, std::nullopt, false); if (newEngine) { engineControl = newEngine; } diff --git a/shared/source/debug_settings/debug_variables_base.inl b/shared/source/debug_settings/debug_variables_base.inl index eef44d5baa..7f6fb72d60 100644 --- a/shared/source/debug_settings/debug_variables_base.inl +++ b/shared/source/debug_settings/debug_variables_base.inl @@ -377,6 +377,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, PrintL0MetricLogs, 0, "L0 Metrics logs mask. 0 - DECLARE_DEBUG_VARIABLE(bool, PrintL0SetKernelArg, false, "Print L0 Set Kernel Arg data") DECLARE_DEBUG_VARIABLE(bool, LogIndirectDetectionKernelDetails, false, "Log information for indirect detection for each kernel") DECLARE_DEBUG_VARIABLE(bool, PrintMclData, false, "Print all parameters used for MCL"); +DECLARE_DEBUG_VARIABLE(bool, PrintSecondaryContextEngineInfo, false, "Print info about used secondary contexts engine"); /*PERFORMANCE FLAGS*/ DECLARE_DEBUG_VARIABLE(bool, DisableZeroCopyForBuffers, false, "When active all buffer allocations will not share memory with CPU.") diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index 6c0c5aa892..7390df951e 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -393,10 +393,6 @@ bool Device::createEngines() { auto highPriorityContextCount = gfxCoreHelper.getContextGroupHpContextsCount(engineGroupType, hpEngineAvailable); - if (debugManager.flags.OverrideNumHighPriorityContexts.get() != -1) { - highPriorityContextCount = static_cast(debugManager.flags.OverrideNumHighPriorityContexts.get()); - } - if (getRootDeviceEnvironment().osInterface && getRootDeviceEnvironment().osInterface->getAggregatedProcessCount() > 1) { const auto numProcesses = getRootDeviceEnvironment().osInterface->getAggregatedProcessCount(); @@ -413,6 +409,10 @@ bool Device::createEngines() { gfxCoreHelper.adjustCopyEngineRegularContextCount(engineGroup->engines.size(), contextCount); } } + + if (debugManager.flags.OverrideNumHighPriorityContexts.get() != -1) { + highPriorityContextCount = static_cast(debugManager.flags.OverrideNumHighPriorityContexts.get()); + } for (uint32_t engineIndex = 0; engineIndex < static_cast(engineGroup->engines.size()); engineIndex++) { auto engineType = engineGroup->engines[engineIndex].getEngineType(); @@ -565,7 +565,9 @@ bool Device::createEngine(EngineTypeUsage engineTypeUsage) { osContext->setContextGroupCount(useContextGroup ? gfxCoreHelper.getContextGroupContextsCount() : 0); osContext->setIsPrimaryEngine(isPrimaryEngine); osContext->setIsDefaultEngine(isDefaultEngine); - + if (isPrimaryEngine) { + osContext->overridePriority(gfxCoreHelper.getLowestQueuePriorityLevel()); + } DEBUG_BREAK_IF(getDeviceBitfield().count() > 1 && !osContext->isRootDevice()); commandStreamReceiver->setupContext(*osContext); @@ -1336,11 +1338,14 @@ EngineControl *SecondaryContexts::getEngine(EngineUsage usage, std::optionaloverridePriority(priorityLevel.value()); + } else { + int32_t lowestPriorityLevel = engines[secondaryEngineIndex].commandStreamReceiver->getGfxCoreHelper().getLowestQueuePriorityLevel(); + engines[secondaryEngineIndex].osContext->overridePriority(lowestPriorityLevel); } + PRINT_DEBUG_STRING(debugManager.flags.PrintSecondaryContextEngineInfo.get(), stdout, "SecondaryContexts::getEngine-> engineUsage: %d index %d priorityLevel: %d \n", EngineHelpers::engineUsageToString(usage).c_str(), secondaryEngineIndex, engines[secondaryEngineIndex].osContext->getPriorityLevel()); return &engines[secondaryEngineIndex]; } - void Device::stopDirectSubmissionForCopyEngine() { auto internalBcsEngine = getInternalCopyEngine(); if (internalBcsEngine == nullptr || getHardwareInfo().featureTable.ftrBcsInfo.count() > 1) { diff --git a/shared/source/helpers/gfx_core_helper.cpp b/shared/source/helpers/gfx_core_helper.cpp index ea00db6ce8..f5fbb5aa91 100644 --- a/shared/source/helpers/gfx_core_helper.cpp +++ b/shared/source/helpers/gfx_core_helper.cpp @@ -8,6 +8,7 @@ #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/debug_settings/debug_settings_manager.h" +#include "shared/source/helpers/basic_math.h" #include "shared/source/helpers/constants.h" #include "shared/source/helpers/hw_info.h" #include "shared/source/os_interface/product_helper.h" @@ -153,4 +154,12 @@ bool GfxCoreHelper::isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_ return (lowestHwRevIdWithBug <= hwInfo.platform.usRevId && hwInfo.platform.usRevId < hwRevIdWithFix); } +int32_t GfxCoreHelper::getHighestQueuePriorityLevel() const { + return -(static_cast(Math::divideAndRoundUp(getQueuePriorityLevels(), 2))) + 1; +} + +int32_t GfxCoreHelper::getLowestQueuePriorityLevel() const { + return getQueuePriorityLevels() / 2; +} + } // namespace NEO diff --git a/shared/source/helpers/gfx_core_helper.h b/shared/source/helpers/gfx_core_helper.h index fffd9db66d..912ba938bf 100644 --- a/shared/source/helpers/gfx_core_helper.h +++ b/shared/source/helpers/gfx_core_helper.h @@ -218,6 +218,8 @@ class GfxCoreHelper { virtual bool isExtendedUsmPoolSizeEnabled() const = 0; virtual bool crossEngineCacheFlushRequired() const = 0; + int32_t getHighestQueuePriorityLevel() const; + int32_t getLowestQueuePriorityLevel() const; virtual ~GfxCoreHelper() = default; diff --git a/shared/source/os_interface/os_context.h b/shared/source/os_interface/os_context.h index 6879f6504f..2fe1569773 100644 --- a/shared/source/os_interface/os_context.h +++ b/shared/source/os_interface/os_context.h @@ -43,7 +43,10 @@ class OsContext : public ReferenceTrackedObject { } bool hasPriorityLevel() const { return priorityLevel.has_value(); } - int getPriorityLevel() const { return priorityLevel.value_or(0); } + int getPriorityLevel() const { + UNRECOVERABLE_IF(!priorityLevel.has_value()); + return priorityLevel.value(); + } bool isRegular() const { return engineUsage == EngineUsage::regular; } bool isLowPriority() const { return engineUsage == EngineUsage::lowPriority; } bool isHighPriority() const { return engineUsage == EngineUsage::highPriority; } @@ -126,7 +129,7 @@ class OsContext : public ReferenceTrackedObject { const uint32_t numSupportedDevices; aub_stream::EngineType engineType = aub_stream::ENGINE_RCS; EngineUsage engineUsage; - std::optional priorityLevel; + std::optional priorityLevel = std::nullopt; const bool rootDevice = false; bool defaultContext = false; bool directSubmissionActive = false; diff --git a/shared/test/common/test_files/igdrcl.config b/shared/test/common/test_files/igdrcl.config index c769d63349..61b3f0b521 100644 --- a/shared/test/common/test_files/igdrcl.config +++ b/shared/test/common/test_files/igdrcl.config @@ -674,6 +674,7 @@ EnableUsmAllocationPoolManager = -1 ForceTotalWMTPDataSize = -1 CopyLockedMemoryBeforeWrite = 0 SplitBcsPerEngineMaxSize = -1 +PrintSecondaryContextEngineInfo = 0 HostFunctionWorkMode = -1 EnableUsmPoolResidencyTracking = -1 # Please don't edit below this line diff --git a/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp b/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp index aa68c98edd..fcaf156dc1 100644 --- a/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp +++ b/shared/test/unit_test/command_stream/command_stream_receiver_tests.cpp @@ -5960,11 +5960,11 @@ HWTEST_F(CommandStreamReceiverContextGroupTest, givenSecondaryCsrWhenGettingInte primaryCsr->createGlobalStatelessHeap(); for (uint32_t secondaryIndex = 1; secondaryIndex < secondaryEnginesCount; secondaryIndex++) { - device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false); + device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false); } for (uint32_t i = 0; i < secondaryEngines.highPriorityEnginesTotal; i++) { - device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, 0, false); + device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, std::nullopt, false); } for (uint32_t secondaryIndex = 0; secondaryIndex < secondaryEnginesCount; secondaryIndex++) { @@ -6013,11 +6013,11 @@ HWTEST_F(CommandStreamReceiverContextGroupTest, givenSecondaryRootCsrWhenGetting primaryCsr->createGlobalStatelessHeap(); for (uint32_t secondaryIndex = 1; secondaryIndex < secondaryEnginesCount; secondaryIndex++) { - device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false); + device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false); } for (uint32_t i = 0; i < secondaryEngines.highPriorityEnginesTotal; i++) { - device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, 0, false); + device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, std::nullopt, false); } for (uint32_t secondaryIndex = 0; secondaryIndex < secondaryEnginesCount; secondaryIndex++) { @@ -6143,8 +6143,8 @@ HWTEST_F(CommandStreamReceiverContextGroupTest, givenSecondaryCsrsWhenSameResour auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); const auto ccsIndex = 0; - auto &commandStreamReceiver0 = *device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false)->commandStreamReceiver; - auto &commandStreamReceiver1 = *device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false)->commandStreamReceiver; + auto &commandStreamReceiver0 = *device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false)->commandStreamReceiver; + auto &commandStreamReceiver1 = *device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false)->commandStreamReceiver; auto csr0ContextId = commandStreamReceiver0.getOsContext().getContextId(); auto csr1ContextId = commandStreamReceiver1.getOsContext().getContextId(); diff --git a/shared/test/unit_test/device/neo_device_tests.cpp b/shared/test/unit_test/device/neo_device_tests.cpp index 1e02232186..ac8d5bf4d2 100644 --- a/shared/test/unit_test/device/neo_device_tests.cpp +++ b/shared/test/unit_test/device/neo_device_tests.cpp @@ -1699,7 +1699,7 @@ HWTEST_F(DeviceTests, givenCCSEnginesAndContextGroupSizeEnabledWhenDeviceIsCreat EXPECT_EQ(contextGroupSize / numOfCCS[i] - regularContextCount, secondaryEngines.highPriorityEnginesTotal); for (size_t contextId = 0; contextId < regularContextCount + 1; contextId++) { - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false); ASSERT_NE(nullptr, engine); EXPECT_EQ(contextId + 1, secondaryEngines.regularCounter.load()); @@ -1710,7 +1710,7 @@ HWTEST_F(DeviceTests, givenCCSEnginesAndContextGroupSizeEnabledWhenDeviceIsCreat auto hpCount = contextGroupSize / numOfCCS[i] - regularContextCount; for (size_t contextId = 0; contextId < hpCount + 1; contextId++) { - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, std::nullopt, false); ASSERT_NE(nullptr, engine); EXPECT_EQ(contextId + 1, secondaryEngines.highPriorityCounter.load()); @@ -1721,7 +1721,7 @@ HWTEST_F(DeviceTests, givenCCSEnginesAndContextGroupSizeEnabledWhenDeviceIsCreat } auto internalEngine = device->getInternalEngine(); - EXPECT_NE(internalEngine.commandStreamReceiver, device->getSecondaryEngineCsr({aub_stream::EngineType::ENGINE_CCS, EngineUsage::internal}, 0, false)->commandStreamReceiver); + EXPECT_NE(internalEngine.commandStreamReceiver, device->getSecondaryEngineCsr({aub_stream::EngineType::ENGINE_CCS, EngineUsage::internal}, std::nullopt, false)->commandStreamReceiver); } } @@ -1884,7 +1884,7 @@ HWTEST_F(DeviceTests, givenRootDeviceWithCCSEngineAndContextGroupSizeEnabledWhen EXPECT_EQ(contextGroupSize - regularContextCount, secondaryEngines.highPriorityEnginesTotal); for (size_t contextId = 0; contextId < regularContextCount + 1; contextId++) { - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false); ASSERT_NE(nullptr, engine); EXPECT_EQ(contextId + 1, secondaryEngines.regularCounter.load()); @@ -1894,7 +1894,7 @@ HWTEST_F(DeviceTests, givenRootDeviceWithCCSEngineAndContextGroupSizeEnabledWhen } for (size_t contextId = 0; contextId < contextGroupSize - regularContextCount + 1; contextId++) { - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, std::nullopt, false); ASSERT_NE(nullptr, engine); EXPECT_EQ(contextId + 1, secondaryEngines.highPriorityCounter.load()); @@ -1997,7 +1997,7 @@ HWTEST_F(DeviceTests, givenContextGroupSizeEnabledWhenMoreHpEnginesCreatedThenFr for (size_t contextId = 0; contextId < maxHpContextCount + 2; contextId++) { if (contextId == 2) { - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false); ASSERT_NE(nullptr, engine); EXPECT_EQ(1, secondaryEngines.regularCounter.load()); @@ -2007,7 +2007,7 @@ HWTEST_F(DeviceTests, givenContextGroupSizeEnabledWhenMoreHpEnginesCreatedThenFr npCounter++; } if (contextId == 6) { - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false); ASSERT_NE(nullptr, engine); EXPECT_EQ(2, secondaryEngines.regularCounter.load()); @@ -2017,7 +2017,7 @@ HWTEST_F(DeviceTests, givenContextGroupSizeEnabledWhenMoreHpEnginesCreatedThenFr npCounter++; } - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, std::nullopt, false); ASSERT_NE(nullptr, engine); hpEngines.push_back(engine); hpCounter++; @@ -2104,7 +2104,7 @@ HWTEST_F(DeviceTests, givenDeviceWithCCSEngineAndAggregatedProcessesWhenDeviceIs EXPECT_EQ(hpContextCount, secondaryEngines.highPriorityEnginesTotal); for (size_t contextId = 0; contextId < regularContextCount + 1; contextId++) { - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false); ASSERT_NE(nullptr, engine); if (contextId == regularContextCount) { @@ -2113,7 +2113,7 @@ HWTEST_F(DeviceTests, givenDeviceWithCCSEngineAndAggregatedProcessesWhenDeviceIs } for (size_t contextId = 0; contextId < hpContextCount; contextId++) { - auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, 0, false); + auto engine = device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, std::nullopt, false); ASSERT_NE(nullptr, engine); EXPECT_EQ(contextId + 1, secondaryEngines.highPriorityCounter.load()); @@ -2239,7 +2239,7 @@ HWTEST_F(DeviceTests, givenNonDefaultPriorityLevelWhenGetEngineThenReturnNotPrim hwInfo.featureTable.ftrBcsInfo = 0; hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; - int nonDefaultPriorityLevel = 4; + int nonDefaultPriorityLevel = 0; { auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo)); auto &secondaryEngines = device->secondaryEngines[EngineHelpers::mapCcsIndexToEngineType(0)]; @@ -2294,11 +2294,11 @@ HWTEST_F(DeviceTests, givenContextGroupEnabledWhenGettingSecondaryEngineThenReso EXPECT_EQ(primaryCsr->getPreemptionAllocation(), secondaryEngines.engines[secondaryIndex].commandStreamReceiver->getPreemptionAllocation()); } - device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, 0, false); + device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::regular}, std::nullopt, false); } for (uint32_t i = 0; i < secondaryEngines.highPriorityEnginesTotal; i++) { - device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, 0, false); + device->getSecondaryEngineCsr({EngineHelpers::mapCcsIndexToEngineType(ccsIndex), EngineUsage::highPriority}, std::nullopt, false); } for (uint32_t secondaryIndex = 0; secondaryIndex < secondaryEnginesCount; secondaryIndex++) { @@ -2373,10 +2373,10 @@ HWTEST_F(DeviceTests, givenContextGroupEnabledAndAllocationUsedBySeconadryContex auto secondaryEnginesCount = secondaryEngines.engines.size(); ASSERT_EQ(5u, secondaryEnginesCount); - auto engine = device->getSecondaryEngineCsr({aub_stream::ENGINE_CCS, EngineUsage::regular}, 0, false); + auto engine = device->getSecondaryEngineCsr({aub_stream::ENGINE_CCS, EngineUsage::regular}, std::nullopt, false); ASSERT_NE(nullptr, engine); auto csr = engine->commandStreamReceiver; - auto engine2 = device->getSecondaryEngineCsr({aub_stream::ENGINE_CCS, EngineUsage::regular}, 0, false); + auto engine2 = device->getSecondaryEngineCsr({aub_stream::ENGINE_CCS, EngineUsage::regular}, std::nullopt, false); ASSERT_NE(nullptr, engine2); auto csr2 = engine2->commandStreamReceiver; ASSERT_NE(csr, csr2); @@ -2443,11 +2443,11 @@ HWTEST_F(DeviceTests, givenCopyEnginesWhenCreatingSecondaryContextsThenUseCopyTy EXPECT_EQ(expectedEngineCount, device->secondaryEngines[engineType].engines.size()); - auto engine = device->getSecondaryEngineCsr({engineType, usage}, 0, false); + auto engine = device->getSecondaryEngineCsr({engineType, usage}, std::nullopt, false); ASSERT_NE(nullptr, engine); auto csr = engine->commandStreamReceiver; - auto engine2 = device->getSecondaryEngineCsr({engineType, usage}, 0, false); + auto engine2 = device->getSecondaryEngineCsr({engineType, usage}, std::nullopt, false); ASSERT_NE(nullptr, engine2); auto csr2 = engine2->commandStreamReceiver; diff --git a/shared/test/unit_test/os_interface/os_context_tests.cpp b/shared/test/unit_test/os_interface/os_context_tests.cpp index aef3ccd2d4..68f32822dc 100644 --- a/shared/test/unit_test/os_interface/os_context_tests.cpp +++ b/shared/test/unit_test/os_interface/os_context_tests.cpp @@ -164,7 +164,7 @@ TEST(OSContext, givenOsContextWhenCreatedThenPriorityLevelIsNotSet) { auto osContext = OsContext::create(nullptr, 0, 0, engineDescriptor); EXPECT_FALSE(osContext->hasPriorityLevel()); - EXPECT_EQ(0, osContext->getPriorityLevel()); // Default value + EXPECT_ANY_THROW(osContext->getPriorityLevel()); // Default value delete osContext; }