diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp index 9c873b60c3..85d9f2430e 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_launch_kernel_3.cpp @@ -299,9 +299,10 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenKernelUsingSyncBufferWhenAppendLau kernelAttributes.numGrfRequired = GrfConfig::DefaultGrfNumber; auto pCommandList = std::make_unique>>(); + auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); auto &hwHelper = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily); auto engineGroupType = NEO::EngineGroupType::Compute; - if (hwHelper.isCooperativeEngineSupported(*defaultHwInfo)) { + if (hwInfoConfig.isCooperativeEngineSupported(*defaultHwInfo)) { engineGroupType = hwHelper.getEngineGroupType(aub_stream::EngineType::ENGINE_CCS, EngineUsage::Cooperative, *defaultHwInfo); } pCommandList->initialize(device, engineGroupType, 0u); diff --git a/opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp b/opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp index b93aae7397..105cf7ecba 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests_pvc_and_later.cpp @@ -164,7 +164,6 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenCooperativeEngineUsageHintAndCcsWhe auto hwInfo = *defaultHwInfo; hwInfo.featureTable.flags.ftrCCSNode = true; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; - auto &hwHelper = NEO::HwHelper::get(hwInfo.platform.eRenderCoreFamily); auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); uint32_t revisions[] = {REVISION_A0, REVISION_B}; @@ -172,7 +171,7 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, givenCooperativeEngineUsageHintAndCcsWhe auto hwRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); hwInfo.platform.usRevId = hwRevId; if (hwRevId == CommonConstants::invalidStepping || - !hwHelper.isCooperativeEngineSupported(hwInfo)) { + !hwInfoConfig.isCooperativeEngineSupported(hwInfo)) { continue; } diff --git a/opencl/test/unit_test/command_queue/sync_buffer_handler_tests.cpp b/opencl/test/unit_test/command_queue/sync_buffer_handler_tests.cpp index 699897d869..d1dc3fdd2c 100644 --- a/opencl/test/unit_test/command_queue/sync_buffer_handler_tests.cpp +++ b/opencl/test/unit_test/command_queue/sync_buffer_handler_tests.cpp @@ -71,8 +71,9 @@ class SyncBufferHandlerTest : public SyncBufferEnqueueHandlerTest { kernel = kernelInternals->mockKernel; kernel->executionType = KernelExecutionType::Concurrent; commandQueue = reinterpret_cast(new MockCommandQueueHw(context, pClDevice, 0)); - hwHelper = &HwHelper::get(pClDevice->getHardwareInfo().platform.eRenderCoreFamily); - if (hwHelper->isCooperativeEngineSupported(pClDevice->getHardwareInfo())) { + auto &hwInfo = pClDevice->getHardwareInfo(); + auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); + if (hwInfoConfig.isCooperativeEngineSupported(hwInfo)) { commandQueue->gpgpuEngine = &pClDevice->getEngine(aub_stream::EngineType::ENGINE_CCS, EngineUsage::Cooperative); } } @@ -97,9 +98,10 @@ class SyncBufferHandlerTest : public SyncBufferEnqueueHandlerTest { } bool isCooperativeDispatchSupported() { - auto engineGroupType = hwHelper->getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), - commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); - return hwHelper->isCooperativeDispatchSupported(engineGroupType, pDevice->getHardwareInfo()); + auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); + auto engineGroupType = hwHelper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), + commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); + return hwHelper.isCooperativeDispatchSupported(engineGroupType, pDevice->getHardwareInfo()); } const cl_uint workDim = 1; @@ -110,7 +112,6 @@ class SyncBufferHandlerTest : public SyncBufferEnqueueHandlerTest { std::unique_ptr kernelInternals; MockKernel *kernel; MockCommandQueue *commandQueue; - HwHelper *hwHelper; }; HWTEST_TEMPLATED_F(SyncBufferHandlerTest, GivenAllocateSyncBufferPatchAndConcurrentKernelWhenEnqueuingKernelThenSyncBufferIsUsed) { diff --git a/opencl/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp b/opencl/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp index 69fb95a589..65c60c068d 100644 --- a/opencl/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp +++ b/opencl/test/unit_test/helpers/hw_helper_tests_pvc_and_later.cpp @@ -78,41 +78,6 @@ HWTEST2_F(HwHelperTestPvcAndLater, givenHwHelperWhenCheckIsUpdateTaskCountFromWa EXPECT_TRUE(hwHelper.isUpdateTaskCountFromWaitSupported()); } -HWTEST2_F(HwHelperTestPvcAndLater, givenCooperativeContextSupportedWhenGetEngineInstancesThenReturnCorrectAmountOfCooperativeCcs, IsAtLeastXeHpcCore) { - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; - hwInfo.featureTable.flags.ftrCCSNode = true; - auto &hwHelper = HwHelperHw::get(); - auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); - - uint32_t revisions[] = {REVISION_A0, REVISION_B}; - for (auto &revision : revisions) { - auto hwRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); - if (hwRevId == CommonConstants::invalidStepping) { - continue; - } - hwInfo.platform.usRevId = hwRevId; - auto engineInstances = hwHelper.getGpgpuEngineInstances(hwInfo); - size_t ccsCount = 0u; - size_t cooperativeCcsCount = 0u; - for (auto &engineInstance : engineInstances) { - if (EngineHelpers::isCcs(engineInstance.first)) { - if (engineInstance.second == EngineUsage::Regular) { - ccsCount++; - } else if (engineInstance.second == EngineUsage::Cooperative) { - cooperativeCcsCount++; - } - } - } - EXPECT_EQ(2u, ccsCount); - if (hwHelper.isCooperativeEngineSupported(hwInfo)) { - EXPECT_EQ(ccsCount, cooperativeCcsCount); - } else { - EXPECT_EQ(0u, cooperativeCcsCount); - } - } -} - HWTEST2_F(HwHelperTestPvcAndLater, givenComputeEngineAndCooperativeUsageWhenGetEngineGroupTypeIsCalledThenCooperativeComputeGroupTypeIsReturned, IsAtLeastXeHpcCore) { auto &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); auto hwInfo = *::defaultHwInfo; @@ -160,20 +125,26 @@ HWTEST2_F(HwHelperTestPvcAndLater, WhenIsRcsAvailableIsCalledThenCorrectValueIsR HWTEST2_F(HwHelperTestPvcAndLater, WhenIsCooperativeDispatchSupportedThenCorrectValueIsReturned, IsAtLeastXeHpcCore) { struct MockHwHelper : NEO::HwHelperHw { - bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override { - return isCooperativeEngineSupportedValue; - } bool isRcsAvailable(const HardwareInfo &hwInfo) const override { return isRcsAvailableValue; } - bool isCooperativeEngineSupportedValue = true; bool isRcsAvailableValue = true; }; + struct MockHwInfoConfig : NEO::HwInfoConfigHw { + bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override { + return isCooperativeEngineSupportedValue; + } + bool isCooperativeEngineSupportedValue = true; + }; + MockHwInfoConfig hwInfoConfig{}; + auto hwInfo = *::defaultHwInfo; + VariableBackup hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast(hwInfo.platform.eProductFamily)]}; + hwInfoConfigFactoryBackup = &hwInfoConfig; + MockHwHelper hwHelper{}; - auto hwInfo = *::defaultHwInfo; for (auto isCooperativeEngineSupported : ::testing::Bool()) { - hwHelper.isCooperativeEngineSupportedValue = isCooperativeEngineSupported; + hwInfoConfig.isCooperativeEngineSupportedValue = isCooperativeEngineSupported; for (auto isRcsAvailable : ::testing::Bool()) { hwHelper.isRcsAvailableValue = isRcsAvailable; for (auto engineGroupType : {EngineGroupType::RenderCompute, EngineGroupType::Compute, @@ -203,3 +174,39 @@ HWTEST2_F(HwHelperTestPvcAndLater, givenHwHelperWhenGettingISAPaddingThenCorrect auto &hwHelper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily); EXPECT_EQ(hwHelper.getPaddingForISAAllocation(), 0xE00u); } + +using HwHelperTestCooperativeEngine = HwHelperTestPvcAndLater; +HWTEST2_F(HwHelperTestCooperativeEngine, givenCooperativeContextSupportedWhenGetEngineInstancesThenReturnCorrectAmountOfCooperativeCcs, IsXeHpcCore) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; + hwInfo.featureTable.flags.ftrCCSNode = true; + auto &hwHelper = HwHelperHw::get(); + auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + + uint32_t revisions[] = {REVISION_A0, REVISION_B}; + for (auto &revision : revisions) { + auto hwRevId = hwInfoConfig.getHwRevIdFromStepping(revision, hwInfo); + if (hwRevId == CommonConstants::invalidStepping) { + continue; + } + hwInfo.platform.usRevId = hwRevId; + auto engineInstances = hwHelper.getGpgpuEngineInstances(hwInfo); + size_t ccsCount = 0u; + size_t cooperativeCcsCount = 0u; + for (auto &engineInstance : engineInstances) { + if (EngineHelpers::isCcs(engineInstance.first)) { + if (engineInstance.second == EngineUsage::Regular) { + ccsCount++; + } else if (engineInstance.second == EngineUsage::Cooperative) { + cooperativeCcsCount++; + } + } + } + EXPECT_EQ(2u, ccsCount); + if (hwInfoConfig.isCooperativeEngineSupported(hwInfo)) { + EXPECT_EQ(ccsCount, cooperativeCcsCount); + } else { + EXPECT_EQ(0u, cooperativeCcsCount); + } + } +} \ No newline at end of file diff --git a/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp b/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp index e6ae45b862..1ce544f7c0 100644 --- a/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp +++ b/opencl/test/unit_test/xe_hpc_core/hw_helper_tests_xe_hpc_core.cpp @@ -18,8 +18,6 @@ #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" #include "opencl/test/unit_test/mocks/mock_cl_device.h" #include "opencl/test/unit_test/mocks/mock_cl_hw_helper.h" -#include "opencl/test/unit_test/mocks/mock_command_queue.h" -#include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/mock_platform.h" using HwHelperTestsXeHpcCore = Test; @@ -207,12 +205,124 @@ HWTEST2_F(HwHelperTestsXeHpcCore, givenRevisionEnumAndPlatformFamilyTypeThenProp } } -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, whenGetGpgpuEnginesThenReturnTwoCccsEnginesAndFourCcsEnginesAndLinkCopyEngines) { - const size_t numEngines = 18; +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCccsDisabledButDebugVariableSetWhenIsCooperativeEngineSupportedEnabledAndGetGpgpuEnginesCalledThenSetCccsProperly) { + HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = 1; + hwInfo.featureTable.flags.ftrRcsNode = false; + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + DebugManagerStateRestore restore; + DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_CCCS)); + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(13u, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(hwInfo); + EXPECT_EQ(13u, engines.size()); + + EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first); + EXPECT_EQ(aub_stream::ENGINE_CCS, engines[1].first); + EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[2].first); + EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[3].first); + EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[4].first); + EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[5].first); + EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[6].first); + EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[7].first); + EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[8].first); + EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[9].first); // low priority + EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[10].first); // internal + EXPECT_EQ(aub_stream::ENGINE_BCS, engines[11].first); // internal + EXPECT_EQ(aub_stream::ENGINE_BCS, engines[12].first); +} + +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCccsDisabledWhenIsCooperativeEngineSupportedEnabledAndGetGpgpuEnginesCalledThenDontSetCccs) { + HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = 1; + hwInfo.featureTable.flags.ftrRcsNode = false; + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(12u, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(hwInfo); + EXPECT_EQ(12u, engines.size()); + + EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first); + EXPECT_EQ(aub_stream::ENGINE_CCS, engines[1].first); + EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[2].first); + EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[3].first); + EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[4].first); + EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[5].first); + EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[6].first); + EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[7].first); + EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[8].first); // low priority + EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[9].first); // internal + EXPECT_EQ(aub_stream::ENGINE_BCS, engines[10].first); + EXPECT_EQ(aub_stream::ENGINE_BCS, engines[11].first); +} + +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenBcsDisabledWhenIsCooperativeEngineSupportedEnabledAndGetEnginesCalledThenDontCreateAnyBcs) { + const size_t numEngines = 11; HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.featureTable.ftrBcsInfo = 0; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenOneBcsEnabledWhenIsCooperativeEngineSupportedEnabledAndGetEnginesCalledThenCreateOnlyOneBcs) { + const size_t numEngines = 13; + + HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = 1; hwInfo.capabilityTable.blitterOperationsSupported = true; hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; @@ -231,23 +341,18 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, whenGetGpgpuEnginesThenReturnTwoCccsEn const std::array enginePropertiesMap = {{ {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, {aub_stream::ENGINE_CCS1, true, false}, {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, {aub_stream::ENGINE_CCS3, true, false}, {aub_stream::ENGINE_CCCS, false, false}, {aub_stream::ENGINE_CCS, true, false}, {aub_stream::ENGINE_CCS, true, false}, {aub_stream::ENGINE_BCS, false, true}, {aub_stream::ENGINE_BCS, false, true}, - {aub_stream::ENGINE_BCS1, false, true}, - {aub_stream::ENGINE_BCS2, false, true}, - {aub_stream::ENGINE_BCS2, false, true}, - {aub_stream::ENGINE_BCS3, false, true}, - {aub_stream::ENGINE_BCS4, false, true}, - {aub_stream::ENGINE_BCS5, false, true}, - {aub_stream::ENGINE_BCS6, false, true}, - {aub_stream::ENGINE_BCS7, false, true}, - {aub_stream::ENGINE_BCS8, false, true}, }}; for (size_t i = 0; i < numEngines; i++) { @@ -257,157 +362,12 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, whenGetGpgpuEnginesThenReturnTwoCccsEn } } -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, whenGetGpgpuEnginesThenReturnTwoCccsEnginesAndFourCcsEnginesAndEightLinkCopyEngines) { - const size_t numEngines = 18; - - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); - hwInfo.capabilityTable.blitterOperationsSupported = true; - hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; - - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); - - EXPECT_EQ(numEngines, device->allEngines.size()); - auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); - EXPECT_EQ(numEngines, engines.size()); - - struct EnginePropertiesMap { - aub_stream::EngineType engineType; - bool isCcs; - bool isBcs; - }; - - const std::array enginePropertiesMap = {{ - {aub_stream::ENGINE_CCS, true, false}, - {aub_stream::ENGINE_CCS1, true, false}, - {aub_stream::ENGINE_CCS2, true, false}, - {aub_stream::ENGINE_CCS3, true, false}, - {aub_stream::ENGINE_CCCS, false, false}, - {aub_stream::ENGINE_CCS, true, false}, - {aub_stream::ENGINE_CCS, true, false}, - {aub_stream::ENGINE_BCS, false, true}, - {aub_stream::ENGINE_BCS, false, true}, - {aub_stream::ENGINE_BCS1, false, true}, - {aub_stream::ENGINE_BCS2, false, true}, - {aub_stream::ENGINE_BCS2, false, true}, - {aub_stream::ENGINE_BCS3, false, true}, - {aub_stream::ENGINE_BCS4, false, true}, - {aub_stream::ENGINE_BCS5, false, true}, - {aub_stream::ENGINE_BCS6, false, true}, - {aub_stream::ENGINE_BCS7, false, true}, - {aub_stream::ENGINE_BCS8, false, true}, - }}; - - for (size_t i = 0; i < numEngines; i++) { - EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); - EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); - EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); - } -} - -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCccsAsDefaultEngineWhenGetEnginesCalledThenChangeDefaultEngine) { - const size_t numEngines = 18; - - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); - hwInfo.capabilityTable.blitterOperationsSupported = true; - hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCCS; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; - - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); - - EXPECT_EQ(numEngines, device->allEngines.size()); - auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); - EXPECT_EQ(numEngines, engines.size()); - - struct EnginePropertiesMap { - aub_stream::EngineType engineType; - bool isCcs; - bool isBcs; - }; - - const std::array enginePropertiesMap = {{ - {aub_stream::ENGINE_CCS, true, false}, - {aub_stream::ENGINE_CCS1, true, false}, - {aub_stream::ENGINE_CCS2, true, false}, - {aub_stream::ENGINE_CCS3, true, false}, - {aub_stream::ENGINE_CCCS, false, false}, - {aub_stream::ENGINE_CCCS, false, false}, - {aub_stream::ENGINE_CCCS, false, false}, - {aub_stream::ENGINE_BCS, false, true}, - {aub_stream::ENGINE_BCS, false, true}, - {aub_stream::ENGINE_BCS1, false, true}, - {aub_stream::ENGINE_BCS2, false, true}, - {aub_stream::ENGINE_BCS2, false, true}, - {aub_stream::ENGINE_BCS3, false, true}, - {aub_stream::ENGINE_BCS4, false, true}, - {aub_stream::ENGINE_BCS5, false, true}, - {aub_stream::ENGINE_BCS6, false, true}, - {aub_stream::ENGINE_BCS7, false, true}, - {aub_stream::ENGINE_BCS8, false, true}, - }}; - - for (size_t i = 0; i < numEngines; i++) { - EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); - EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); - EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); - } -} - -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenOneCcsEnabledWhenGetEnginesCalledThenCreateOnlyOneCcs) { - const size_t numEngines = 15; - - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); - hwInfo.capabilityTable.blitterOperationsSupported = true; - hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; - - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); - - EXPECT_EQ(numEngines, device->allEngines.size()); - auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); - EXPECT_EQ(numEngines, engines.size()); - - struct EnginePropertiesMap { - aub_stream::EngineType engineType; - bool isCcs; - bool isBcs; - }; - - const std::array enginePropertiesMap = {{ - {aub_stream::ENGINE_CCS, true, false}, - {aub_stream::ENGINE_CCCS, false, false}, - {aub_stream::ENGINE_CCS, true, false}, - {aub_stream::ENGINE_CCS, true, false}, - {aub_stream::ENGINE_BCS, false, true}, - {aub_stream::ENGINE_BCS, false, true}, - {aub_stream::ENGINE_BCS1, false, true}, - {aub_stream::ENGINE_BCS2, false, true}, - {aub_stream::ENGINE_BCS2, false, true}, - {aub_stream::ENGINE_BCS3, false, true}, - {aub_stream::ENGINE_BCS4, false, true}, - {aub_stream::ENGINE_BCS5, false, true}, - {aub_stream::ENGINE_BCS6, false, true}, - {aub_stream::ENGINE_BCS7, false, true}, - {aub_stream::ENGINE_BCS8, false, true}, - }}; - - for (size_t i = 0; i < numEngines; i++) { - EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); - EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); - EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); - } -} - -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenNotAllCopyEnginesWhenSettingEngineTableThenDontAddUnsupported) { - const size_t numEngines = 9; +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenNotAllCopyEnginesWhenIsCooperativeEngineSupportedEnabledAndSettingEngineTableThenDontAddUnsupported) { + const size_t numEngines = 10; HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); hwInfo.featureTable.flags.ftrCCSNode = true; hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); hwInfo.featureTable.ftrBcsInfo.set(0, false); @@ -431,6 +391,7 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenNotAllCopyEnginesWhenSettingEngin }; const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, {aub_stream::ENGINE_CCS, true, false}, {aub_stream::ENGINE_CCCS, false, false}, {aub_stream::ENGINE_CCS, true, false}, @@ -449,12 +410,120 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenNotAllCopyEnginesWhenSettingEngin } } -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenOneBcsEnabledWhenGetEnginesCalledThenCreateOnlyOneBcs) { - const size_t numEngines = 9; +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenOneCcsEnabledWhenIsCooperativeEngineSupportedEnabledAndGetEnginesCalledThenCreateOnlyOneCcs) { + const size_t numEngines = 16; HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.featureTable.ftrBcsInfo = 1; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + {aub_stream::ENGINE_BCS7, false, true}, + {aub_stream::ENGINE_BCS8, false, true}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCccsAsDefaultEngineWhenIsCooperativeEngineSupportedEnabledAndGetEnginesCalledThenChangeDefaultEngine) { + const size_t numEngines = 22; + + HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + {aub_stream::ENGINE_BCS7, false, true}, + {aub_stream::ENGINE_BCS8, false, true}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, whenIsCooperativeEngineSupportedEnabledAndGetGpgpuEnginesThenReturnTwoCccsEnginesAndFourCcsEnginesAndEightLinkCopyEngines) { + const size_t numEngines = 22; + + HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); hwInfo.capabilityTable.blitterOperationsSupported = true; hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; @@ -473,14 +542,27 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenOneBcsEnabledWhenGetEnginesCalled const std::array enginePropertiesMap = {{ {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, {aub_stream::ENGINE_CCS1, true, false}, {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, {aub_stream::ENGINE_CCS3, true, false}, {aub_stream::ENGINE_CCCS, false, false}, {aub_stream::ENGINE_CCS, true, false}, {aub_stream::ENGINE_CCS, true, false}, {aub_stream::ENGINE_BCS, false, true}, {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + {aub_stream::ENGINE_BCS7, false, true}, + {aub_stream::ENGINE_BCS8, false, true}, }}; for (size_t i = 0; i < numEngines; i++) { @@ -490,12 +572,15 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenOneBcsEnabledWhenGetEnginesCalled } } -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenBcsDisabledWhenGetEnginesCalledThenDontCreateAnyBcs) { - const size_t numEngines = 7; +XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, whenIsCooperativeEngineSupportedEnabledAndGetGpgpuEnginesThenReturnTwoCccsEnginesAndFourCcsEnginesAndLinkCopyEngines) { + const size_t numEngines = 22; HardwareInfo hwInfo = *defaultHwInfo; + const auto &hwInfoConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.featureTable.ftrBcsInfo = 0; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.capabilityTable.blitterOperationsSupported = true; hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; @@ -513,12 +598,27 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenBcsDisabledWhenGetEnginesCalledTh const std::array enginePropertiesMap = {{ {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, {aub_stream::ENGINE_CCS1, true, false}, {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, {aub_stream::ENGINE_CCS3, true, false}, {aub_stream::ENGINE_CCCS, false, false}, {aub_stream::ENGINE_CCS, true, false}, {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + {aub_stream::ENGINE_BCS7, false, true}, + {aub_stream::ENGINE_BCS8, false, true}, }}; for (size_t i = 0; i < numEngines; i++) { @@ -761,45 +861,6 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenNonTile0AccessWhenGettingIsBlitCo } } -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCCCSEngineAndRevisionBWhenCallingIsCooperativeDispatchSupportedThenFalseIsReturned) { - auto &helper = HwHelper::get(renderCoreFamily); - auto context = new NEO::MockContext(pClDevice); - auto commandQueue = reinterpret_cast(new MockCommandQueueHw(context, pClDevice, 0)); - - auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), - commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); - auto retVal = helper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo); - EXPECT_TRUE(retVal); - - auto &hwConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); - hardwareInfo.platform.usRevId = hwConfig.getHwRevIdFromStepping(REVISION_B, hardwareInfo); - retVal = helper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo); - EXPECT_FALSE(retVal); - commandQueue->release(); - context->decRefInternal(); -} - -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCCSEngineWhenCallingIsCooperativeDispatchSupportedThenTrueIsReturned) { - auto &helper = HwHelper::get(renderCoreFamily); - auto hwInfo = *defaultHwInfo; - uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily]; - hardwareInfoSetup[productFamily](&hwInfo, true, hwInfoConfig); - auto device = MockDevice::createWithNewExecutionEnvironment(&hwInfo); - ASSERT_NE(nullptr, device); - auto clDevice = new MockClDevice{device}; - ASSERT_NE(nullptr, clDevice); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks) - auto context = new NEO::MockContext(clDevice); - auto commandQueue = reinterpret_cast(new MockCommandQueueHw(context, clDevice, 0)); - - auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), - commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); - auto retVal = helper.isCooperativeDispatchSupported(engineGroupType, hwInfo); - ASSERT_TRUE(retVal); - commandQueue->release(); - context->decRefInternal(); - delete clDevice; -} - using HwInfoConfigTestXeHpcCore = ::testing::Test; XE_HPC_CORETEST_F(HwInfoConfigTestXeHpcCore, givenDebugVariableSetWhenConfigureIsCalledThenSetupBlitterOperationsSupportedFlag) { @@ -855,60 +916,6 @@ XE_HPC_CORETEST_F(LriHelperTestsXeHpcCore, whenProgrammingLriCommandThenExpectMm EXPECT_TRUE(memcmp(lri, &expectedLri, sizeof(MI_LOAD_REGISTER_IMM)) == 0); } -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCccsDisabledWhenGetGpgpuEnginesCalledThenDontSetCccs) { - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.featureTable.ftrBcsInfo = 1; - hwInfo.featureTable.flags.ftrRcsNode = false; - hwInfo.capabilityTable.blitterOperationsSupported = true; - hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; - - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); - - EXPECT_EQ(8u, device->allEngines.size()); - auto &engines = HwHelperHw::get().getGpgpuEngineInstances(hwInfo); - EXPECT_EQ(8u, engines.size()); - - EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first); - EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[1].first); - EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[2].first); - EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[3].first); - EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[4].first); // low priority - EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[5].first); // internal - EXPECT_EQ(aub_stream::ENGINE_BCS, engines[6].first); - EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first); -} - -XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenCccsDisabledButDebugVariableSetWhenGetGpgpuEnginesCalledThenSetCccs) { - HardwareInfo hwInfo = *defaultHwInfo; - hwInfo.featureTable.flags.ftrCCSNode = true; - hwInfo.featureTable.ftrBcsInfo = 1; - hwInfo.featureTable.flags.ftrRcsNode = false; - hwInfo.capabilityTable.blitterOperationsSupported = true; - hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; - hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; - - DebugManagerStateRestore restore; - DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_CCCS)); - - auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); - - EXPECT_EQ(9u, device->allEngines.size()); - auto &engines = HwHelperHw::get().getGpgpuEngineInstances(hwInfo); - EXPECT_EQ(9u, engines.size()); - - EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first); - EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[1].first); - EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[2].first); - EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[3].first); - EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[4].first); - EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[5].first); // low priority - EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[6].first); // internal - EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first); // internal - EXPECT_EQ(aub_stream::ENGINE_BCS, engines[8].first); -} - XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, WhenCheckingSipWAThenFalseIsReturned) { EXPECT_FALSE(HwHelper::get(renderCoreFamily).isSipWANeeded(*defaultHwInfo)); } diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp b/opencl/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp index 276a4f1251..bea2b2f979 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp +++ b/opencl/test/unit_test/xe_hpc_core/pvc/engine_node_helper_tests_pvc.cpp @@ -6,9 +6,12 @@ */ #include "shared/source/helpers/engine_node_helper.h" +#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/test_macros/test.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" +#include "opencl/test/unit_test/mocks/mock_command_queue.h" +#include "opencl/test/unit_test/mocks/mock_context.h" using namespace NEO; using EngineNodeHelperPvcTests = ::Test; @@ -60,3 +63,417 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenPvcBaseDieA0AndTile1WhenGettingBcsEngin EXPECT_EQ(ENGINE_BCS2, EngineHelpers::getBcsEngineType(*pHwInfo, deviceBitfield, selectorCopyEngine, internalUsage)); } } + +PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledButDebugVariableSetWhenGetGpgpuEnginesCalledThenSetCccsProperly) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = 1; + hwInfo.featureTable.flags.ftrRcsNode = false; + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + DebugManagerStateRestore restore; + DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_CCCS)); + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(9u, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(hwInfo); + EXPECT_EQ(9u, engines.size()); + + EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first); + EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[1].first); + EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[2].first); + EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[3].first); + EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[4].first); + EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[5].first); // low priority + EXPECT_EQ(aub_stream::ENGINE_CCCS, engines[6].first); // internal + EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first); // internal + EXPECT_EQ(aub_stream::ENGINE_BCS, engines[8].first); +} + +PVCTEST_F(EngineNodeHelperPvcTests, givenCccsDisabledWhenGetGpgpuEnginesCalledThenDontSetCccs) { + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = 1; + hwInfo.featureTable.flags.ftrRcsNode = false; + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(8u, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(hwInfo); + EXPECT_EQ(8u, engines.size()); + + EXPECT_EQ(aub_stream::ENGINE_CCS, engines[0].first); + EXPECT_EQ(aub_stream::ENGINE_CCS1, engines[1].first); + EXPECT_EQ(aub_stream::ENGINE_CCS2, engines[2].first); + EXPECT_EQ(aub_stream::ENGINE_CCS3, engines[3].first); + EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[4].first); // low priority + EXPECT_EQ(hwInfo.capabilityTable.defaultEngineType, engines[5].first); // internal + EXPECT_EQ(aub_stream::ENGINE_BCS, engines[6].first); + EXPECT_EQ(aub_stream::ENGINE_BCS, engines[7].first); +} + +PVCTEST_F(EngineNodeHelperPvcTests, givenCCSEngineWhenCallingIsCooperativeDispatchSupportedThenTrueIsReturned) { + auto &helper = HwHelper::get(renderCoreFamily); + auto hwInfo = *defaultHwInfo; + uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily]; + hardwareInfoSetup[productFamily](&hwInfo, true, hwInfoConfig); + auto device = MockDevice::createWithNewExecutionEnvironment(&hwInfo); + ASSERT_NE(nullptr, device); + auto clDevice = new MockClDevice{device}; + ASSERT_NE(nullptr, clDevice); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks) + auto context = new NEO::MockContext(clDevice); + auto commandQueue = reinterpret_cast(new MockCommandQueueHw(context, clDevice, 0)); + + auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), + commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); + auto retVal = helper.isCooperativeDispatchSupported(engineGroupType, hwInfo); + ASSERT_TRUE(retVal); + commandQueue->release(); + context->decRefInternal(); + delete clDevice; +} + +PVCTEST_F(EngineNodeHelperPvcTests, givenCCCSEngineAndRevisionBWhenCallingIsCooperativeDispatchSupportedThenFalseIsReturned) { + auto &helper = HwHelper::get(renderCoreFamily); + auto context = new NEO::MockContext(pClDevice); + auto commandQueue = reinterpret_cast(new MockCommandQueueHw(context, pClDevice, 0)); + + auto engineGroupType = helper.getEngineGroupType(commandQueue->getGpgpuEngine().getEngineType(), + commandQueue->getGpgpuEngine().getEngineUsage(), hardwareInfo); + auto retVal = helper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo); + EXPECT_TRUE(retVal); + + auto &hwConfig = *HwInfoConfig::get(hardwareInfo.platform.eProductFamily); + hardwareInfo.platform.usRevId = hwConfig.getHwRevIdFromStepping(REVISION_B, hardwareInfo); + retVal = helper.isCooperativeDispatchSupported(engineGroupType, hardwareInfo); + EXPECT_FALSE(retVal); + commandQueue->release(); + context->decRefInternal(); +} + +PVCTEST_F(EngineNodeHelperPvcTests, givenBcsDisabledWhenGetEnginesCalledThenDontCreateAnyBcs) { + const size_t numEngines = 7; + + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = 0; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +PVCTEST_F(EngineNodeHelperPvcTests, givenOneBcsEnabledWhenGetEnginesCalledThenCreateOnlyOneBcs) { + const size_t numEngines = 9; + + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = 1; + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS, false, true}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +PVCTEST_F(EngineNodeHelperPvcTests, givenNotAllCopyEnginesWhenSettingEngineTableThenDontAddUnsupported) { + const size_t numEngines = 9; + + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.featureTable.ftrBcsInfo.set(0, false); + hwInfo.featureTable.ftrBcsInfo.set(2, false); + hwInfo.featureTable.ftrBcsInfo.set(7, false); + hwInfo.featureTable.ftrBcsInfo.set(8, false); + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +PVCTEST_F(EngineNodeHelperPvcTests, givenOneCcsEnabledWhenGetEnginesCalledThenCreateOnlyOneCcs) { + const size_t numEngines = 15; + + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + {aub_stream::ENGINE_BCS7, false, true}, + {aub_stream::ENGINE_BCS8, false, true}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +PVCTEST_F(EngineNodeHelperPvcTests, givenCccsAsDefaultEngineWhenGetEnginesCalledThenChangeDefaultEngine) { + const size_t numEngines = 18; + + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + {aub_stream::ENGINE_BCS7, false, true}, + {aub_stream::ENGINE_BCS8, false, true}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesAndFourCcsEnginesAndEightLinkCopyEngines) { + const size_t numEngines = 18; + + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + {aub_stream::ENGINE_BCS7, false, true}, + {aub_stream::ENGINE_BCS8, false, true}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} + +PVCTEST_F(EngineNodeHelperPvcTests, whenGetGpgpuEnginesThenReturnTwoCccsEnginesAndFourCcsEnginesAndLinkCopyEngines) { + const size_t numEngines = 18; + + HardwareInfo hwInfo = *defaultHwInfo; + hwInfo.featureTable.flags.ftrCCSNode = true; + hwInfo.featureTable.ftrBcsInfo = maxNBitValue(9); + hwInfo.capabilityTable.blitterOperationsSupported = true; + hwInfo.capabilityTable.defaultEngineType = aub_stream::ENGINE_CCS; + hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 4; + + auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0)); + + EXPECT_EQ(numEngines, device->allEngines.size()); + auto &engines = HwHelperHw::get().getGpgpuEngineInstances(device->getHardwareInfo()); + EXPECT_EQ(numEngines, engines.size()); + + struct EnginePropertiesMap { + aub_stream::EngineType engineType; + bool isCcs; + bool isBcs; + }; + + const std::array enginePropertiesMap = {{ + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS1, true, false}, + {aub_stream::ENGINE_CCS2, true, false}, + {aub_stream::ENGINE_CCS3, true, false}, + {aub_stream::ENGINE_CCCS, false, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_CCS, true, false}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS, false, true}, + {aub_stream::ENGINE_BCS1, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS2, false, true}, + {aub_stream::ENGINE_BCS3, false, true}, + {aub_stream::ENGINE_BCS4, false, true}, + {aub_stream::ENGINE_BCS5, false, true}, + {aub_stream::ENGINE_BCS6, false, true}, + {aub_stream::ENGINE_BCS7, false, true}, + {aub_stream::ENGINE_BCS8, false, true}, + }}; + + for (size_t i = 0; i < numEngines; i++) { + EXPECT_EQ(enginePropertiesMap[i].engineType, engines[i].first); + EXPECT_EQ(enginePropertiesMap[i].isCcs, EngineHelpers::isCcs(enginePropertiesMap[i].engineType)); + EXPECT_EQ(enginePropertiesMap[i].isBcs, EngineHelpers::isBcs(enginePropertiesMap[i].engineType)); + } +} \ No newline at end of file diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 2f1217f369..c1cfcad0b2 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -119,7 +119,6 @@ class HwHelper { virtual bool isSipWANeeded(const HardwareInfo &hwInfo) const = 0; virtual bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const = 0; virtual bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const = 0; - virtual bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const = 0; virtual aub_stream::MMIOList getExtraMmioList(const HardwareInfo &hwInfo, const GmmHelper &gmmHelper) const = 0; virtual uint32_t getDefaultRevisionId(const HardwareInfo &hwInfo) const = 0; virtual uint32_t getNumCacheRegions() const = 0; @@ -346,8 +345,6 @@ class HwHelperHw : public HwHelper { bool isKmdMigrationSupported(const HardwareInfo &hwInfo) const override; - bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override; - bool isSipWANeeded(const HardwareInfo &hwInfo) const override; bool isCpuImageTransferPreferred(const HardwareInfo &hwInfo) const override; diff --git a/shared/source/helpers/hw_helper_base.inl b/shared/source/helpers/hw_helper_base.inl index 20c17f697a..225b81a898 100644 --- a/shared/source/helpers/hw_helper_base.inl +++ b/shared/source/helpers/hw_helper_base.inl @@ -630,11 +630,6 @@ bool HwHelperHw::isKmdMigrationSupported(const HardwareInfo &hwInfo) return false; } -template -bool HwHelperHw::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const { - return false; -} - template bool HwHelperHw::isSipWANeeded(const HardwareInfo &hwInfo) const { return false; diff --git a/shared/source/helpers/hw_helper_pvc_and_later.inl b/shared/source/helpers/hw_helper_pvc_and_later.inl index 9cc5901844..9d5f39d7b9 100644 --- a/shared/source/helpers/hw_helper_pvc_and_later.inl +++ b/shared/source/helpers/hw_helper_pvc_and_later.inl @@ -24,7 +24,8 @@ bool HwHelperHw::isRcsAvailable(const HardwareInfo &hwInfo) const { template <> bool HwHelperHw::isCooperativeDispatchSupported(const EngineGroupType engineGroupType, const HardwareInfo &hwInfo) const { - if (isCooperativeEngineSupported(hwInfo)) { + auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + if (hwInfoConfig.isCooperativeEngineSupported(hwInfo)) { if (engineGroupType == EngineGroupType::RenderCompute) { return false; } @@ -47,8 +48,8 @@ uint32_t HwHelperHw::adjustMaxWorkGroupCount(uint32_t maxWorkGroupCount, if (!isCooperativeDispatchSupported(engineGroupType, hwInfo)) { return 1u; } - - bool requiresLimitation = this->isCooperativeEngineSupported(hwInfo) && + auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + bool requiresLimitation = hwInfoConfig.isCooperativeEngineSupported(hwInfo) && (engineGroupType != EngineGroupType::CooperativeCompute) && (!isEngineInstanced) && (DebugManager.flags.OverrideMaxWorkGroupCount.get() == -1); diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index dafaf532a6..72458e9bbb 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -102,6 +102,7 @@ class HwInfoConfig { virtual bool useChannelRedForUnusedShaderChannels() const = 0; virtual bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const = 0; virtual bool isGrfNumReportedWithScm() const = 0; + virtual bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const = 0; MOCKABLE_VIRTUAL ~HwInfoConfig() = default; @@ -188,6 +189,7 @@ class HwInfoConfigHw : public HwInfoConfig { bool useChannelRedForUnusedShaderChannels() const override; bool isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const override; bool isGrfNumReportedWithScm() const override; + bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override; protected: HwInfoConfigHw() = default; diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 686b2869d1..cc6560877f 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -357,4 +357,9 @@ bool HwInfoConfigHw::isGrfNumReportedWithScm() const { return true; } +template +bool HwInfoConfigHw::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const { + return false; +} + } // namespace NEO diff --git a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp index 9d09339656..74a3e774d2 100644 --- a/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/hw_helper_xe_hpc_core.cpp @@ -38,21 +38,17 @@ uint8_t HwHelperHw::getBarriersCountFromHasBarriers(uint8_t hasBarriers) return possibleBarriersCounts[hasBarriers]; } -template <> -bool HwHelperHw::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const { - return (HwInfoConfig::get(hwInfo.platform.eProductFamily)->getSteppingFromHwRevId(hwInfo) >= REVISION_B); -} - template <> const EngineInstancesContainer HwHelperHw::getGpgpuEngineInstances(const HardwareInfo &hwInfo) const { auto defaultEngine = getChosenEngineType(hwInfo); + auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); EngineInstancesContainer engines; if (hwInfo.featureTable.flags.ftrCCSNode) { for (uint32_t i = 0; i < hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled; i++) { engines.push_back({static_cast(i + aub_stream::ENGINE_CCS), EngineUsage::Regular}); - if (isCooperativeEngineSupported(hwInfo)) { + if (hwInfoConfig.isCooperativeEngineSupported(hwInfo)) { engines.push_back({static_cast(i + aub_stream::ENGINE_CCS), EngineUsage::Cooperative}); } } diff --git a/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl b/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl index 1b3bc6cc5e..bb5ec8d15f 100644 --- a/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl +++ b/shared/source/xe_hpc_core/pvc/os_agnostic_hw_info_config_pvc.inl @@ -112,3 +112,8 @@ template <> bool HwInfoConfigHw::isAdjustProgrammableIdPreferredSlmSizeRequired(const HardwareInfo &hwInfo) const { return PVC::isXlA0(hwInfo); } + +template <> +bool HwInfoConfigHw::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const { + return (HwInfoConfig::get(hwInfo.platform.eProductFamily)->getSteppingFromHwRevId(hwInfo) >= REVISION_B); +} \ No newline at end of file diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index 099174c41c..bdde832a56 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -360,4 +360,9 @@ bool HwInfoConfigHw::isGrfNumReportedWithScm() const { return false; } +template <> +bool HwInfoConfigHw::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const { + return false; +} + } //namespace NEO