mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Add support for limiting number of CCS engines
This commit adds support for ZEX_NUMBER_OF_CCS flag which can be used for limiting number of CCS engines Format is as follows: ZEX_NUMBER_OF_CCS=RootDeviceIndex:NumberOfCCS;RootDeviceIndex:NumberOfCCS... i.e. setting Root Device Index 0 to 4 CCS, and Root Device Index 1 To 1 CCS ZEX_NUMBER_OF_CCS=0:4,1:1 Related-To: NEO-7195 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
787b71c7d0
commit
7b86c8da2e
@@ -6,9 +6,11 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_builtins.h"
|
||||
#include "shared/test/common/mocks/mock_compiler_interface.h"
|
||||
@@ -16,6 +18,7 @@
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_memory_manager.h"
|
||||
#include "shared/test/common/mocks/ult_device_factory.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
@@ -384,7 +387,9 @@ TEST_F(DeviceGetCapsTest, givenFlagEnabled64kbPagesWhenCallConstructorMemoryMana
|
||||
EXPECT_TRUE(memoryManager->peek64kbPagesEnabled(0u));
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenDispatchGlobalsAllocationFailsOnSecondSubDeviceThenRtDispatchGlobalsInfoIsNull) {
|
||||
using DeviceTests = ::testing::Test;
|
||||
|
||||
TEST_F(DeviceTests, givenDispatchGlobalsAllocationFailsOnSecondSubDeviceThenRtDispatchGlobalsInfoIsNull) {
|
||||
class FailMockMemoryManager : public MockMemoryManager {
|
||||
public:
|
||||
FailMockMemoryManager(NEO::ExecutionEnvironment &executionEnvironment) : MockMemoryManager(false, false, executionEnvironment) {}
|
||||
@@ -412,3 +417,122 @@ TEST_F(DeviceTest, givenDispatchGlobalsAllocationFailsOnSecondSubDeviceThenRtDis
|
||||
|
||||
EXPECT_EQ(nullptr, rtDispatchGlobalsInfo);
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZexNumberOfCssEnvVariableDefinedWhenDeviceIsCreatedThenCreateDevicesWithProperCcsCount) {
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
DebugManager.flags.ZEX_NUMBER_OF_CCS.set("0:4,1:1,2:2,3:1");
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(1);
|
||||
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(&hwInfo, false, 4);
|
||||
executionEnvironment.incRefInternal();
|
||||
|
||||
UltDeviceFactory deviceFactory{4, 0, executionEnvironment};
|
||||
|
||||
{
|
||||
auto device = deviceFactory.rootDevices[0];
|
||||
|
||||
auto computeEngineGroupIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
|
||||
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
|
||||
auto expectedNumberOfCcs = std::min(4u, defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
|
||||
EXPECT_EQ(expectedNumberOfCcs, computeEngineGroup.engines.size());
|
||||
}
|
||||
{
|
||||
auto device = deviceFactory.rootDevices[1];
|
||||
|
||||
auto computeEngineGroupIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
|
||||
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
|
||||
EXPECT_EQ(1u, computeEngineGroup.engines.size());
|
||||
}
|
||||
{
|
||||
auto device = deviceFactory.rootDevices[2];
|
||||
|
||||
auto computeEngineGroupIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
|
||||
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
|
||||
auto expectedNumberOfCcs = std::min(2u, defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
|
||||
EXPECT_EQ(expectedNumberOfCcs, computeEngineGroup.engines.size());
|
||||
}
|
||||
{
|
||||
auto device = deviceFactory.rootDevices[3];
|
||||
|
||||
auto computeEngineGroupIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
|
||||
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
|
||||
EXPECT_EQ(1u, computeEngineGroup.engines.size());
|
||||
}
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZexNumberOfCssAndZeAffinityMaskSetWhenDeviceIsCreatedThenProperNumberOfCcsIsExposed) {
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(2);
|
||||
DebugManager.flags.ZE_AFFINITY_MASK.set("1");
|
||||
DebugManager.flags.ZEX_NUMBER_OF_CCS.set("0:1,1:2");
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(1);
|
||||
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(&hwInfo, false, 2);
|
||||
executionEnvironment.incRefInternal();
|
||||
|
||||
auto devices = DeviceFactory::createDevices(executionEnvironment);
|
||||
|
||||
{
|
||||
auto device = devices[0].get();
|
||||
|
||||
EXPECT_EQ(0u, device->getRootDeviceIndex());
|
||||
auto computeEngineGroupIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
|
||||
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
|
||||
EXPECT_EQ(1u, computeEngineGroup.engines.size());
|
||||
}
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZexNumberOfCssEnvVariableIsLargerThanNumberOfAvailableCcsCountWhenDeviceIsCreatedThenCreateDevicesWithAvailableCcsCount) {
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
DebugManager.flags.ZEX_NUMBER_OF_CCS.set("0:13");
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(1);
|
||||
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(&hwInfo);
|
||||
executionEnvironment.incRefInternal();
|
||||
|
||||
UltDeviceFactory deviceFactory{1, 0, executionEnvironment};
|
||||
|
||||
auto device = deviceFactory.rootDevices[0];
|
||||
|
||||
auto computeEngineGroupIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
|
||||
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
|
||||
EXPECT_EQ(defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled, computeEngineGroup.engines.size());
|
||||
}
|
||||
|
||||
HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenZexNumberOfCssEnvVariableSetAmbigouslyWhenDeviceIsCreatedThenDontApplyAnyLimitations) {
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(1);
|
||||
for (const auto &numberOfCcsString : {"default", "", "0"}) {
|
||||
DebugManager.flags.ZEX_NUMBER_OF_CCS.set(numberOfCcsString);
|
||||
|
||||
auto hwInfo = *defaultHwInfo;
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(&hwInfo);
|
||||
executionEnvironment.incRefInternal();
|
||||
|
||||
UltDeviceFactory deviceFactory{1, 0, executionEnvironment};
|
||||
|
||||
auto device = deviceFactory.rootDevices[0];
|
||||
|
||||
auto computeEngineGroupIndex = device->getEngineGroupIndexFromEngineGroupType(EngineGroupType::Compute);
|
||||
auto computeEngineGroup = device->getRegularEngineGroups()[computeEngineGroupIndex];
|
||||
EXPECT_EQ(defaultHwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled, computeEngineGroup.engines.size());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user