@@ -2468,6 +2468,66 @@ HWTEST_F(DeviceTests, givenHpCopyEngineAndDebugFlagSetWhenCreatingSecondaryEngin
24682468 EXPECT_EQ (device->secondaryEngines .end (), device->secondaryEngines .find (hpEngine));
24692469}
24702470
2471+ HWTEST_F (DeviceTests, givenHpCopyEngineAndAggregatedProcessCountWhenCreatingSecondaryEnginesThenContextCountIsDividedByProcessCount) {
2472+ HardwareInfo hwInfo = *defaultHwInfo;
2473+
2474+ DebugManagerStateRestore dbgRestorer;
2475+ debugManager.flags .ContextGroupSize .set (64 );
2476+
2477+ hwInfo.featureTable .flags .ftrCCSNode = true ;
2478+ hwInfo.capabilityTable .defaultEngineType = aub_stream::ENGINE_CCS;
2479+ hwInfo.gtSystemInfo .CCSInfo .NumberOfCCSEnabled = 1 ;
2480+ hwInfo.capabilityTable .blitterOperationsSupported = true ;
2481+ hwInfo.featureTable .ftrBcsInfo = 0b111 ;
2482+
2483+ // Determine hpEngine type first
2484+ auto executionEnvironment = std::unique_ptr<ExecutionEnvironment>(NEO::MockDevice::prepareExecutionEnvironment (&hwInfo, 0u ));
2485+ const auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments [0 ]->getHelper <GfxCoreHelper>();
2486+ auto hpEngine = gfxCoreHelper.getDefaultHpCopyEngine (hwInfo);
2487+ if (hpEngine == aub_stream::EngineType::NUM_ENGINES) {
2488+ GTEST_SKIP ();
2489+ }
2490+
2491+ // Test single process scenario first
2492+ {
2493+ auto executionEnvironment = NEO::MockDevice::prepareExecutionEnvironment (&hwInfo, 0u );
2494+ auto device = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0 ));
2495+
2496+ EXPECT_NE (nullptr , device->getHpCopyEngine ());
2497+
2498+ if (device->secondaryEngines .find (hpEngine) != device->secondaryEngines .end ()) {
2499+ auto &secondaryEngines = device->secondaryEngines [hpEngine];
2500+ auto expectedContextCount = gfxCoreHelper.getContextGroupContextsCount ();
2501+ // Without process division, should have full context group count (64 contexts total)
2502+ EXPECT_EQ (expectedContextCount, secondaryEngines.engines .size ());
2503+ }
2504+ }
2505+
2506+ // Test multi-process scenario with process count division
2507+ {
2508+ auto executionEnvironment = NEO::MockDevice::prepareExecutionEnvironment (&hwInfo, 0u );
2509+ auto osInterface = new MockOsInterface ();
2510+ auto driverModelMock = std::make_unique<MockDriverModel>();
2511+ osInterface->setDriverModel (std::move (driverModelMock));
2512+ executionEnvironment->rootDeviceEnvironments [0 ]->osInterface .reset (osInterface);
2513+
2514+ const auto numProcesses = 4u ;
2515+ osInterface->numberOfProcesses = numProcesses;
2516+
2517+ auto device = std::unique_ptr<MockDevice>(MockDevice::createWithExecutionEnvironment<MockDevice>(&hwInfo, executionEnvironment, 0 ));
2518+
2519+ EXPECT_NE (nullptr , device->getHpCopyEngine ());
2520+
2521+ if (device->secondaryEngines .find (hpEngine) != device->secondaryEngines .end ()) {
2522+ auto &secondaryEngines = device->secondaryEngines [hpEngine];
2523+
2524+ // With process division: max(64/4, 2) = max(16, 2) = 16 contexts total
2525+ const uint32_t expectedContextCount = std::max (gfxCoreHelper.getContextGroupContextsCount () / numProcesses, 2u );
2526+ EXPECT_EQ (expectedContextCount, secondaryEngines.engines .size ());
2527+ }
2528+ }
2529+ }
2530+
24712531TEST_F (DeviceTests, GivenDebuggingEnabledWhenDeviceIsInitializedThenL0DebuggerIsCreated) {
24722532 auto executionEnvironment = MockDevice::prepareExecutionEnvironment (defaultHwInfo.get (), 0u );
24732533 executionEnvironment->setDebuggingMode (NEO::DebuggingMode::online);
0 commit comments