@@ -906,6 +906,74 @@ HWTEST_F(CommandQueueTests, givenEngineUsageHintSetWithInvalidValueWhenCreatingC
906906 delete pCmdQ;
907907}
908908
909+ HWTEST_F (CommandQueueTests, givenNodeOrdinalSetWithRenderEngineWhenCreatingCommandQueueWithPropertiesWhereComputeEngineSetThenProperEngineUsed) {
910+ DebugManagerStateRestore restore;
911+ auto forcedEngine = EngineHelpers::remapEngineTypeToHwSpecific (aub_stream::EngineType::ENGINE_RCS, *defaultHwInfo);
912+ DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(forcedEngine));
913+
914+ auto pDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get ()));
915+ MockContext context (pDevice.get ());
916+
917+ cl_uint expectedEngineIndex = 0u ;
918+
919+ cl_int retVal = CL_SUCCESS;
920+ auto userPropertiesEngineGroupType = static_cast <cl_uint>(EngineGroupType::Compute);
921+ cl_uint userPropertiesEngineIndex = 2u ;
922+
923+ cl_queue_properties propertiesCooperativeQueue[] = {CL_QUEUE_FAMILY_INTEL, userPropertiesEngineGroupType, CL_QUEUE_INDEX_INTEL, userPropertiesEngineIndex, 0 };
924+
925+ const HwHelper &hwHelper = HwHelper::get (defaultHwInfo->platform .eRenderCoreFamily );
926+ EXPECT_NE (hwHelper.getEngineGroupType (static_cast <aub_stream::EngineType>(forcedEngine), EngineUsage::Regular, *defaultHwInfo),
927+ static_cast <EngineGroupType>(userPropertiesEngineGroupType));
928+ EXPECT_NE (expectedEngineIndex, userPropertiesEngineIndex);
929+
930+ auto pCmdQ = CommandQueue::create (
931+ &context,
932+ pDevice.get (),
933+ propertiesCooperativeQueue,
934+ false ,
935+ retVal);
936+ EXPECT_EQ (CL_SUCCESS, retVal);
937+ EXPECT_NE (nullptr , pCmdQ);
938+ EXPECT_EQ (forcedEngine, pCmdQ->getGpgpuEngine ().getEngineType ());
939+ delete pCmdQ;
940+ }
941+
942+ HWTEST_F (CommandQueueTests, givenNodeOrdinalSetWithCcsEngineWhenCreatingCommandQueueWithPropertiesAndRegularCcsEngineNotExistThenEngineNotForced) {
943+ DebugManagerStateRestore restore;
944+ auto defaultEngine = EngineHelpers::remapEngineTypeToHwSpecific (aub_stream::EngineType::ENGINE_RCS, *defaultHwInfo);
945+ DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(defaultEngine));
946+
947+ auto pDevice = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(defaultHwInfo.get ()));
948+ MockContext context (pDevice.get ());
949+
950+ cl_int retVal = CL_SUCCESS;
951+
952+ cl_queue_properties propertiesCooperativeQueue[] = {CL_QUEUE_FAMILY_INTEL, 0 , CL_QUEUE_INDEX_INTEL, 0 , 0 };
953+
954+ struct FakeHwHelper : HwHelperHw<FamilyType> {
955+ EngineGroupType getEngineGroupType (aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const override {
956+ return EngineGroupType::RenderCompute;
957+ }
958+ };
959+ RAIIHwHelperFactory<FakeHwHelper> overrideHwHelper{defaultHwInfo->platform .eRenderCoreFamily };
960+
961+ auto forcedEngine = EngineHelpers::remapEngineTypeToHwSpecific (aub_stream::EngineType::ENGINE_CCS, *defaultHwInfo);
962+ DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(forcedEngine));
963+
964+ auto pCmdQ = CommandQueue::create (
965+ &context,
966+ pDevice.get (),
967+ propertiesCooperativeQueue,
968+ false ,
969+ retVal);
970+ EXPECT_EQ (CL_SUCCESS, retVal);
971+ EXPECT_NE (nullptr , pCmdQ);
972+ EXPECT_NE (forcedEngine, pCmdQ->getGpgpuEngine ().getEngineType ());
973+ EXPECT_EQ (defaultEngine, pCmdQ->getGpgpuEngine ().getEngineType ());
974+ delete pCmdQ;
975+ }
976+
909977struct WaitForQueueCompletionTests : public ::testing::Test {
910978 template <typename Family>
911979 struct MyCmdQueue : public CommandQueueHw <Family> {
@@ -2506,16 +2574,17 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedRcsOsContextWhenC
25062574 VariableBackup<HardwareInfo> backupHwInfo (defaultHwInfo.get ());
25072575 defaultHwInfo->capabilityTable .blitterOperationsSupported = true ;
25082576 DebugManagerStateRestore restore{};
2509- DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(aub_stream::EngineType::ENGINE_RCS));
25102577 DebugManager.flags .DeferOsContextInitialization .set (1 );
2578+ DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(aub_stream::EngineType::ENGINE_CCS));
25112579
25122580 auto raiiHwHelper = overrideHwHelper<FamilyType, MockHwHelper<FamilyType, 1 , 1 , 1 >>();
25132581 MockContext context{};
25142582 cl_command_queue_properties properties[5 ] = {};
25152583
2516- OsContext &osContext = *context.getDevice (0 )->getEngine (aub_stream::ENGINE_CCS , EngineUsage::Regular).osContext ;
2584+ OsContext &osContext = *context.getDevice (0 )->getEngine (aub_stream::ENGINE_RCS , EngineUsage::Regular).osContext ;
25172585 EXPECT_FALSE (osContext.isInitialized ());
25182586
2587+ DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(aub_stream::EngineType::ENGINE_RCS));
25192588 const auto ccsFamilyIndex = static_cast <cl_uint>(context.getDevice (0 )->getDevice ().getEngineGroupIndexFromEngineGroupType (EngineGroupType::Compute));
25202589 fillProperties (properties, ccsFamilyIndex, 0 );
25212590 MockCommandQueueHw<FamilyType> queue (&context, context.getDevice (0 ), properties);
@@ -2527,16 +2596,17 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedCcsOsContextWhenC
25272596 VariableBackup<HardwareInfo> backupHwInfo (defaultHwInfo.get ());
25282597 defaultHwInfo->capabilityTable .blitterOperationsSupported = true ;
25292598 DebugManagerStateRestore restore{};
2530- DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(aub_stream::EngineType::ENGINE_CCS ));
2599+ DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(aub_stream::EngineType::ENGINE_RCS ));
25312600 DebugManager.flags .DeferOsContextInitialization .set (1 );
25322601
25332602 auto raiiHwHelper = overrideHwHelper<FamilyType, MockHwHelper<FamilyType, 1 , 1 , 1 >>();
25342603 MockContext context{};
25352604 cl_command_queue_properties properties[5 ] = {};
25362605
2537- OsContext &osContext = *context.getDevice (0 )->getEngine (aub_stream::ENGINE_RCS , EngineUsage::Regular).osContext ;
2606+ OsContext &osContext = *context.getDevice (0 )->getEngine (aub_stream::ENGINE_CCS , EngineUsage::Regular).osContext ;
25382607 EXPECT_FALSE (osContext.isInitialized ());
25392608
2609+ DebugManager.flags .NodeOrdinal .set (static_cast <int32_t >(aub_stream::EngineType::ENGINE_CCS));
25402610 const auto rcsFamilyIndex = static_cast <cl_uint>(context.getDevice (0 )->getDevice ().getEngineGroupIndexFromEngineGroupType (EngineGroupType::RenderCompute));
25412611 fillProperties (properties, rcsFamilyIndex, 0 );
25422612 MockCommandQueueHw<FamilyType> queue (&context, context.getDevice (0 ), properties);
0 commit comments