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 new file mode 100644 index 0000000000..b1a4aa6e16 --- /dev/null +++ b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/CMakeLists.txt @@ -0,0 +1,12 @@ +# +# 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 new file mode 100644 index 0000000000..160b296c5d --- /dev/null +++ b/level_zero/core/test/unit_tests/xe_hpc_core/pvc/test_cmdqueue_pvc.cpp @@ -0,0 +1,131 @@ +/* + * 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/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp index a0cc858f4b..8321912729 100644 --- a/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp +++ b/level_zero/core/test/unit_tests/xe_hpc_core/test_cmdqueue_xe_hpc_core.cpp @@ -163,113 +163,5 @@ HWTEST2_F(CommandQueueCommandsPvc, givenLinkedCopyEngineOrdinalWhenCreatingThenS L0::Context::fromHandle(hContext)->destroy(); } -HWTEST2_F(CommandQueueCommandsPvc, whenExecuteCommandListsIsCalledThenAdditionalCfeStatesAreCorrectlyProgrammed, IsXeHpcCore) { - if (!XE_HPC_CORE::isXtTemporary(*defaultHwInfo)) { - GTEST_SKIP(); - } - - if (defaultHwInfo->platform.eProductFamily != IGFX_PVC) { - 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; - } - if constexpr (IsPVC::isMatched()) { - 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/shared/source/os_interface/hw_info_config.h b/shared/source/os_interface/hw_info_config.h index d8435897f0..be0990dd2d 100644 --- a/shared/source/os_interface/hw_info_config.h +++ b/shared/source/os_interface/hw_info_config.h @@ -86,6 +86,15 @@ class HwInfoConfig { virtual bool getUuid(Device *device, std::array &uuid) const = 0; virtual bool isFlushTaskAllowed() const = 0; virtual bool programAllStateComputeCommandFields() const = 0; + virtual bool isSpecialPipelineSelectModeChanged(const HardwareInfo &hwInfo) const = 0; + virtual bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const = 0; + virtual bool isGlobalFenceAsPostSyncOperationInComputeWalkerRequired(const HardwareInfo &hwInfo) const = 0; + 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 isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const = 0; + MOCKABLE_VIRTUAL ~HwInfoConfig() = default; protected: @@ -156,6 +165,14 @@ class HwInfoConfigHw : public HwInfoConfig { bool getUuid(Device *device, std::array &uuid) const override; bool isFlushTaskAllowed() const override; bool programAllStateComputeCommandFields() const override; + bool isSpecialPipelineSelectModeChanged(const HardwareInfo &hwInfo) const override; + bool isSystolicModeConfigurable(const HardwareInfo &hwInfo) const override; + bool isGlobalFenceAsPostSyncOperationInComputeWalkerRequired(const HardwareInfo &hwInfo) const override; + 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 isComputeDispatchAllWalkerEnableInCfeStateRequired(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 f96089e55e..563ee11798 100644 --- a/shared/source/os_interface/hw_info_config.inl +++ b/shared/source/os_interface/hw_info_config.inl @@ -298,4 +298,44 @@ bool HwInfoConfigHw::programAllStateComputeCommandFields() const { return false; } +template +bool HwInfoConfigHw::isSpecialPipelineSelectModeChanged(const HardwareInfo &hwInfo) const { + return false; +} + +template +bool HwInfoConfigHw::isSystolicModeConfigurable(const HardwareInfo &hwInfo) const { + return false; +} + +template +bool HwInfoConfigHw::isGlobalFenceAsPostSyncOperationInComputeWalkerRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template +bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template +bool HwInfoConfigHw::isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template +bool HwInfoConfigHw::isAdjustProgrammableIdPreferredSlmSizeRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template +bool HwInfoConfigHw::isThreaEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template +bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const { + return false; +} + } // namespace NEO diff --git a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp index e5d471e7b7..912c91f3e2 100644 --- a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp @@ -175,7 +175,9 @@ void EncodeDispatchKernel::programBarrierEnable(INTERFACE_DESCRIPTOR_DAT template <> void EncodeDispatchKernel::encodeAdditionalWalkerFields(const HardwareInfo &hwInfo, WALKER_TYPE &walkerCmd, KernelExecutionType kernelExecutionType) { - auto programGlobalFenceAsPostSyncOperationInComputeWalker = !Family::isXlA0(hwInfo); + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + auto programGlobalFenceAsPostSyncOperationInComputeWalker = hwInfoConfig.isGlobalFenceAsPostSyncOperationInComputeWalkerRequired(hwInfo); + if (DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.get() != -1) { programGlobalFenceAsPostSyncOperationInComputeWalker = !!DebugManager.flags.ProgramGlobalFenceAsPostSyncOperationInComputeWalker.get(); } @@ -188,7 +190,7 @@ void EncodeDispatchKernel::encodeAdditionalWalkerFields(const HardwareIn walkerCmd.setL3PrefetchDisable(!DebugManager.flags.ForceL3PrefetchForComputeWalker.get()); } - auto programComputeDispatchAllWalkerEnableInComputeWalker = Family::isXtTemporary(hwInfo); + auto programComputeDispatchAllWalkerEnableInComputeWalker = hwInfoConfig.isComputeDispatchAllWalkerEnableInComputeWalkerRequired(hwInfo); if (programComputeDispatchAllWalkerEnableInComputeWalker) { if (kernelExecutionType == KernelExecutionType::Concurrent) { walkerCmd.setComputeDispatchAllWalkerEnable(true); @@ -240,7 +242,9 @@ void EncodeDispatchKernel::appendAdditionalIDDFields(INTERFACE_DESCRIPTO } } - if ((slmSize == 0) && (Family::isXlA0(hwInfo))) { + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + + if ((slmSize == 0) && (hwInfoConfig.isAdjustProgrammableIdPreferredSlmSizeRequired(hwInfo))) { programmableIdPreferredSlmSize = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_16K; } diff --git a/shared/source/xe_hpc_core/hw_cmds_base.h b/shared/source/xe_hpc_core/hw_cmds_base.h index bfbbf8ef06..2789661e91 100644 --- a/shared/source/xe_hpc_core/hw_cmds_base.h +++ b/shared/source/xe_hpc_core/hw_cmds_base.h @@ -38,24 +38,6 @@ struct XE_HPC_CORE { static constexpr bool supportsSampler = false; static constexpr bool isUsingGenericMediaStateClear = true; - static bool isPvc(const HardwareInfo &hwInfo) { - return hwInfo.platform.eProductFamily == IGFX_PVC; - } - - static bool isXlA0(const HardwareInfo &hwInfo) { - auto revId = hwInfo.platform.usRevId & pvcSteppingBits; - return (revId < 0x3) && !isXtTemporary(hwInfo); - } - - static bool isAtMostXtA0(const HardwareInfo &hwInfo) { - auto revId = hwInfo.platform.usRevId & pvcSteppingBits; - return (revId <= 0x3) && !isXtTemporary(hwInfo); - } - - static bool isXtTemporary(const HardwareInfo &hwInfo) { - return (hwInfo.platform.usDeviceID == pvcXtTemporaryDeviceId) || !isPvc(hwInfo); - } - struct DataPortBindlessSurfaceExtendedMessageDescriptor { union { struct { diff --git a/shared/source/xe_hpc_core/hw_cmds_pvc.h b/shared/source/xe_hpc_core/hw_cmds_pvc.h index d61bc1bb70..179557473a 100644 --- a/shared/source/xe_hpc_core/hw_cmds_pvc.h +++ b/shared/source/xe_hpc_core/hw_cmds_pvc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Intel Corporation + * Copyright (C) 2021-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -26,6 +26,9 @@ struct PVC : public XE_HPC_COREFamily { static void setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo); static void setupHardwareInfoBase(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, bool setupMultiTile); static void adjustHardwareInfo(HardwareInfo *hwInfo); + static bool isXlA0(const HardwareInfo &hwInfo); + static bool isAtMostXtA0(const HardwareInfo &hwInfo); + static bool isXtTemporary(const HardwareInfo &hwInfo); }; 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 9d41bcb4e4..92b0c96d02 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 @@ -172,7 +172,8 @@ size_t HwHelperHw::getPaddingForISAAllocation() const { template <> size_t MemorySynchronizationCommands::getSizeForSingleAdditionalSynchronization(const HardwareInfo &hwInfo) { - auto programGlobalFenceAsMiMemFenceCommandInCommandStream = !Family::isXlA0(hwInfo); + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + auto programGlobalFenceAsMiMemFenceCommandInCommandStream = hwInfoConfig.isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(hwInfo); if (DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.get() != -1) { programGlobalFenceAsMiMemFenceCommandInCommandStream = !!DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.get(); } @@ -188,7 +189,9 @@ template <> void MemorySynchronizationCommands::setAdditionalSynchronization(void *&commandsBuffer, uint64_t gpuAddress, const HardwareInfo &hwInfo) { using MI_MEM_FENCE = typename Family::MI_MEM_FENCE; using MI_SEMAPHORE_WAIT = typename Family::MI_SEMAPHORE_WAIT; - auto programGlobalFenceAsMiMemFenceCommandInCommandStream = !Family::isXlA0(hwInfo); + + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + auto programGlobalFenceAsMiMemFenceCommandInCommandStream = hwInfoConfig.isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(hwInfo); if (DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.get() != -1) { programGlobalFenceAsMiMemFenceCommandInCommandStream = !!DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.get(); } @@ -410,8 +413,9 @@ uint32_t HwHelperHw::getComputeUnitsUsedForScratch(const HardwareInfo *p return static_cast(DebugManager.flags.OverrideNumComputeUnitsForScratch.get()); } + const auto &hwInfoConfig = *HwInfoConfig::get(pHwInfo->platform.eProductFamily); auto revId = pHwInfo->platform.usRevId & Family::pvcSteppingBits; - uint32_t threadEuRatio = ((0x3 <= revId) && !Family::isXtTemporary(*pHwInfo)) ? 16 : 8; + uint32_t threadEuRatio = ((0x3 <= revId) && hwInfoConfig.isThreaEuRatio16ForScratchRequired(*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 427f8f6c68..498b8029c0 100644 --- a/shared/source/xe_hpc_core/hw_info_pvc.cpp +++ b/shared/source/xe_hpc_core/hw_info_pvc.cpp @@ -139,6 +139,21 @@ void PVC::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) { 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/os_agnostic_hw_info_config_pvc.inl b/shared/source/xe_hpc_core/os_agnostic_hw_info_config_pvc.inl index 26f8770889..a790eab093 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 @@ -120,4 +120,44 @@ bool HwInfoConfigHw::isDcFlushAllowed() const { template <> bool HwInfoConfigHw::isFlushTaskAllowed() const { return true; +} + +template <> +bool HwInfoConfigHw::isSpecialPipelineSelectModeChanged(const HardwareInfo &hwInfo) const { + return PVC::isAtMostXtA0(hwInfo); +} + +template <> +bool HwInfoConfigHw::isSystolicModeConfigurable(const HardwareInfo &hwInfo) const { + return PVC::isAtMostXtA0(hwInfo); +} + +template <> +bool HwInfoConfigHw::isGlobalFenceAsPostSyncOperationInComputeWalkerRequired(const HardwareInfo &hwInfo) const { + 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); +} + +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/preamble_xe_hpc_core.cpp b/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp index 2e7940baa6..d8ded95ab2 100644 --- a/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/preamble_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2021 Intel Corporation + * Copyright (C) 2020-2022 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,8 +24,10 @@ void PreambleHelper::appendProgramVFEState(const HardwareInfo &hwInfo, c command->setComputeOverdispatchDisable(streamProperties.frontEndState.disableOverdispatch.value == 1); command->setSingleSliceDispatchCcsMode(streamProperties.frontEndState.singleSliceDispatchCcsMode.value == 1); - if (HwInfoConfig::get(hwInfo.platform.eProductFamily)->getSteppingFromHwRevId(hwInfo) >= REVISION_B) { - const auto programComputeDispatchAllWalkerEnableInCfeState = !Family::isXtTemporary(hwInfo); + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + + if (hwInfoConfig.getSteppingFromHwRevId(hwInfo) >= REVISION_B) { + const auto programComputeDispatchAllWalkerEnableInCfeState = hwInfoConfig.isComputeDispatchAllWalkerEnableInCfeStateRequired(hwInfo); if (programComputeDispatchAllWalkerEnableInCfeState && streamProperties.frontEndState.computeDispatchAllWalkerEnable.value > 0) { command->setComputeDispatchAllWalkerEnable(true); command->setSingleSliceDispatchCcsMode(true); @@ -51,13 +53,16 @@ void PreambleHelper::appendProgramVFEState(const HardwareInfo &hwInfo, c template <> bool PreambleHelper::isSystolicModeConfigurable(const HardwareInfo &hwInfo) { - return Family::isAtMostXtA0(hwInfo); + const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); + return hwInfoConfig.isSystolicModeConfigurable(hwInfo); } template <> bool PreambleHelper::isSpecialPipelineSelectModeChanged(bool lastSpecialPipelineSelectMode, bool newSpecialPipelineSelectMode, const HardwareInfo &hwInfo) { - return (lastSpecialPipelineSelectMode != newSpecialPipelineSelectMode) && Family::isAtMostXtA0(hwInfo); + + const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily); + return (lastSpecialPipelineSelectMode != newSpecialPipelineSelectMode) && hwInfoConfig.isSpecialPipelineSelectModeChanged(hwInfo); } template struct PreambleHelper; diff --git a/shared/test/common/helpers/CMakeLists.txt b/shared/test/common/helpers/CMakeLists.txt index 7563780458..0c1b5b0144 100644 --- a/shared/test/common/helpers/CMakeLists.txt +++ b/shared/test/common/helpers/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2019-2021 Intel Corporation +# Copyright (C) 2019-2022 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -30,6 +30,7 @@ set(NEO_CORE_HELPERS_TESTS ${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests.inl ${CMAKE_CURRENT_SOURCE_DIR}/string_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/string_to_hash_tests.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config.cpp ${CMAKE_CURRENT_SOURCE_DIR}/test_traits.h ${CMAKE_CURRENT_SOURCE_DIR}/test_traits_platforms.h ${CMAKE_CURRENT_SOURCE_DIR}/includes${BRANCH_DIR_SUFFIX}test_traits_common.h diff --git a/shared/test/common/helpers/test_hw_info_config.cpp b/shared/test/common/helpers/test_hw_info_config.cpp new file mode 100644 index 0000000000..ebc29ea74b --- /dev/null +++ b/shared/test/common/helpers/test_hw_info_config.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/os_interface/hw_info_config.h" +#include "shared/test/common/fixtures/device_fixture.h" +#include "shared/test/common/test_macros/test.h" + +using namespace NEO; + +using HwInfoConfigTest = Test; + +HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsAdjustProgrammableIdPreferredSlmSizeRequiredThenFalseIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.isAdjustProgrammableIdPreferredSlmSizeRequired(*defaultHwInfo)); +} + +HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsComputeDispatchAllWalkerEnableInCfeStateRequiredThenFalseIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.isComputeDispatchAllWalkerEnableInCfeStateRequired(*defaultHwInfo)); +} + +HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsComputeDispatchAllWalkerEnableInComputeWalkerRequiredThenFalseIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.isComputeDispatchAllWalkerEnableInComputeWalkerRequired(*defaultHwInfo)); +} + +HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsGlobalFenceAsMiMemFenceCommandInCommandStreamRequiredThenFalseIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(*defaultHwInfo)); +} + +HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsGlobalFenceAsPostSyncOperationInComputeWalkerRequiredThenFalseIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.isGlobalFenceAsPostSyncOperationInComputeWalkerRequired(*defaultHwInfo)); +} + +HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsSpecialPipelineSelectModeChangedThenFalseIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.isSpecialPipelineSelectModeChanged(*defaultHwInfo)); +} + +HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsSystolicModeConfigurabledThenFalseIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.isSystolicModeConfigurable(*defaultHwInfo)); +} + +HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenIsThreaEuRatio16ForScratchRequiredThenFalseIsReturned) { + const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily); + EXPECT_FALSE(hwInfoConfig.isThreaEuRatio16ForScratchRequired(*defaultHwInfo)); +} diff --git a/shared/test/common/mocks/mock_hw_info_config.cpp b/shared/test/common/mocks/mock_hw_info_config.cpp index 20b49c13a0..934fb0273c 100644 --- a/shared/test/common/mocks/mock_hw_info_config.cpp +++ b/shared/test/common/mocks/mock_hw_info_config.cpp @@ -287,4 +287,44 @@ bool HwInfoConfigHw::programAllStateComputeCommandFields() const { return false; } +template <> +bool HwInfoConfigHw::isSpecialPipelineSelectModeChanged(const HardwareInfo &hwInfo) const { + return false; +} + +template <> +bool HwInfoConfigHw::isSystolicModeConfigurable(const HardwareInfo &hwInfo) const { + return false; +} + +template <> +bool HwInfoConfigHw::isGlobalFenceAsPostSyncOperationInComputeWalkerRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template <> +bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInComputeWalkerRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template <> +bool HwInfoConfigHw::isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template <> +bool HwInfoConfigHw::isAdjustProgrammableIdPreferredSlmSizeRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template <> +bool HwInfoConfigHw::isThreaEuRatio16ForScratchRequired(const HardwareInfo &hwInfo) const { + return false; +} + +template <> +bool HwInfoConfigHw::isComputeDispatchAllWalkerEnableInCfeStateRequired(const HardwareInfo &hwInfo) const { + return false; +} + } //namespace NEO diff --git a/shared/test/common/xe_hpc_core/excludes_xe_hpc_core.cpp b/shared/test/common/xe_hpc_core/excludes_xe_hpc_core.cpp index ad432b8421..83d27eda19 100644 --- a/shared/test/common/xe_hpc_core/excludes_xe_hpc_core.cpp +++ b/shared/test/common/xe_hpc_core/excludes_xe_hpc_core.cpp @@ -22,3 +22,11 @@ HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenL HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsLowerThan128ThenSmallGRFModeIsProgrammed_ForceNonCoherentSupportedMatcher, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsGreaterThan128ThenLargeGRFModeIsProgrammed_ForceNonCoherentSupportedMatcher, IGFX_XE_HPC_CORE); HWTEST_EXCLUDE_PRODUCT(BlitTests, givenXyCopyBltCommandWhenAppendBlitCommandsMemCopyIsCalledThenNothingChanged, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenIsAdjustProgrammableIdPreferredSlmSizeRequiredThenFalseIsReturned, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenIsComputeDispatchAllWalkerEnableInCfeStateRequiredThenFalseIsReturned, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenIsComputeDispatchAllWalkerEnableInComputeWalkerRequiredThenFalseIsReturned, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenIsGlobalFenceAsMiMemFenceCommandInCommandStreamRequiredThenFalseIsReturned, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenIsGlobalFenceAsPostSyncOperationInComputeWalkerRequiredThenFalseIsReturned, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenIsSpecialPipelineSelectModeChangedThenFalseIsReturned, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenIsSystolicModeConfigurabledThenFalseIsReturned, IGFX_XE_HPC_CORE); +HWTEST_EXCLUDE_PRODUCT(HwInfoConfigTest, givenHwInfoConfigWhenIsThreaEuRatio16ForScratchRequiredThenFalseIsReturned, IGFX_XE_HPC_CORE); diff --git a/shared/test/common/xe_hpc_core/pvc/CMakeLists.txt b/shared/test/common/xe_hpc_core/pvc/CMakeLists.txt index 94764d1d32..fe639a14f5 100644 --- a/shared/test/common/xe_hpc_core/pvc/CMakeLists.txt +++ b/shared/test/common/xe_hpc_core/pvc/CMakeLists.txt @@ -1,5 +1,5 @@ # -# Copyright (C) 2021 Intel Corporation +# Copyright (C) 2021-2022 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -8,6 +8,8 @@ if(TESTS_PVC) set(NEO_CORE_TESTS_XE_HPC_CORE_PVC ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dispatch_kernel_pvc.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_pvc.cpp + ) target_sources(${TARGET_NAME} PRIVATE ${NEO_CORE_TESTS_XE_HPC_CORE_PVC}) 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 new file mode 100644 index 0000000000..802d36c6ef --- /dev/null +++ b/shared/test/common/xe_hpc_core/pvc/test_preamble_pvc.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2022 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/command_stream/stream_properties.h" +#include "shared/source/helpers/hw_helper.h" +#include "shared/source/os_interface/device_factory.h" +#include "shared/source/os_interface/hw_info_config.h" +#include "shared/test/common/helpers/debug_manager_state_restore.h" +#include "shared/test/unit_test/preamble/preamble_fixture.h" + +using namespace NEO; + +using PreambleCfeState = PreambleFixture; + +PVCTEST_F(PreambleCfeState, givenXeHpcAndKernelExecutionTypeAndRevisionWhenCallingProgramVFEStateThenCFEStateParamsAreCorrectlySet) { + using CFE_STATE = typename FamilyType::CFE_STATE; + auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + + const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo->platform.eProductFamily); + auto pVfeCmd = PreambleHelper::getSpaceForVfeState(&linearStream, *hwInfo, EngineGroupType::RenderCompute); + StreamProperties streamProperties{}; + std::array, 4> revisions = { + {{REVISION_A0, false}, + {REVISION_A0, true}, + {REVISION_B, false}, + {REVISION_B, true}}}; + + for (const auto &[revision, kernelExecutionType] : revisions) { + hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, *hwInfo); + streamProperties.frontEndState.setProperties(kernelExecutionType, 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); + + 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()); + EXPECT_FALSE(cfeState->getComputeOverdispatchDisable()); + } +} + +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; + auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); + + PipelineSelectArgs pipelineArgs; + pipelineArgs.specialPipelineSelectMode = true; + + struct { + unsigned short revId; + bool expectedValue; + } testInputs[] = { + {0x0, true}, + {0x1, true}, + {0x3, true}, + {0x5, false}, + {0x6, false}, + {0x7, false}, + }; + for (auto &testInput : testInputs) { + LinearStream linearStream(&gfxAllocation); + hwInfo->platform.usRevId = testInput.revId; + PreambleHelper::programPipelineSelect(&linearStream, pipelineArgs, *hwInfo); + parseCommands(linearStream); + + auto itorCmd = find(cmdList.begin(), cmdList.end()); + ASSERT_NE(itorCmd, cmdList.end()); + + auto cmd = genCmdCast(*itorCmd); + EXPECT_EQ(testInput.expectedValue, cmd->getSystolicModeEnable()); + } +} diff --git a/shared/test/common/xe_hpc_core/unit_test_helper_xe_hpc_core.cpp b/shared/test/common/xe_hpc_core/unit_test_helper_xe_hpc_core.cpp index 6c74daca50..90deab05f6 100644 --- a/shared/test/common/xe_hpc_core/unit_test_helper_xe_hpc_core.cpp +++ b/shared/test/common/xe_hpc_core/unit_test_helper_xe_hpc_core.cpp @@ -5,10 +5,12 @@ * */ +#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/xe_hpc_core/hw_info.h" #include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/helpers/unit_test_helper.inl" #include "shared/test/common/helpers/unit_test_helper_xehp_and_later.inl" + using Family = NEO::XE_HPC_COREFamily; namespace NEO { @@ -54,7 +56,8 @@ bool UnitTestHelper::isAdditionalSynchronizationRequired() { template <> bool UnitTestHelper::isAdditionalMiSemaphoreWaitRequired(const HardwareInfo &hwInfo) { - auto programGlobalFenceAsMiMemFenceCommandInCommandStream = !Family::isXlA0(hwInfo); + const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); + auto programGlobalFenceAsMiMemFenceCommandInCommandStream = hwInfoConfig.isGlobalFenceAsMiMemFenceCommandInCommandStreamRequired(hwInfo); if (DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.get() != -1) { programGlobalFenceAsMiMemFenceCommandInCommandStream = !!DebugManager.flags.ProgramGlobalFenceAsMiMemFenceCommandInCommandStream.get(); } diff --git a/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp b/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp index 6827f442b0..b954379d32 100644 --- a/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp +++ b/shared/test/unit_test/xe_hpc_core/test_preamble_xe_hpc_core.cpp @@ -16,68 +16,6 @@ using namespace NEO; using PreambleCfeState = PreambleFixture; -XE_HPC_CORETEST_F(PreambleCfeState, givenXeHpcAndKernelExecutionTypeAndRevisionWhenCallingProgramVFEStateThenCFEStateParamsAreCorrectlySet) { - using CFE_STATE = typename FamilyType::CFE_STATE; - auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - - if (hwInfo->platform.eProductFamily != IGFX_PVC) { - GTEST_SKIP(); - } - - const auto &hwInfoConfig = *NEO::HwInfoConfig::get(hwInfo->platform.eProductFamily); - auto pVfeCmd = PreambleHelper::getSpaceForVfeState(&linearStream, *hwInfo, EngineGroupType::RenderCompute); - StreamProperties streamProperties{}; - std::array, 4> revisions = { - {{REVISION_A0, false}, - {REVISION_A0, true}, - {REVISION_B, false}, - {REVISION_B, true}}}; - - for (const auto &[revision, kernelExecutionType] : revisions) { - hwInfo->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, *hwInfo); - streamProperties.frontEndState.setProperties(kernelExecutionType, 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); - - auto expectedValue = (HwInfoConfig::get(hwInfo->platform.eProductFamily)->getSteppingFromHwRevId(*hwInfo) >= REVISION_B) && - (!XE_HPC_CORE::isXtTemporary(*defaultHwInfo)) && - kernelExecutionType; - EXPECT_EQ(expectedValue, cfeState->getComputeDispatchAllWalkerEnable()); - EXPECT_EQ(expectedValue, cfeState->getSingleSliceDispatchCcsMode()); - EXPECT_FALSE(cfeState->getComputeOverdispatchDisable()); - } -} - -XE_HPC_CORETEST_F(PreambleCfeState, givenPvcXtTemporaryAndKernelExecutionTypeConcurrentAndRevisionBWhenCallingProgramVFEStateThenAllWalkerIsDisabled) { - using CFE_STATE = typename FamilyType::CFE_STATE; - - auto hwInfo = *defaultHwInfo; - hwInfo.platform.usDeviceID = 0x0BE5; - if (hwInfo.platform.eProductFamily != IGFX_PVC) { - GTEST_SKIP(); - } - - 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()); -} - XE_HPC_CORETEST_F(PreambleCfeState, givenXeHpcCoreAndSetDebugFlagWhenPreambleCfeStateIsProgrammedThenCFEStateParamsHaveSetValue) { using CFE_STATE = typename FamilyType::CFE_STATE; DebugManagerStateRestore dbgRestore; @@ -155,40 +93,3 @@ XE_HPC_CORETEST_F(PreambleCfeState, givenSetDebugFlagWhenPreambleCfeStateIsProgr EXPECT_EQ(expectedValue2, cfeState->getNumberOfWalkers()); EXPECT_EQ(expectedValue2, cfeState->getMaximumNumberOfThreads()); } - -using PreamblePipelineSelectState = PreambleFixture; -XE_HPC_CORETEST_F(PreamblePipelineSelectState, givenRevisionBAndAboveWhenCallingProgramPipelineSelectThenSystolicModeDisabled) { - using PIPELINE_SELECT = typename FamilyType::PIPELINE_SELECT; - auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo(); - - if (hwInfo->platform.eProductFamily != IGFX_PVC) { - GTEST_SKIP(); - } - - PipelineSelectArgs pipelineArgs; - pipelineArgs.specialPipelineSelectMode = true; - - struct { - unsigned short revId; - bool expectedValue; - } testInputs[] = { - {0x0, true}, - {0x1, true}, - {0x3, true}, - {0x5, false}, - {0x6, false}, - {0x7, false}, - }; - for (auto &testInput : testInputs) { - LinearStream linearStream(&gfxAllocation); - hwInfo->platform.usRevId = testInput.revId; - PreambleHelper::programPipelineSelect(&linearStream, pipelineArgs, *hwInfo); - parseCommands(linearStream); - - auto itorCmd = find(cmdList.begin(), cmdList.end()); - ASSERT_NE(itorCmd, cmdList.end()); - - auto cmd = genCmdCast(*itorCmd); - EXPECT_EQ(testInput.expectedValue, cmd->getSystolicModeEnable()); - } -}