From 452050ae408c9cd604fc095c26138f460a7e27ab Mon Sep 17 00:00:00 2001 From: Daria Hinz Date: Tue, 22 Feb 2022 18:16:19 +0000 Subject: [PATCH] Refactoring the use of PVC device ids Replacing the old device id implementation & clearing PVC XT temporary. Related-To: NEO-6742 Signed-off-by: Daria Hinz --- .../xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp | 11 +- .../unit_tests/xe_hpc_core/pvc/CMakeLists.txt | 12 -- .../xe_hpc_core/pvc/test_cmdqueue_pvc.cpp | 131 ------------------ ...st_metric_ip_sampling_linux_pvc_prelim.cpp | 16 +-- ..._metric_ip_sampling_linux_pvc_upstream.cpp | 9 +- .../hw_helper_tests_xe_hpc_core.cpp | 15 +- .../pvc/test_hw_info_config_pvc.cpp | 4 +- shared/source/os_interface/hw_info_config.h | 4 +- shared/source/os_interface/hw_info_config.inl | 2 +- shared/source/xe_hpc_core/CMakeLists.txt | 9 +- .../os_agnostic_hw_info_config_pvc_extra.inl | 21 +++ shared/source/xe_hpc_core/hw_cmds_base.h | 6 +- shared/source/xe_hpc_core/hw_cmds_pvc.cpp | 21 +++ shared/source/xe_hpc_core/hw_cmds_pvc.h | 20 ++- .../xe_hpc_core/hw_helper_xe_hpc_core.cpp | 2 +- shared/source/xe_hpc_core/hw_info_pvc.cpp | 14 -- .../xe_hpc_core/linux/hw_info_config_pvc.cpp | 2 + .../os_agnostic_hw_info_config_pvc.inl | 45 ++---- .../windows/hw_info_config_pvc.cpp | 4 +- .../common/helpers/test_hw_info_config.cpp | 2 +- .../test/common/mocks/mock_hw_info_config.cpp | 2 +- .../pvc/test_encode_dispatch_kernel_pvc.cpp | 17 ++- .../xe_hpc_core/pvc/test_preamble_pvc.cpp | 24 ---- .../xe_hpc_core/test_encode_xe_hpc_core.cpp | 36 +++-- .../dispatch_walker_tests_xe_hpc_core.cpp | 39 ++---- .../unit_test/xe_hpc_core/pvc/CMakeLists.txt | 15 ++ .../xe_hpc_core/pvc/hw_info_tests_pvc.cpp | 54 ++++++++ 27 files changed, 219 insertions(+), 318 deletions(-) delete mode 100644 level_zero/core/test/unit_tests/xe_hpc_core/pvc/CMakeLists.txt delete mode 100644 level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdqueue_pvc.cpp create mode 100644 shared/source/xe_hpc_core/definitions/os_agnostic_hw_info_config_pvc_extra.inl create mode 100644 shared/source/xe_hpc_core/hw_cmds_pvc.cpp create mode 100644 shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt create mode 100644 shared/test/unit_test/xe_hpc_core/pvc/hw_info_tests_pvc.cpp diff --git a/level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp b/level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp index 24270fd45b..ffb0ae4b38 100644 --- a/level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp +++ b/level_zero/core/source/xe_hpc_core/l0_hw_helper_xe_hpc_core.cpp @@ -5,6 +5,8 @@ * */ +#include "shared/source/xe_hpc_core/hw_cmds_pvc.h" + #include "level_zero/core/source/helpers/l0_populate_factory.h" #include "level_zero/core/source/hw_helpers/l0_hw_helper_base.inl" #include "level_zero/core/source/hw_helpers/l0_hw_helper_pvc_and_later.inl" @@ -24,14 +26,7 @@ void populateFactoryTable>() { template <> bool L0HwHelperHw::isIpSamplingSupported(const NEO::HardwareInfo &hwInfo) const { - if (hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[0] || - hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[1] || - hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[2] || - hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[3] || - hwInfo.platform.usDeviceID == NEO::XE_HPC_CORE::pvcXtDeviceIds[4]) { - return true; - } - return false; + return NEO::PVC::isXt(hwInfo); } template class L0HwHelperHw; diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/CMakeLists.txt b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/CMakeLists.txt deleted file mode 100644 index b1a4aa6e16..0000000000 --- a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# -# Copyright (C) 2022 Intel Corporation -# -# SPDX-License-Identifier: MIT -# - -if(TESTS_PVC) - target_sources(${TARGET_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt - ${CMAKE_CURRENT_SOURCE_DIR}/test_cmdqueue_pvc.cpp - ) -endif() diff --git a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdqueue_pvc.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdqueue_pvc.cpp deleted file mode 100644 index 160b296c5d..0000000000 --- a/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdqueue_pvc.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2022 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/os_interface/hw_info_config.h" -#include "shared/test/common/cmd_parse/gen_cmd_parse.h" -#include "shared/test/common/helpers/default_hw_info.h" -#include "shared/test/common/mocks/mock_command_stream_receiver.h" -#include "shared/test/common/test_macros/test.h" - -#include "level_zero/core/source/driver/driver_handle_imp.h" -#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" -#include "level_zero/core/test/unit_tests/mocks/mock_built_ins.h" -#include "level_zero/core/test/unit_tests/mocks/mock_cmdlist.h" -#include "level_zero/core/test/unit_tests/mocks/mock_cmdqueue.h" -#include "level_zero/core/test/unit_tests/mocks/mock_kernel.h" -#include "level_zero/core/test/unit_tests/mocks/mock_module.h" - -namespace L0 { -namespace ult { - -using CommandQueueCommandsPvc = Test; - -PVCTEST_F(CommandQueueCommandsPvc, whenExecuteCommandListsIsCalledThenAdditionalCfeStatesAreCorrectlyProgrammed) { - if (!PVC::isXtTemporary(*defaultHwInfo)) { - GTEST_SKIP(); - } - - DebugManagerStateRestore restorer; - DebugManager.flags.AllowMixingRegularAndCooperativeKernels.set(1); - DebugManager.flags.AllowPatchingVfeStateInCommandLists.set(1); - using CFE_STATE = typename FamilyType::CFE_STATE; - - auto hwInfo = *NEO::defaultHwInfo; - const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); - auto bStep = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); - if (bStep != CommonConstants::invalidStepping) { - hwInfo.platform.usRevId = bStep; - } - - hwInfo.platform.usRevId |= FamilyType::pvcBaseDieRevMask; - auto neoDevice = NEO::MockDevice::createWithNewExecutionEnvironment(&hwInfo); - auto mockBuiltIns = new MockBuiltins(); - neoDevice->executionEnvironment->rootDeviceEnvironments[0]->builtins.reset(mockBuiltIns); - NEO::DeviceVector devices; - devices.push_back(std::unique_ptr(neoDevice)); - auto driverHandle = std::make_unique>(); - driverHandle->initialize(std::move(devices)); - auto device = driverHandle->devices[0]; - - ze_command_queue_desc_t desc = {}; - NEO::CommandStreamReceiver *csr; - device->getCsrForOrdinalAndIndex(&csr, 0u, 0u); - auto commandQueue = new MockCommandQueueHw{device, csr, &desc}; - commandQueue->initialize(false, false); - - Mock<::L0::Kernel> defaultKernel; - auto pMockModule1 = std::unique_ptr(new Mock(device, nullptr)); - defaultKernel.module = pMockModule1.get(); - - Mock<::L0::Kernel> cooperativeKernel; - auto pMockModule2 = std::unique_ptr(new Mock(device, nullptr)); - cooperativeKernel.module = pMockModule2.get(); - cooperativeKernel.immutableData.kernelDescriptor->kernelAttributes.flags.usesSyncBuffer = true; - cooperativeKernel.immutableData.kernelDescriptor->kernelAttributes.numGrfRequired = GrfConfig::DefaultGrfNumber; - cooperativeKernel.setGroupSize(1, 1, 1); - - ze_group_count_t threadGroupDimensions{1, 1, 1}; - auto commandListAB = std::make_unique>>(); - commandListAB->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); - commandListAB->appendLaunchKernelWithParams(&defaultKernel, &threadGroupDimensions, nullptr, false, false, false); - commandListAB->appendLaunchKernelWithParams(&cooperativeKernel, &threadGroupDimensions, nullptr, false, false, true); - auto hCommandListAB = commandListAB->toHandle(); - - auto commandListBA = std::make_unique>>(); - commandListBA->initialize(device, NEO::EngineGroupType::CooperativeCompute, 0u); - commandListBA->appendLaunchKernelWithParams(&cooperativeKernel, &threadGroupDimensions, nullptr, false, false, true); - commandListBA->appendLaunchKernelWithParams(&defaultKernel, &threadGroupDimensions, nullptr, false, false, false); - auto hCommandListBA = commandListBA->toHandle(); - - // Set state B - csr->getStreamProperties().frontEndState.setProperties(true, false, false, false, *NEO::defaultHwInfo); - // Execute command list AB - commandQueue->executeCommandLists(1, &hCommandListAB, nullptr, false); - - // Expect state A programmed by command queue - GenCmdList cmdList; - ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, commandQueue->commandStream->getCpuBase(), commandQueue->commandStream->getUsed())); - auto cfeStates = findAll(cmdList.begin(), cmdList.end()); - EXPECT_EQ(1u, cfeStates.size()); - EXPECT_EQ(false, genCmdCast(*cfeStates[0])->getComputeDispatchAllWalkerEnable()); - - // Expect state B programmed by command list - cmdList.clear(); - ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, commandListAB->commandContainer.getCommandStream()->getCpuBase(), commandListAB->commandContainer.getCommandStream()->getUsed())); - cfeStates = findAll(cmdList.begin(), cmdList.end()); - EXPECT_EQ(1u, cfeStates.size()); - EXPECT_EQ(true, genCmdCast(*cfeStates[0])->getComputeDispatchAllWalkerEnable()); - - // Set state A - csr->getStreamProperties().frontEndState.setProperties(false, false, false, false, *NEO::defaultHwInfo); - // Execute command list BA - commandQueue->executeCommandLists(1, &hCommandListBA, nullptr, false); - - // Expect state B programmed by command queue - cmdList.clear(); - ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, commandQueue->commandStream->getCpuBase(), commandQueue->commandStream->getUsed())); - cfeStates = findAll(cmdList.begin(), cmdList.end()); - EXPECT_EQ(2u, cfeStates.size()); - EXPECT_EQ(false, genCmdCast(*cfeStates[0])->getComputeDispatchAllWalkerEnable()); - EXPECT_EQ(true, genCmdCast(*cfeStates[1])->getComputeDispatchAllWalkerEnable()); - - // Expect state A programmed by command list - cmdList.clear(); - ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer( - cmdList, commandListBA->commandContainer.getCommandStream()->getCpuBase(), commandListBA->commandContainer.getCommandStream()->getUsed())); - cfeStates = findAll(cmdList.begin(), cmdList.end()); - EXPECT_EQ(1u, cfeStates.size()); - EXPECT_EQ(false, genCmdCast(*cfeStates[0])->getComputeDispatchAllWalkerEnable()); - - commandQueue->destroy(); -} - -} // namespace ult -} // namespace L0 diff --git a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp index 9faa8c0552..89572c2adc 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_prelim.cpp @@ -16,6 +16,7 @@ #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/tools/source/metrics/os_metric_ip_sampling.h" +#include "device_ids_configs.h" #include "hw_cmds.h" namespace NEO { @@ -274,7 +275,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenSupportedProductFamilyAndUnsuppo auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->platform.eProductFamily = productFamily; - hwInfo->platform.usDeviceID = NEO::XE_HPC_CORE::pvcXlDeviceId; + hwInfo->platform.usDeviceID = NEO::PVC_XL_IDS.front(); EXPECT_FALSE(metricIpSamplingOsInterface->isDependencyAvailable()); } @@ -283,14 +284,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenSupportedProductFamilyAndSupport auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->platform.eProductFamily = productFamily; - const std::vector supportedDeviceIds = { - NEO::XE_HPC_CORE::pvcXtDeviceIds[0], - NEO::XE_HPC_CORE::pvcXtDeviceIds[1], - NEO::XE_HPC_CORE::pvcXtDeviceIds[2], - NEO::XE_HPC_CORE::pvcXtDeviceIds[3], - NEO::XE_HPC_CORE::pvcXtDeviceIds[4]}; - - for (uint32_t deviceId : supportedDeviceIds) { + for (auto deviceId : NEO::PVC_XT_IDS) { hwInfo->platform.usDeviceID = deviceId; EXPECT_TRUE(metricIpSamplingOsInterface->isDependencyAvailable()); } @@ -300,7 +294,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenDriverOpenFailsWhenIsDependencyA auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->platform.eProductFamily = productFamily; - hwInfo->platform.usDeviceID = NEO::XE_HPC_CORE::pvcXtDeviceIds[0]; + hwInfo->platform.usDeviceID = NEO::PVC_XT_IDS.front(); auto drm = static_cast(device->getOsInterface().getDriverModel()->as()); VariableBackup backupCsTimeStampFrequency(&drm->storedCsTimestampFrequency, 0); @@ -313,7 +307,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestPrelim, GivenIoctlHelperFailsWhenIsDependency auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->platform.eProductFamily = productFamily; - hwInfo->platform.usDeviceID = NEO::XE_HPC_CORE::pvcXtDeviceIds[0]; + hwInfo->platform.usDeviceID = NEO::PVC_XT_IDS.front(); auto drm = static_cast(device->getOsInterface().getDriverModel()->as()); diff --git a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_upstream.cpp b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_upstream.cpp index 825b8149e0..5efce6bc05 100644 --- a/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_upstream.cpp +++ b/level_zero/tools/test/unit_tests/sources/metrics/linux/test_metric_ip_sampling_linux_pvc_upstream.cpp @@ -51,14 +51,7 @@ HWTEST2_F(MetricIpSamplingLinuxTestUpstream, GivenSupportedProductFamilyAndSuppo auto hwInfo = neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); hwInfo->platform.eProductFamily = productFamily; - const std::vector supportedDeviceIds = { - NEO::XE_HPC_CORE::pvcXtDeviceIds[0], - NEO::XE_HPC_CORE::pvcXtDeviceIds[1], - NEO::XE_HPC_CORE::pvcXtDeviceIds[2], - NEO::XE_HPC_CORE::pvcXtDeviceIds[3], - NEO::XE_HPC_CORE::pvcXtDeviceIds[4]}; - - for (uint32_t deviceId : supportedDeviceIds) { + for (auto deviceId : NEO::PVC_XT_IDS) { hwInfo->platform.usDeviceID = deviceId; EXPECT_FALSE(metricIpSamplingOsInterface->isDependencyAvailable()); } 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 3ce950e593..1b60a8c6b4 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 @@ -161,11 +161,13 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, givenDeviceIdThenProperMaxThreadsForWo GTEST_SKIP(); } - hardwareInfo.platform.usDeviceID = FamilyType::pvcXlDeviceId; - EXPECT_EQ(64u, hwInfoConfig.getMaxThreadsForWorkgroupInDSSOrSS(hardwareInfo, 64u, 64u)); - auto xtDevicesCount = 3; - for (int32_t i = 0; i < xtDevicesCount; i++) { - hardwareInfo.platform.usDeviceID = FamilyType::pvcXtDeviceIds[i]; + for (auto &deviceId : PVC_XL_IDS) { + hardwareInfo.platform.usDeviceID = deviceId; + EXPECT_EQ(64u, hwInfoConfig.getMaxThreadsForWorkgroupInDSSOrSS(hardwareInfo, 64u, 64u)); + } + + for (auto &deviceId : PVC_XT_IDS) { + hardwareInfo.platform.usDeviceID = deviceId; uint32_t numThreadsPerEU = hardwareInfo.gtSystemInfo.ThreadCount / hardwareInfo.gtSystemInfo.EUCount; EXPECT_EQ(64u * numThreadsPerEU, hwInfoConfig.getMaxThreadsForWorkgroupInDSSOrSS(hardwareInfo, 64u, 64u)); } @@ -1076,7 +1078,4 @@ XE_HPC_CORETEST_F(HwHelperTestsXeHpcCore, GivenRevisionIdWhenGetComputeUnitsUsed hwInfo.platform.usRevId = testInput.revId; EXPECT_EQ(expectedValue * testInput.expectedRatio, helper.getComputeUnitsUsedForScratch(&hwInfo)); } - hwInfo.platform.usRevId = 0x5; - hwInfo.platform.usDeviceID = FamilyType::pvcXtTemporaryDeviceId; - EXPECT_EQ(expectedValue * 8, helper.getComputeUnitsUsedForScratch(&hwInfo)); } diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp b/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp index 2b7463204f..4056418d53 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp +++ b/opencl/test/unit_test/xe_hpc_core/pvc/test_hw_info_config_pvc.cpp @@ -108,7 +108,9 @@ PVCTEST_F(PvcHwInfo, givenVariousValuesWhenConvertingHwRevIdAndSteppingThenConve auto hwInfo = *defaultHwInfo; const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); - uint32_t deviceIds[] = {FamilyType::pvcXlDeviceId, FamilyType::pvcXtDeviceIds[0], FamilyType::pvcXtDeviceIds[1], FamilyType::pvcXtDeviceIds[2], FamilyType::pvcXtTemporaryDeviceId}; + std::vector deviceIds = PVC_XL_IDS; + deviceIds.insert(deviceIds.end(), PVC_XT_IDS.begin(), PVC_XT_IDS.end()); + for (uint32_t testValue = 0; testValue < 0xFF; testValue++) { for (auto deviceId : deviceIds) { hwInfo.platform.usDeviceID = deviceId; diff --git a/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index be0990dd2d..c08f209b8c 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -92,7 +92,7 @@ class HwInfoConfig { virtual bool isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const = 0; virtual bool isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(const HardwareInfo &hwInfo) const = 0; virtual bool isAdjustProgrammableIdPreferredSlmSizeRequired(const HardwareInfo &hwInfo) const = 0; - virtual bool isThreaEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const = 0; + virtual bool isThreadEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const = 0; virtual bool isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const = 0; MOCKABLE_VIRTUAL ~HwInfoConfig() = default; @@ -171,7 +171,7 @@ class HwInfoConfigHw : public HwInfoConfig { bool isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const override; bool isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(const HardwareInfo &hwInfo) const override; bool isAdjustProgrammableIdPreferredSlmSizeRequired(const HardwareInfo &hwInfo) const override; - bool isThreaEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const override; + bool isThreadEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const override; bool isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const override; protected: diff --git a/shared/source/os_interface/hw_info_config.inl b/shared/source/os_interface/hw_info_config.inl index 563ee11798..1302737e22 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -329,7 +329,7 @@ bool HwInfoConfigHw::isAdjustProgrammableIdPreferredSlmSizeRequired( } template -bool HwInfoConfigHw::isThreaEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const { +bool HwInfoConfigHw::isThreadEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const { return false; } diff --git a/shared/source/xe_hpc_core/CMakeLists.txt b/shared/source/xe_hpc_core/CMakeLists.txt index 46ee9c4309..1087d0aaa1 100644 --- a/shared/source/xe_hpc_core/CMakeLists.txt +++ b/shared/source/xe_hpc_core/CMakeLists.txt @@ -7,13 +7,14 @@ if(SUPPORT_XE_HPC_CORE) set(HW_DEFINITIONS_XE_HPC_CORE ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}hw_cmds_pvc.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}os_agnostic_hw_info_config_pvc_extra.inl + ${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}device_ids_configs_pvc.h ${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}hw_cmds_pvc.inl - ) - set(NEO_CORE_HELPERS - ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/compiler_hw_info_config_pvc.inl ) - set_property(GLOBAL APPEND PROPERTY CORE_SRCS_GENX_ALL_BASE ${HW_DEFINITIONS_XE_HPC_CORE}) + + set_property(GLOBAL APPEND PROPERTY NEO_CORE_HELPERS ${HW_DEFINITIONS_XE_HPC_CORE}) add_subdirectories() endif() diff --git a/shared/source/xe_hpc_core/definitions/os_agnostic_hw_info_config_pvc_extra.inl b/shared/source/xe_hpc_core/definitions/os_agnostic_hw_info_config_pvc_extra.inl new file mode 100644 index 0000000000..0ad6338032 --- /dev/null +++ b/shared/source/xe_hpc_core/definitions/os_agnostic_hw_info_config_pvc_extra.inl @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +template <> +bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template <> +bool HwInfoConfigHw::isThreadEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const { + return true; +} + +template <> +bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const { + return true; +} \ No newline at end of file diff --git a/shared/source/xe_hpc_core/hw_cmds_base.h b/shared/source/xe_hpc_core/hw_cmds_base.h index 2789661e91..dd69a698cf 100644 --- a/shared/source/xe_hpc_core/hw_cmds_base.h +++ b/shared/source/xe_hpc_core/hw_cmds_base.h @@ -6,6 +6,7 @@ */ #pragma once + #include "shared/source/commands/bxml_generator_glue.h" #include "shared/source/helpers/debug_helpers.h" #include "shared/source/xe_hpc_core/hw_info.h" @@ -17,8 +18,8 @@ template struct CmdParse; -namespace NEO { +namespace NEO { struct XE_HPC_CORE { #include "shared/source/generated/xe_hpc_core/hw_cmds_generated_xe_hpc_core.inl" @@ -29,9 +30,6 @@ struct XE_HPC_CORE { static constexpr uint8_t pvcBaseDieRevMask = 0b111000; // [3:5] static constexpr uint8_t pvcBaseDieA0Masked = 0; // [3:5] == 0 static constexpr uint32_t pvcSteppingBits = 0b111; - static constexpr uint32_t pvcXlDeviceId = 0x0BD0; - static constexpr uint32_t pvcXtDeviceIds[5] = {0x0BD5, 0x0BD6, 0x0BD7, 0x0BD8, 0x0BE1}; - static constexpr uint32_t pvcXtTemporaryDeviceId = 0x0BE5; static constexpr bool isUsingL3Control = false; static constexpr bool isUsingMediaSamplerDopClockGate = false; diff --git a/shared/source/xe_hpc_core/hw_cmds_pvc.cpp b/shared/source/xe_hpc_core/hw_cmds_pvc.cpp new file mode 100644 index 0000000000..b0a372066c --- /dev/null +++ b/shared/source/xe_hpc_core/hw_cmds_pvc.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/xe_hpc_core/hw_cmds_pvc.h" + +namespace NEO { +bool PVC::isXlA0(const HardwareInfo &hwInfo) { + auto revId = hwInfo.platform.usRevId & pvcSteppingBits; + return (revId < 0x3); +} + +bool PVC::isAtMostXtA0(const HardwareInfo &hwInfo) { + auto revId = hwInfo.platform.usRevId & pvcSteppingBits; + return (revId <= 0x3); +} + +} // namespace NEO diff --git a/shared/source/xe_hpc_core/hw_cmds_pvc.h b/shared/source/xe_hpc_core/hw_cmds_pvc.h index 179557473a..a89f2e191d 100644 --- a/shared/source/xe_hpc_core/hw_cmds_pvc.h +++ b/shared/source/xe_hpc_core/hw_cmds_pvc.h @@ -7,6 +7,9 @@ #pragma once #include "shared/source/xe_hpc_core/hw_cmds_base.h" + +#include "device_ids_configs_pvc.h" + namespace NEO { struct PVC : public XE_HPC_COREFamily { @@ -28,7 +31,22 @@ struct PVC : public XE_HPC_COREFamily { static void adjustHardwareInfo(HardwareInfo *hwInfo); static bool isXlA0(const HardwareInfo &hwInfo); static bool isAtMostXtA0(const HardwareInfo &hwInfo); - static bool isXtTemporary(const HardwareInfo &hwInfo); + + static bool isXl(const HardwareInfo &hwInfo) { + auto it = std::find(PVC_XL_IDS.begin(), PVC_XL_IDS.end(), hwInfo.platform.usDeviceID); + if (it != PVC_XL_IDS.end()) { + return true; + } + return false; + } + + static bool isXt(const HardwareInfo &hwInfo) { + auto it = std::find(PVC_XT_IDS.begin(), PVC_XT_IDS.end(), hwInfo.platform.usDeviceID); + if (it != PVC_XT_IDS.end()) { + return true; + } + return false; + } }; class PVC_CONFIG : public PVC { 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 92b0c96d02..72cf4e250e 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 @@ -415,7 +415,7 @@ uint32_t HwHelperHw::getComputeUnitsUsedForScratch(const HardwareInfo *p const auto &hwInfoConfig = *HwInfoConfig::get(pHwInfo->platform.eProductFamily); auto revId = pHwInfo->platform.usRevId & Family::pvcSteppingBits; - uint32_t threadEuRatio = ((0x3 <= revId) && hwInfoConfig.isThreaEuRatio16ForScratchRequired(*pHwInfo)) ? 16 : 8; + uint32_t threadEuRatio = ((0x3 <= revId) && hwInfoConfig.isThreadEuRatio16ForScratchRequired(*pHwInfo)) ? 16 : 8; return pHwInfo->gtSystemInfo.MaxSubSlicesSupported * pHwInfo->gtSystemInfo.MaxEuPerSubSlice * threadEuRatio; } diff --git a/shared/source/xe_hpc_core/hw_info_pvc.cpp b/shared/source/xe_hpc_core/hw_info_pvc.cpp index 498b8029c0..65e38dec12 100644 --- a/shared/source/xe_hpc_core/hw_info_pvc.cpp +++ b/shared/source/xe_hpc_core/hw_info_pvc.cpp @@ -140,20 +140,6 @@ void PVC::adjustHardwareInfo(HardwareInfo *hwInfo) { hwInfo->capabilityTable.sharedSystemMemCapabilities = (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS | UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS); } -bool PVC::isXlA0(const HardwareInfo &hwInfo) { - auto revId = hwInfo.platform.usRevId & pvcSteppingBits; - return (revId < 0x3) && !isXtTemporary(hwInfo); -} - -bool PVC::isAtMostXtA0(const HardwareInfo &hwInfo) { - auto revId = hwInfo.platform.usRevId & pvcSteppingBits; - return (revId <= 0x3) && !isXtTemporary(hwInfo); -} - -bool PVC::isXtTemporary(const HardwareInfo &hwInfo) { - return (hwInfo.platform.usDeviceID == pvcXtTemporaryDeviceId); -} - void PVC::setupHardwareInfoBase(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, bool setupMultiTile) { GT_SYSTEM_INFO *gtSysInfo = &hwInfo->gtSystemInfo; gtSysInfo->ThreadCount = gtSysInfo->EUCount * PVC::threadsPerEu; diff --git a/shared/source/xe_hpc_core/linux/hw_info_config_pvc.cpp b/shared/source/xe_hpc_core/linux/hw_info_config_pvc.cpp index 5a5fb67bd6..31d0a16237 100644 --- a/shared/source/xe_hpc_core/linux/hw_info_config_pvc.cpp +++ b/shared/source/xe_hpc_core/linux/hw_info_config_pvc.cpp @@ -28,6 +28,8 @@ const std::map> guidUuidOffsetMap = { #include "shared/source/os_interface/linux/hw_info_config_uuid_xehp_and_later.inl" #include "shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl" +#include "os_agnostic_hw_info_config_pvc_extra.inl" + template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { enableCompression(hwInfo); diff --git a/shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl b/shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl index a790eab093..3e0fe77ac6 100644 --- a/shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl +++ b/shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl @@ -14,16 +14,21 @@ void HwInfoConfigHw::getKernelExtendedProperties(uint32_t *fp16, uin template <> bool HwInfoConfigHw::isMaxThreadsForWorkgroupWARequired(const HardwareInfo &hwInfo) const { - auto deviceId = hwInfo.platform.usDeviceID; - return XE_HPC_COREFamily::pvcXlDeviceId == deviceId; + return PVC::isXl(hwInfo); } template <> uint32_t HwInfoConfigHw::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const { - switch (hwInfo.platform.usDeviceID) { - default: - case XE_HPC_COREFamily::pvcXtTemporaryDeviceId: - case XE_HPC_COREFamily::pvcXlDeviceId: + if (PVC::isXt(hwInfo)) { + switch (stepping) { + case REVISION_A0: + return 0x3; + case REVISION_B: + return 0x9D; + case REVISION_C: + return 0x7; + } + } else { switch (stepping) { case REVISION_A0: return 0x0; @@ -33,19 +38,8 @@ uint32_t HwInfoConfigHw::getHwRevIdFromStepping(uint32_t stepping, c DEBUG_BREAK_IF(true); return 0x7; } - break; - case XE_HPC_COREFamily::pvcXtDeviceIds[0]: - case XE_HPC_COREFamily::pvcXtDeviceIds[1]: - case XE_HPC_COREFamily::pvcXtDeviceIds[2]: - switch (stepping) { - case REVISION_A0: - return 0x3; - case REVISION_B: - return 0x9D; - case REVISION_C: - return 0x7; - } } + return CommonConstants::invalidStepping; } @@ -137,11 +131,6 @@ bool HwInfoConfigHw::isGlobalFenceAsPostSyncOperationInComputeWalker return !PVC::isXlA0(hwInfo); } -template <> -bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const { - return PVC::isXtTemporary(hwInfo); -} - template <> bool HwInfoConfigHw::isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(const HardwareInfo &hwInfo) const { return !PVC::isXlA0(hwInfo); @@ -151,13 +140,3 @@ template <> bool HwInfoConfigHw::isAdjustProgrammableIdPreferredSlmSizeRequired(const HardwareInfo &hwInfo) const { return PVC::isXlA0(hwInfo); } - -template <> -bool HwInfoConfigHw::isThreaEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const { - return !PVC::isXtTemporary(hwInfo); -} - -template <> -bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const { - return !PVC::isXtTemporary(hwInfo); -} \ No newline at end of file diff --git a/shared/source/xe_hpc_core/windows/hw_info_config_pvc.cpp b/shared/source/xe_hpc_core/windows/hw_info_config_pvc.cpp index c07c1897eb..002f70c444 100644 --- a/shared/source/xe_hpc_core/windows/hw_info_config_pvc.cpp +++ b/shared/source/xe_hpc_core/windows/hw_info_config_pvc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,6 +18,8 @@ constexpr static auto gfxProduct = IGFX_PVC; #include "shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl" +#include "os_agnostic_hw_info_config_pvc_extra.inl" + template <> int HwInfoConfigHw::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { enableCompression(hwInfo); diff --git a/shared/test/common/helpers/test_hw_info_config.cpp b/shared/test/common/helpers/test_hw_info_config.cpp index ebc29ea74b..8db5222f46 100644 --- a/shared/test/common/helpers/test_hw_info_config.cpp +++ b/shared/test/common/helpers/test_hw_info_config.cpp @@ -50,5 +50,5 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsSystolicModeConfigurabledThenF HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsThreaEuRatio16ForScratchRequiredThenFalseIsReturned) { const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); - EXPECT_FALSE(hwInfoConfig.isThreaEuRatio16ForScratchRequired(*defaultHwInfo)); + EXPECT_FALSE(hwInfoConfig.isThreadEuRatio16ForScratchRequired(*defaultHwInfo)); } diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index 934fb0273c..c55ac35a09 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -318,7 +318,7 @@ bool HwInfoConfigHw::isAdjustProgrammableIdPreferredSlmSizeRequire } template <> -bool HwInfoConfigHw::isThreaEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const { +bool HwInfoConfigHw::isThreadEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const { return false; } diff --git a/shared/test/common/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp b/shared/test/common/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp index 0f631aff26..7b174857fd 100644 --- a/shared/test/common/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp +++ b/shared/test/common/xe_hpc_core/pvc/test_encode_dispatch_kernel_pvc.cpp @@ -37,13 +37,16 @@ PVCTEST_F(CommandEncodeStatesPvcTest, GivenSmallSlmTotalSizesWhenSetAdditionalIn }; for (auto &revisionToTest : revisionsToTest) { - hwInfo.platform.usRevId = revisionToTest.revisionId; - INTERFACE_DESCRIPTOR_DATA idd = FamilyType::cmdInitInterfaceDescriptorData; - EncodeDispatchKernel::appendAdditionalIDDFields(&idd, hwInfo, threadsCount, slmTotalSize, SlmPolicy::SlmPolicyNone); - if (revisionToTest.isWaRequired) { - EXPECT_EQ(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K, idd.getPreferredSlmAllocationSize()); - } else { - EXPECT_EQ(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K, idd.getPreferredSlmAllocationSize()); + for (auto &deviceId : PVC_XL_IDS) { + hwInfo.platform.usDeviceID = deviceId; + hwInfo.platform.usRevId = revisionToTest.revisionId; + INTERFACE_DESCRIPTOR_DATA idd = FamilyType::cmdInitInterfaceDescriptorData; + EncodeDispatchKernel::appendAdditionalIDDFields(&idd, hwInfo, threadsCount, slmTotalSize, SlmPolicy::SlmPolicyNone); + if (revisionToTest.isWaRequired) { + EXPECT_EQ(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K, idd.getPreferredSlmAllocationSize()); + } else { + EXPECT_EQ(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K, idd.getPreferredSlmAllocationSize()); + } } } } diff --git a/shared/test/common/xe_hpc_core/pvc/test_preamble_pvc.cpp b/shared/test/common/xe_hpc_core/pvc/test_preamble_pvc.cpp index 802d36c6ef..ef3098855d 100644 --- a/shared/test/common/xe_hpc_core/pvc/test_preamble_pvc.cpp +++ b/shared/test/common/xe_hpc_core/pvc/test_preamble_pvc.cpp @@ -40,7 +40,6 @@ PVCTEST_F(PreambleCfeState, givenXeHpcAndKernelExecutionTypeAndRevisionWhenCalli auto cfeState = reinterpret_cast(*cfeStateIt); auto expectedValue = (HwInfoConfig::get(hwInfo->platform.eProductFamily)->getSteppingFromHwRevId(*hwInfo) >= REVISION_B) && - (!PVC::isXtTemporary(*defaultHwInfo)) && kernelExecutionType; EXPECT_EQ(expectedValue, cfeState->getComputeDispatchAllWalkerEnable()); EXPECT_EQ(expectedValue, cfeState->getSingleSliceDispatchCcsMode()); @@ -48,29 +47,6 @@ PVCTEST_F(PreambleCfeState, givenXeHpcAndKernelExecutionTypeAndRevisionWhenCalli } } -PVCTEST_F(PreambleCfeState, givenPvcXtTemporaryAndKernelExecutionTypeConcurrentAndRevisionBWhenCallingProgramVFEStateThenAllWalkerIsDisabled) { - using CFE_STATE = typename FamilyType::CFE_STATE; - - auto hwInfo = *defaultHwInfo; - hwInfo.platform.usDeviceID = 0x0BE5; - - const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); - hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo); - - auto pVfeCmd = PreambleHelper::getSpaceForVfeState(&linearStream, hwInfo, EngineGroupType::RenderCompute); - StreamProperties streamProperties{}; - streamProperties.frontEndState.setProperties(true, false, false, false, hwInfo); - - PreambleHelper::programVfeState(pVfeCmd, hwInfo, 0u, 0, 0, streamProperties); - parseCommands(linearStream); - auto cfeStateIt = find(cmdList.begin(), cmdList.end()); - ASSERT_NE(cmdList.end(), cfeStateIt); - auto cfeState = reinterpret_cast(*cfeStateIt); - - EXPECT_FALSE(cfeState->getComputeDispatchAllWalkerEnable()); - EXPECT_FALSE(cfeState->getSingleSliceDispatchCcsMode()); -} - using PreamblePipelineSelectState = PreambleFixture; PVCTEST_F(PreamblePipelineSelectState, givenRevisionBAndAboveWhenCallingProgramPipelineSelectThenSystolicModeDisabled) { using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT; diff --git a/shared/test/common/xe_hpc_core/test_encode_xe_hpc_core.cpp b/shared/test/common/xe_hpc_core/test_encode_xe_hpc_core.cpp index 88e9b13527..1764e85d5a 100644 --- a/shared/test/common/xe_hpc_core/test_encode_xe_hpc_core.cpp +++ b/shared/test/common/xe_hpc_core/test_encode_xe_hpc_core.cpp @@ -455,14 +455,17 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenRevisionBAndAboveWhenSpecialMo {0x7, false}, }; for (auto &testInput : testInputs) { - hwInfo->platform.usRevId = testInput.revId; - cmdContainer->lastPipelineSelectModeRequired = false; + for (auto &deviceId : PVC_XL_IDS) { + hwInfo->platform.usDeviceID = deviceId; + hwInfo->platform.usRevId = testInput.revId; + cmdContainer->lastPipelineSelectModeRequired = false; - EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs); - dispatchArgs.preemptionMode = NEO::PreemptionMode::Initial; + EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs); + dispatchArgs.preemptionMode = NEO::PreemptionMode::Initial; - EncodeDispatchKernel::encode(*cmdContainer.get(), dispatchArgs); - EXPECT_EQ(testInput.expectedValue, cmdContainer->lastPipelineSelectModeRequired); + EncodeDispatchKernel::encode(*cmdContainer.get(), dispatchArgs); + EXPECT_EQ(testInput.expectedValue, cmdContainer->lastPipelineSelectModeRequired); + } } } @@ -489,16 +492,19 @@ XE_HPC_CORETEST_F(EncodeKernelXeHpcCoreTest, givenRevisionBAndAboveWhenSpecialMo {0x7, false}, }; for (auto &testInput : testInputs) { - hwInfo->platform.usRevId = testInput.revId; - EncodeComputeMode::adjustPipelineSelect(*cmdContainer.get(), dispatchInterface->kernelDescriptor); - GenCmdList commands; - CmdParse::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed()); + for (auto &deviceId : PVC_XL_IDS) { + hwInfo->platform.usDeviceID = deviceId; + hwInfo->platform.usRevId = testInput.revId; + EncodeComputeMode::adjustPipelineSelect(*cmdContainer.get(), dispatchInterface->kernelDescriptor); + GenCmdList commands; + CmdParse::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed()); - auto itor = find(commands.begin(), commands.end()); - ASSERT_NE(itor, commands.end()); + auto itor = find(commands.begin(), commands.end()); + ASSERT_NE(itor, commands.end()); - auto pipelineSelectCmd = genCmdCast(*itor); - EXPECT_EQ(testInput.expectedValue, pipelineSelectCmd->getSystolicModeEnable()); - cmdContainer->reset(); + auto pipelineSelectCmd = genCmdCast(*itor); + EXPECT_EQ(testInput.expectedValue, pipelineSelectCmd->getSystolicModeEnable()); + cmdContainer->reset(); + } } } diff --git a/shared/test/unit_test/xe_hpc_core/dispatch_walker_tests_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/dispatch_walker_tests_xe_hpc_core.cpp index cfe36e240e..6060f5f365 100644 --- a/shared/test/unit_test/xe_hpc_core/dispatch_walker_tests_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/dispatch_walker_tests_xe_hpc_core.cpp @@ -40,14 +40,16 @@ XE_HPC_CORETEST_F(WalkerDispatchTestsXeHpcCore, whenEncodeAdditionalWalkerFields } for (auto &testInput : testInputs) { - hwInfo.platform.usRevId = testInput.revisionId; - DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set( - testInput.programGlobalFenceAsPostSyncOperationInComputeWalker); + for (auto &deviceId : PVC_XL_IDS) { + hwInfo.platform.usDeviceID = deviceId; + hwInfo.platform.usRevId = testInput.revisionId; + DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.set( + testInput.programGlobalFenceAsPostSyncOperationInComputeWalker); - postSyncData.setSystemMemoryFenceRequest(false); - - EncodeDispatchKernel::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Default); - EXPECT_EQ(testInput.expectSystemMemoryFenceRequest, postSyncData.getSystemMemoryFenceRequest()); + postSyncData.setSystemMemoryFenceRequest(false); + EncodeDispatchKernel::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Default); + EXPECT_EQ(testInput.expectSystemMemoryFenceRequest, postSyncData.getSystemMemoryFenceRequest()); + } } } @@ -68,26 +70,3 @@ XE_HPC_CORETEST_F(WalkerDispatchTestsXeHpcCore, givenPvcWhenEncodeAdditionalWalk EXPECT_TRUE(walkerCmd.getComputeDispatchAllWalkerEnable()); } } - -XE_HPC_CORETEST_F(WalkerDispatchTestsXeHpcCore, givenPvcXtTemporaryWhenEncodeAdditionalWalkerFieldsIsCalledThenComputeDispatchAllIsCorrectlySet) { - using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER; - - auto hwInfo = *defaultHwInfo; - hwInfo.platform.usDeviceID = 0x0BE5; - - if (hwInfo.platform.eProductFamily != IGFX_PVC) { - GTEST_SKIP(); - } - - auto walkerCmd = FamilyType::cmdInitGpgpuWalker; - - { - EncodeDispatchKernel::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Default); - EXPECT_FALSE(walkerCmd.getComputeDispatchAllWalkerEnable()); - } - - { - EncodeDispatchKernel::encodeAdditionalWalkerFields(hwInfo, walkerCmd, KernelExecutionType::Concurrent); - EXPECT_TRUE(walkerCmd.getComputeDispatchAllWalkerEnable()); - } -} diff --git a/shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt b/shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt new file mode 100644 index 0000000000..968e4b3a8a --- /dev/null +++ b/shared/test/unit_test/xe_hpc_core/pvc/CMakeLists.txt @@ -0,0 +1,15 @@ +# +# Copyright (C) 2022 Intel Corporation +# +# SPDX-License-Identifier: MIT +# + +if(TESTS_PVC) + set(NEO_SHARED_TESTS_PVC + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_pvc.cpp + ) + + target_sources(${TARGET_NAME} PRIVATE ${NEO_SHARED_TESTS_PVC}) + add_subdirectories() +endif() diff --git a/shared/test/unit_test/xe_hpc_core/pvc/hw_info_tests_pvc.cpp b/shared/test/unit_test/xe_hpc_core/pvc/hw_info_tests_pvc.cpp new file mode 100644 index 0000000000..29949b9380 --- /dev/null +++ b/shared/test/unit_test/xe_hpc_core/pvc/hw_info_tests_pvc.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/helpers/hw_info.h" +#include "shared/test/common/helpers/default_hw_info.h" +#include "shared/test/common/test_macros/test.h" + +using namespace NEO; + +using PvcConfigHwInfoTests = ::testing::Test; + +PVCTEST_F(PvcConfigHwInfoTests, givenPvcDeviceIdsAndRevisionsWhenCheckingConfigsThenReturnCorrectValues) { + HardwareInfo hwInfo = *defaultHwInfo; + + for (auto &deviceId : PVC_XL_IDS) { + hwInfo.platform.usDeviceID = deviceId; + EXPECT_TRUE(PVC::isXl(hwInfo)); + EXPECT_FALSE(PVC::isXt(hwInfo)); + + hwInfo.platform.usRevId = 0x0; + EXPECT_TRUE(PVC::isXlA0(hwInfo)); + EXPECT_TRUE(PVC::isAtMostXtA0(hwInfo)); + + hwInfo.platform.usRevId = 0x1; + EXPECT_TRUE(PVC::isXlA0(hwInfo)); + EXPECT_TRUE(PVC::isAtMostXtA0(hwInfo)); + + hwInfo.platform.usRevId = 0x6; + EXPECT_FALSE(PVC::isXlA0(hwInfo)); + EXPECT_FALSE(PVC::isAtMostXtA0(hwInfo)); + } + + for (auto &deviceId : PVC_XT_IDS) { + hwInfo.platform.usDeviceID = deviceId; + EXPECT_FALSE(PVC::isXl(hwInfo)); + EXPECT_TRUE(PVC::isXt(hwInfo)); + + hwInfo.platform.usRevId = 0x0; + EXPECT_TRUE(PVC::isAtMostXtA0(hwInfo)); + + hwInfo.platform.usRevId = 0x1; + EXPECT_TRUE(PVC::isAtMostXtA0(hwInfo)); + + hwInfo.platform.usRevId = 0x3; + EXPECT_TRUE(PVC::isAtMostXtA0(hwInfo)); + + hwInfo.platform.usRevId = 0x5; + EXPECT_FALSE(PVC::isAtMostXtA0(hwInfo)); + } +}