feature: Add support for MTL

Related-To: NEO-7111

Signed-off-by: Naklicki, Mateusz <mateusz.naklicki@intel.com>
This commit is contained in:
Naklicki, Mateusz
2022-12-01 12:50:08 +00:00
committed by Compute-Runtime-Automation
parent ceda3f65c2
commit a7d8a93b4e
69 changed files with 2075 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/ail/ail_configuration_base.inl"
#include <map>
#include <vector>
namespace NEO {
static EnableAIL<IGFX_METEORLAKE> enableAILMTL;
std::map<std::string_view, std::vector<AILEnumeration>> applicationMapMTL = {};
template class AILConfigurationHw<IGFX_METEORLAKE>;
} // namespace NEO

View File

@@ -108,6 +108,7 @@ struct CmdServicesMemTraceVersion {
Adln = 34,
Dg2 = 36,
Pvc = 39,
Mtl = 42
};
};
struct RecordingMethodValues {

View File

@@ -19,6 +19,13 @@ DEVICE(0x0BDB, PvcHwConfig)
#endif
#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_MTL
DEVICE(0x7D40, MtlHwConfig)
DEVICE(0x7D55, MtlHwConfig)
DEVICE(0x7DD5, MtlHwConfig)
DEVICE(0x7D45, MtlHwConfig)
DEVICE(0x7D60, MtlHwConfig)
#endif
#ifdef SUPPORT_DG2
DEVICE(0x4F80, Dg2HwConfig)
DEVICE(0x4F81, Dg2HwConfig)

View File

@@ -18,6 +18,12 @@ DEVICE_CONFIG(PVC_XT_C0, PvcHwConfig, pvcXtDeviceIds, XE_FAMILY, XE_HPC_RELEASE)
#endif
#ifdef SUPPORT_XE_HPG_CORE
#ifdef SUPPORT_MTL
DEVICE_CONFIG(XE_LPG_MD_A0, MtlHwConfig, mtlDeviceIds, XE_FAMILY, XE_LPG_RELEASE)
DEVICE_CONFIG(XE_LPG_MD_B0, MtlHwConfig, mtlDeviceIds, XE_FAMILY, XE_LPG_RELEASE)
DEVICE_CONFIG(XE_LPG_LG_A0, MtlHwConfig, mtlDeviceIds, XE_FAMILY, XE_LPG_RELEASE)
DEVICE_CONFIG(XE_LPG_LG_B0, MtlHwConfig, mtlDeviceIds, XE_FAMILY, XE_LPG_RELEASE)
#endif
#ifdef SUPPORT_DG2
DEVICE_CONFIG(DG2_G10_A0, Dg2HwConfig, dg2G10DeviceIds, XE_FAMILY, XE_HPG_RELEASE)
DEVICE_CONFIG(DG2_G10_A1, Dg2HwConfig, dg2G10DeviceIds, XE_FAMILY, XE_HPG_RELEASE)

View File

@@ -162,6 +162,12 @@ if(SUPPORT_DG2_AND_LATER)
)
endif()
if(SUPPORT_MTL_AND_LATER)
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/compiler_aot_config_mtl_and_later.inl
)
endif()
if(SUPPORT_PVC_AND_LATER)
list(APPEND NEO_CORE_HELPERS
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_pvc_and_later.inl

View File

@@ -0,0 +1,16 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/hw_info.h"
namespace NEO {
template <PRODUCT_FAMILY gfxProduct>
void CompilerProductHelperHw<gfxProduct>::setProductConfigForHwInfo(HardwareInfo &hwInfo, HardwareIpVersion config) const {
hwInfo.ipVersion = config;
}
} // namespace NEO

View File

@@ -11,6 +11,9 @@
#ifdef SUPPORT_DG2
#include "device_ids_configs_dg2.h"
#endif
#ifdef SUPPORT_MTL
#include "shared/source/xe_hpg_core/mtl/device_ids_configs_mtl.h"
#endif
#endif
#if SUPPORT_XE_HPC_CORE

View File

@@ -99,6 +99,10 @@ if(SUPPORT_XEHP_AND_LATER)
)
endif()
if(SUPPORT_MTL_AND_LATER)
list(APPEND NEO_CORE_OS_INTERFACE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_mtl_and_later.inl)
endif()
if(SUPPORT_PVC_AND_LATER)
list(APPEND NEO_CORE_OS_INTERFACE_LINUX ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_xe_hpc_and_later.inl)
endif()

View File

@@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
bool ProductHelperHw<gfxProduct>::isPlatformQuerySupported() const {
return true;
}

View File

@@ -0,0 +1,6 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/

View File

@@ -0,0 +1,16 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
const HardwareInfo MTL::hwInfo = MtlHwConfig::hwInfo;
const uint64_t MTL::defaultHardwareInfoConfig = 0;
void setupMTLHardwareInfoImpl(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, uint64_t hwInfoConfig) {
MTL::setupHardwareInfoBase(hwInfo, setupFeatureTableAndWorkaroundTable);
MtlHwConfig::setupHardwareInfo(hwInfo, setupFeatureTableAndWorkaroundTable);
}
void (*MTL::setupHardwareInfo)(HardwareInfo *, bool, const uint64_t) = setupMTLHardwareInfoImpl;

View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/compiler_aot_config_mtl_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/helpers/compiler_hw_info_config_base.inl"
#include "shared/source/helpers/compiler_hw_info_config_bdw_and_later.inl"
#include "shared/source/helpers/compiler_hw_info_config_before_xe_hpc.inl"
#include "hw_info_mtl.h"
namespace NEO {
static EnableCompilerProductHelper<IGFX_METEORLAKE> enableCompilerProductHelperMTL;
} // namespace NEO

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
namespace NEO {
static EnableProductProductHelper<IGFX_METEORLAKE> enableMTL;
} // namespace NEO

View File

@@ -26,4 +26,10 @@ template struct L1CachePolicyHelper<IGFX_DG2>;
static EnableGfxProductHw<IGFX_DG2> enableGfxProductHwDG2;
#endif
#ifdef SUPPORT_MTL
template struct L1CachePolicyHelper<IGFX_METEORLAKE>;
static EnableGfxProductHw<IGFX_METEORLAKE> enableGfxProductHwMTL;
#endif
} // namespace NEO

View File

@@ -11,3 +11,7 @@
#ifdef SUPPORT_DG2
#include "hw_cmds_dg2.h"
#endif
#ifdef SUPPORT_MTL
#include "hw_cmds_mtl.h"
#endif

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h"
namespace NEO {
struct MTL : public XeHpgCoreFamily {
static const PLATFORM platform;
static const HardwareInfo hwInfo;
static const uint64_t defaultHardwareInfoConfig;
static FeatureTable featureTable;
static WorkaroundTable workaroundTable;
// Initial non-zero values for unit tests
static const uint32_t threadsPerEu = 8;
static const uint32_t maxEuPerSubslice = 16;
static const uint32_t maxSlicesSupported = 8;
static const uint32_t maxSubslicesSupported = 32;
static const uint32_t maxDualSubslicesSupported = 32;
static const RuntimeCapabilityTable capabilityTable;
static void (*setupHardwareInfo)(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable, uint64_t hwInfoConfig);
static void setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo);
static void setupHardwareInfoBase(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable);
static void setupHardwareInfoMultiTileBase(HardwareInfo *hwInfo);
static bool isLpg(const HardwareInfo &hwInfo) {
return ((hwInfo.ipVersion.architecture == 12) &&
(hwInfo.ipVersion.release <= 71));
}
};
class MtlHwConfig : public MTL {
public:
static void setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable);
static const HardwareInfo hwInfo;
private:
static GT_SYSTEM_INFO gtSystemInfo;
};
#include "hw_cmds_mtl.inl"
} // namespace NEO

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -10,3 +10,7 @@
#ifdef SUPPORT_DG2
#include "hw_info_dg2.h"
#endif
#ifdef SUPPORT_MTL
#include "hw_info_mtl.h"
#endif

View File

@@ -0,0 +1,190 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/aub_mem_dump/definitions/aub_services.h"
#include "shared/source/command_stream/preemption_mode.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "aubstream/engine_node.h"
namespace NEO {
const char *HwMapper<IGFX_METEORLAKE>::abbreviation = "mtl";
const PLATFORM MTL::platform = {
IGFX_METEORLAKE,
PCH_UNKNOWN,
IGFX_XE_HPG_CORE,
IGFX_XE_HPG_CORE,
PLATFORM_NONE, // default init
0, // usDeviceID
0, // usRevId. 0 sets the stepping to A0
0, // usDeviceID_PCH
0, // usRevId_PCH
GTTYPE_UNDEFINED};
const RuntimeCapabilityTable MTL::capabilityTable{
EngineDirectSubmissionInitVec{
{aub_stream::ENGINE_RCS, {true, true}},
{aub_stream::ENGINE_CCS, {true, true}}}, // directSubmissionEngines
{0, 0, 0, 0, false, false, false, false}, // kmdNotifyProperties
MemoryConstants::max48BitAddress, // gpuAddressSpace
0, // sharedSystemMemCapabilities
83.333, // defaultProfilingTimerResolution
MemoryConstants::pageSize, // requiredPreemptionSurfaceSize
"mtl", // platformType
"", // deviceName
PreemptionMode::ThreadGroup, // defaultPreemptionMode
aub_stream::ENGINE_CCS, // defaultEngineType
0, // maxRenderFrequency
30, // clVersionSupport
CmdServicesMemTraceVersion::DeviceValues::Mtl, // aubDeviceId
0, // extraQuantityThreadsPerEU
64, // slmSize
sizeof(MTL::GRF), // grfSize
36u, // timestampValidBits
32u, // kernelTimestampValidBits
false, // blitterOperationsSupported
true, // ftrSupportsInteger64BitAtomics
true, // ftrSupportsFP64
true, // ftrSupports64BitMath
true, // ftrSvm
false, // ftrSupportsCoherency
false, // ftrSupportsVmeAvcTextureSampler
false, // ftrSupportsVmeAvcPreemption
false, // ftrRenderCompressedBuffers
false, // ftrRenderCompressedImages
true, // ftr64KBpages
true, // instrumentationEnabled
true, // sourceLevelDebuggerSupported
false, // supportsVme
true, // supportCacheFlushAfterWalker
true, // supportsImages
false, // supportsDeviceEnqueue
false, // supportsPipes
true, // supportsOcl21Features
false, // supportsOnDemandPageFaults
false, // supportsIndependentForwardProgress
false, // hostPtrTrackingEnabled
true, // levelZeroSupported
true, // isIntegratedDevice
true, // supportsMediaBlock
false, // p2pAccessSupported
false, // p2pAtomicAccessSupported
true // fusedEuEnabled
};
WorkaroundTable MTL::workaroundTable = {};
FeatureTable MTL::featureTable = {};
void MTL::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) {
FeatureTable *featureTable = &hwInfo->featureTable;
WorkaroundTable *workaroundTable = &hwInfo->workaroundTable;
featureTable->flags.ftrL3IACoherency = true;
featureTable->flags.ftrPPGTT = true;
featureTable->flags.ftrSVM = true;
featureTable->flags.ftrIA32eGfxPTEs = true;
featureTable->flags.ftrStandardMipTailFormat = true;
featureTable->flags.ftrTranslationTable = true;
featureTable->flags.ftrUserModeTranslationTable = true;
featureTable->flags.ftrTileMappedResource = true;
featureTable->flags.ftrFbc = true;
featureTable->flags.ftrAstcHdr2D = true;
featureTable->flags.ftrAstcLdr2D = true;
featureTable->flags.ftrGpGpuMidBatchPreempt = true;
featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = true;
featureTable->flags.ftrTileY = false;
featureTable->flags.ftrLinearCCS = true;
featureTable->flags.ftrE2ECompression = false;
featureTable->flags.ftrCCSNode = true;
featureTable->flags.ftrCCSRing = true;
workaroundTable->flags.wa4kAlignUVOffsetNV12LinearSurface = true;
workaroundTable->flags.waUntypedBufferCompression = true;
};
void MTL::setupHardwareInfoBase(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) {
GT_SYSTEM_INFO *gtSysInfo = &hwInfo->gtSystemInfo;
gtSysInfo->ThreadCount = gtSysInfo->EUCount * MTL::threadsPerEu;
gtSysInfo->TotalVsThreads = 336;
gtSysInfo->TotalHsThreads = 336;
gtSysInfo->TotalDsThreads = 336;
gtSysInfo->TotalGsThreads = 336;
gtSysInfo->TotalPsThreadsWindowerRange = 64;
gtSysInfo->CsrSizeInMb = 8;
gtSysInfo->MaxEuPerSubSlice = MTL::maxEuPerSubslice;
gtSysInfo->MaxSlicesSupported = MTL::maxSlicesSupported;
gtSysInfo->MaxSubSlicesSupported = MTL::maxSubslicesSupported;
gtSysInfo->MaxDualSubSlicesSupported = MTL::maxDualSubslicesSupported;
gtSysInfo->IsL3HashModeEnabled = false;
gtSysInfo->IsDynamicallyPopulated = false;
gtSysInfo->CCSInfo.IsValid = true;
gtSysInfo->CCSInfo.NumberOfCCSEnabled = 1;
gtSysInfo->CCSInfo.Instances.CCSEnableMask = 0b1;
if (setupFeatureTableAndWorkaroundTable) {
setupFeatureAndWorkaroundTable(hwInfo);
}
}
void MTL::setupHardwareInfoMultiTileBase(HardwareInfo *hwInfo) {
GT_SYSTEM_INFO *gtSysInfo = &hwInfo->gtSystemInfo;
gtSysInfo->MultiTileArchInfo.IsValid = false;
}
const HardwareInfo MtlHwConfig::hwInfo = {
&MTL::platform,
&MTL::featureTable,
&MTL::workaroundTable,
&MtlHwConfig::gtSystemInfo,
MTL::capabilityTable,
};
GT_SYSTEM_INFO MtlHwConfig::gtSystemInfo = {0};
void MtlHwConfig::setupHardwareInfo(HardwareInfo *hwInfo, bool setupFeatureTableAndWorkaroundTable) {
GT_SYSTEM_INFO *gtSysInfo = &hwInfo->gtSystemInfo;
gtSysInfo->CsrSizeInMb = 8;
gtSysInfo->IsL3HashModeEnabled = false;
gtSysInfo->IsDynamicallyPopulated = false;
// non-zero values for unit tests
if (gtSysInfo->SliceCount == 0) {
gtSysInfo->SliceCount = 2;
gtSysInfo->SubSliceCount = 8;
gtSysInfo->DualSubSliceCount = gtSysInfo->SubSliceCount;
gtSysInfo->EUCount = 40;
gtSysInfo->MaxEuPerSubSlice = gtSysInfo->EUCount / gtSysInfo->SubSliceCount;
gtSysInfo->MaxSlicesSupported = gtSysInfo->SliceCount;
gtSysInfo->MaxSubSlicesSupported = gtSysInfo->SubSliceCount;
gtSysInfo->L3CacheSizeInKb = 1;
gtSysInfo->L3BankCount = 1;
gtSysInfo->CCSInfo.IsValid = true;
gtSysInfo->CCSInfo.NumberOfCCSEnabled = 1;
hwInfo->featureTable.ftrBcsInfo = 1;
gtSysInfo->IsDynamicallyPopulated = true;
for (uint32_t slice = 0; slice < gtSysInfo->SliceCount; slice++) {
gtSysInfo->SliceInfo[slice].Enabled = true;
}
}
if (setupFeatureTableAndWorkaroundTable) {
MTL::setupFeatureAndWorkaroundTable(hwInfo);
}
};
#include "hw_info_setup_mtl.inl"
} // namespace NEO

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/xe_hpg_core/hw_info_xe_hpg_core.h"
namespace NEO {
struct MTL;
template <>
struct HwMapper<IGFX_METEORLAKE> {
enum { gfxFamily = IGFX_XE_HPG_CORE };
static const char *abbreviation;
typedef GfxFamilyMapper<static_cast<GFXCORE_FAMILY>(gfxFamily)>::GfxFamily GfxFamily;
typedef MTL GfxProduct;
};
} // namespace NEO

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_info.h"
#include "shared/source/kernel/kernel_properties.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/hw_info_config.inl"
#include "shared/source/os_interface/hw_info_config_dg2_and_later.inl"
#include "shared/source/os_interface/hw_info_config_xehp_and_later.inl"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "platforms.h"
constexpr static auto gfxProduct = IGFX_METEORLAKE;
namespace NEO {
#include "shared/source/os_interface/linux/hw_info_config_mtl_and_later.inl"
} // namespace NEO
#include "shared/source/xe_hpg_core/mtl/os_agnostic_hw_info_config_mtl.inl"
#include "shared/source/xe_hpg_core/os_agnostic_hw_info_config_xe_hpg_core.inl"
namespace NEO {
template <>
int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const {
enableCompression(hwInfo);
enableBlitterOperationsSupport(hwInfo);
auto &kmdNotifyProperties = hwInfo->capabilityTable.kmdNotifyProperties;
kmdNotifyProperties.enableKmdNotify = true;
kmdNotifyProperties.delayKmdNotifyMicroseconds = 150;
kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission = true;
kmdNotifyProperties.delayQuickKmdSleepForDirectSubmissionMicroseconds = 20;
return 0;
}
template <>
bool ProductHelperHw<gfxProduct>::isBlitterForImagesSupported() const {
return true;
}
template <>
bool ProductHelperHw<gfxProduct>::isVmBindPatIndexProgrammingSupported() const {
return true;
}
template class ProductHelperHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,19 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <vector>
namespace NEO {
inline const std::vector<unsigned short> mtlDeviceIds{
0x7D40,
0x7D55,
0x7DD5,
0x7D45,
0x7D60};
} // namespace NEO

View File

@@ -0,0 +1,116 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "aubstream/product_family.h"
namespace NEO {
template <>
void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
using SAMPLER_STATE = typename XeHpgCoreFamily::SAMPLER_STATE;
auto samplerState = reinterpret_cast<SAMPLER_STATE *>(sampler);
if (DebugManager.flags.ForceSamplerLowFilteringPrecision.get()) {
samplerState->setLowQualityFilter(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE);
}
}
template <>
uint64_t ProductHelperHw<gfxProduct>::getHostMemCapabilitiesValue() const {
return (UNIFIED_SHARED_MEMORY_ACCESS | UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS);
}
template <>
bool ProductHelperHw<gfxProduct>::isPageTableManagerSupported(const HardwareInfo &hwInfo) const {
return hwInfo.capabilityTable.ftrRenderCompressedBuffers || hwInfo.capabilityTable.ftrRenderCompressedImages;
}
template <>
uint32_t ProductHelperHw<gfxProduct>::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const {
switch (stepping) {
case REVISION_A0:
return 0x0;
case REVISION_B:
return 0x1;
}
return CommonConstants::invalidStepping;
}
template <>
AOT::PRODUCT_CONFIG ProductHelperHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
switch (hwInfo.ipVersion.release) {
case 70:
switch (hwInfo.ipVersion.revision) {
case 0:
return AOT::XE_LPG_MD_A0;
case 4:
return AOT::XE_LPG_MD_B0;
default:
return AOT::UNKNOWN_ISA;
}
case 71:
switch (hwInfo.ipVersion.revision) {
case 0:
return AOT::XE_LPG_LG_A0;
case 4:
return AOT::XE_LPG_LG_B0;
default:
return AOT::UNKNOWN_ISA;
}
default:
return AOT::UNKNOWN_ISA;
}
}
template <>
uint32_t ProductHelperHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (hwInfo.platform.usRevId) {
case 0x0:
return REVISION_A0;
case 0x1:
return REVISION_B;
}
return CommonConstants::invalidStepping;
}
template <>
std::pair<bool, bool> ProductHelperHw<gfxProduct>::isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs) const {
auto isBasicWARequired = GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo, *this);
auto isExtendedWARequired = false;
return {isBasicWARequired, isExtendedWARequired};
}
template <>
bool ProductHelperHw<gfxProduct>::programAllStateComputeCommandFields() const {
return true;
}
template <>
bool ProductHelperHw<gfxProduct>::isBFloat16ConversionSupported(const HardwareInfo &hwInfo) const {
return (MTL::isLpg(hwInfo) == false);
}
template <>
bool ProductHelperHw<gfxProduct>::isMatrixMultiplyAccumulateSupported(const HardwareInfo &hwInfo) const {
return (MTL::isLpg(hwInfo) == false);
}
template <>
bool ProductHelperHw<gfxProduct>::isAdjustWalkOrderAvailable(const HardwareInfo &hwInfo) const {
return (MTL::isLpg(hwInfo) == false);
}
template <>
bool ProductHelperHw<gfxProduct>::isEvictionIfNecessaryFlagSupported() const {
return true;
}
template <>
std::optional<aub_stream::ProductFamily> ProductHelperHw<gfxProduct>::getAubStreamProductFamily() const {
return aub_stream::ProductFamily::Mtl;
};
} // namespace NEO

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/kernel/kernel_properties.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/hw_info_config.inl"
#include "shared/source/os_interface/hw_info_config_dg2_and_later.inl"
#include "shared/source/os_interface/hw_info_config_xehp_and_later.inl"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "platforms.h"
constexpr static auto gfxProduct = IGFX_METEORLAKE;
#include "shared/source/xe_hpg_core/mtl/os_agnostic_hw_info_config_mtl.inl"
#include "shared/source/xe_hpg_core/os_agnostic_hw_info_config_xe_hpg_core.inl"
template class NEO::ProductHelperHw<gfxProduct>;

View File

@@ -1,11 +1,14 @@
/*
* Copyright (C) 2021 Intel Corporation
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#ifdef TESTS_MTL
#include "shared/test/common/xe_hpg_core/mtl/test_traits_mtl.h"
#endif
#ifdef TESTS_DG2
#include "shared/test/common/xe_hpg_core/dg2/test_traits_dg2.h"
#endif

View File

@@ -63,12 +63,14 @@ using IsRKL = IsProduct<IGFX_ROCKETLAKE>;
using IsXEHP = IsProduct<IGFX_XE_HP_SDV>;
using IsNotXEHP = IsNotWithinProducts<IGFX_XE_HP_SDV, IGFX_XE_HP_SDV>;
using IsMTL = IsProduct<IGFX_METEORLAKE>;
using IsDG2 = IsProduct<IGFX_DG2>;
using IsPVC = IsProduct<IGFX_PVC>;
using IsAtLeastSkl = IsAtLeastProduct<IGFX_SKYLAKE>;
using IsAtLeastMtl = IsAtLeastProduct<IGFX_METEORLAKE>;
using IsAtMostDg2 = IsAtMostProduct<IGFX_DG2>;
using IsNotPVC = IsNotWithinProducts<IGFX_PVC, IGFX_PVC>;

View File

@@ -206,6 +206,17 @@
IGFX_XE_HP_SDV)
#endif
#ifdef TESTS_MTL
#define MTLTEST_F(test_fixture, test_name) \
FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \
::testing::internal::GetTypeId<test_fixture>(), \
IGFX_XE_HPG_CORE, IGFX_METEORLAKE)
#define MTLTEST_P(test_suite_name, test_name) \
FAMILYTEST_TEST_P(test_suite_name, test_name, \
IGFX_XE_HPG_CORE, \
IGFX_METEORLAKE)
#endif
#ifdef TESTS_DG2
#define DG2TEST_F(test_fixture, test_name) \
FAMILYTEST_TEST_(test_fixture, test_name, test_fixture, \

View File

@@ -0,0 +1,13 @@
#
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_MTL)
target_sources(neo_libult_common PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/product_configs_mtl.h
${CMAKE_CURRENT_SOURCE_DIR}/test_traits_mtl.h
)
endif()

View File

@@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_METEORLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockProductHelperHw<gfxProduct>;
} // namespace NEO

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "platforms.h"
namespace AOT_MTL {
inline constexpr AOT::PRODUCT_CONFIG productConfigs[] = {
AOT::XE_LPG_MD_A0,
AOT::XE_LPG_MD_B0,
AOT::XE_LPG_LG_A0,
AOT::XE_LPG_LG_B0};
}

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/test/common/helpers/test_traits_platforms.h"
template <>
struct TestTraitsPlatforms<IGFX_METEORLAKE> {
static constexpr bool programOnlyChangedFieldsInComputeStateMode = false;
};

View File

@@ -29,6 +29,7 @@ target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/get_info_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hash_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/heap_assigner_shared_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_aot_config_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_default_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_dg2_or_below.cpp

View File

@@ -0,0 +1,67 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/test/unit_test/fixtures/product_config_fixture.h"
using namespace NEO;
HWTEST2_P(ProductConfigHwInfoBadArchTests, givenAotConfigWithIncorrectArchWhenGetProductConfigThenUnknownIsaIsReturned, IsAtLeastMtl) {
HardwareIpVersion aotConfig = {0};
aotConfig.value = productConfig;
hwInfo.ipVersion.architecture = invalidConfig.architecture;
hwInfo.ipVersion.release = aotConfig.release;
hwInfo.ipVersion.revision = aotConfig.revision;
auto ret = productHelper->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(ret, AOT::UNKNOWN_ISA);
}
HWTEST2_P(ProductConfigHwInfoBadRevisionTests, givenAotConfigWithIncorrectRevisionIdWhenGetProductConfigThenUnknownIsaIsReturned, IsAtLeastMtl) {
HardwareIpVersion aotConfig = {0};
aotConfig.value = productConfig;
hwInfo.ipVersion.architecture = aotConfig.architecture;
hwInfo.ipVersion.release = aotConfig.release;
hwInfo.ipVersion.revision = invalidConfig.revision;
auto ret = productHelper->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(ret, AOT::UNKNOWN_ISA);
}
HWTEST2_P(ProductConfigHwInfoTests, givenAotConfigWhenSetHwInfoGmdIdThenCorrectValueIsSet, IsAtLeastMtl) {
HardwareIpVersion aotConfig = {0};
aotConfig.value = productConfig;
CompilerProductHelper::get(productFamily)->setProductConfigForHwInfo(hwInfo, aotConfig);
EXPECT_EQ(hwInfo.ipVersion.architecture, aotConfig.architecture);
EXPECT_EQ(hwInfo.ipVersion.release, aotConfig.release);
EXPECT_EQ(hwInfo.ipVersion.revision, aotConfig.revision);
}
HWTEST2_P(ProductConfigHwInfoTests, givenAotConfigWithIncorrectReleaseWhenGetProductConfigThenUnknownIsaIsReturned, IsAtLeastMtl) {
HardwareIpVersion aotConfig = {0};
aotConfig.value = productConfig;
hwInfo.ipVersion.architecture = aotConfig.architecture;
hwInfo.ipVersion.release = invalidConfig.release;
hwInfo.ipVersion.revision = aotConfig.revision;
auto ret = productHelper->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(ret, AOT::UNKNOWN_ISA);
}
HWTEST2_P(ProductConfigHwInfoTests, givenUnknownAotConfigWhenGetProductConfigThenUnknownIsaIsReturned, IsAtLeastMtl) {
hwInfo.ipVersion = {};
auto ret = productHelper->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(ret, AOT::UNKNOWN_ISA);
}
HWTEST2_P(ProductConfigHwInfoTests, givenAotConfigWhenGetProductConfigThenCorrectValueIsReturned, IsAtLeastMtl) {
HardwareIpVersion aotConfig = {0};
aotConfig.value = productConfig;
hwInfo.ipVersion.architecture = aotConfig.architecture;
hwInfo.ipVersion.release = aotConfig.release;
hwInfo.ipVersion.revision = aotConfig.revision;
auto ret = productHelper->getProductConfigFromHwInfo(hwInfo);
EXPECT_EQ(ret, productConfig);
}

View File

@@ -349,6 +349,12 @@ TEST_F(MockProductHelperTestLinux, givenFailingGttSizeIoctlWhenInitializingHwInf
EXPECT_EQ(pInHwInfo.capabilityTable.gpuAddressSpace, outHwInfo.capabilityTable.gpuAddressSpace);
}
HWTEST2_F(MockProductHelperTestLinux, givenPlatformWithPlatformQuerySupportedWhenItIsCalledThenReturnTrue, IsAtLeastMtl) {
HardwareInfo hardwareInfo = *defaultHwInfo;
auto productHelper = ProductHelper::get(hardwareInfo.platform.eProductFamily);
EXPECT_TRUE(productHelper->isPlatformQuerySupported());
}
using HwConfigLinux = ::testing::Test;
HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwInfoThenMaxSlicesSupportedSetToAvailableCountInGtSystemInfo, MatchAny) {

View File

@@ -0,0 +1,28 @@
#
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_MTL)
set(NEO_CORE_tests_xe_hpg_core_mtl_excludes ${CMAKE_CURRENT_SOURCE_DIR}/excludes_xe_hpg_core_mtl.cpp)
set_property(GLOBAL APPEND PROPERTY NEO_CORE_tests_excludes ${NEO_CORE_tests_xe_hpg_core_mtl_excludes})
target_sources(neo_shared_tests PRIVATE
${NEO_CORE_tests_xe_hpg_core_mtl_excludes}
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/excludes_xe_hpg_core_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_aot_config_tests_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_tests_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_dispatch_kernel_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_mtl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_image_surface_state_mtl.cpp
)
add_subdirectories()
endif()

View File

@@ -0,0 +1,177 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_allocation_properties.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_os_context.h"
#include "shared/test/unit_test/command_stream/compute_mode_tests.h"
#include "test_traits_common.h"
using namespace NEO;
using MtlComputeModeRequirements = ComputeModeRequirements;
MTLTEST_F(MtlComputeModeRequirements, givenFlushWithoutSharedHandlesWhenPreviouslyUsedThenPcAndSCMAreNotProgrammed) {
setUpImpl<FamilyType>();
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto graphicAlloc = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
IndirectHeap stream(graphicAlloc);
makeResidentSharedAlloc();
csr->flushTask(stream, 0, &stream, &stream, &stream, 0, flags, *device);
EXPECT_TRUE(getCsrHw<FamilyType>()->getCsrRequestFlags()->hasSharedHandles);
auto startOffset = getCsrHw<FamilyType>()->commandStream.getUsed();
csr->flushTask(stream, 0, &stream, &stream, &stream, 0, flags, *device);
EXPECT_TRUE(getCsrHw<FamilyType>()->getCsrRequestFlags()->hasSharedHandles);
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(getCsrHw<FamilyType>()->commandStream, startOffset);
EXPECT_EQ(0u, hwParser.cmdList.size());
csr->getMemoryManager()->freeGraphicsMemory(graphicAlloc);
}
MTLTEST_F(MtlComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeChangeIsRequiredThenCorrectCommandsAreAdded) {
setUpImpl<FamilyType>();
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
char buff[1024]{};
LinearStream stream(buff, 1024);
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
auto expectedBitsMask = FamilyType::stateComputeModeLargeGrfModeMask;
expectedScmCmd.setLargeGrfMode(true);
overrideComputeModeRequest<FamilyType>(false, false, false, true, 256u);
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
EXPECT_EQ(cmdsSize, stream.getUsed());
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
EXPECT_TRUE(isValueSet(scmCmd->getMaskBits(), expectedBitsMask));
expectedScmCmd.setMaskBits(scmCmd->getMaskBits());
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
auto startOffset = stream.getUsed();
overrideComputeModeRequest<FamilyType>(false, false, false, true, 128u);
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
EXPECT_EQ(cmdsSize * 2, stream.getUsed());
expectedScmCmd = FamilyType::cmdInitStateComputeMode;
expectedScmCmd.setLargeGrfMode(false);
scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL) + startOffset));
EXPECT_TRUE(isValueSet(scmCmd->getMaskBits(), expectedBitsMask));
expectedScmCmd.setMaskBits(scmCmd->getMaskBits());
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
}
MTLTEST_F(MtlComputeModeRequirements, GivenSingleCCSEnabledSetupThenCorrectCommandsAreAdded) {
HardwareInfo hwInfo = *defaultHwInfo;
hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 1;
setUpImpl<FamilyType>(&hwInfo);
MockOsContext ccsOsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::Regular}));
getCsrHw<FamilyType>()->setupContext(ccsOsContext);
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using FORCE_NON_COHERENT = typename STATE_COMPUTE_MODE::FORCE_NON_COHERENT;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
char buff[1024] = {0};
LinearStream stream(buff, 1024);
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
overrideComputeModeRequest<FamilyType>(true, false, false, false);
auto retSize = getCsrHw<FamilyType>()->getCmdSizeForComputeMode();
EXPECT_EQ(cmdsSize, retSize);
getCsrHw<FamilyType>()->programComputeMode(stream, flags, hwInfo);
EXPECT_EQ(cmdsSize, stream.getUsed());
auto startOffset = getCsrHw<FamilyType>()->commandStream.getUsed();
HardwareParse hwParser;
hwParser.parseCommands<FamilyType>(stream, startOffset);
auto pipeControlIterator = find<PIPE_CONTROL *>(hwParser.cmdList.begin(), hwParser.cmdList.end());
auto pipeControlCmd = genCmdCast<PIPE_CONTROL *>(*pipeControlIterator);
EXPECT_TRUE(UnitTestHelper<FamilyType>::getPipeControlHdcPipelineFlush(*pipeControlCmd));
EXPECT_TRUE(pipeControlCmd->getUnTypedDataPortCacheFlush());
EXPECT_FALSE(pipeControlCmd->getAmfsFlushEnable());
EXPECT_FALSE(pipeControlCmd->getInstructionCacheInvalidateEnable());
EXPECT_FALSE(pipeControlCmd->getTextureCacheInvalidationEnable());
EXPECT_FALSE(pipeControlCmd->getConstantCacheInvalidationEnable());
EXPECT_FALSE(pipeControlCmd->getStateCacheInvalidationEnable());
auto stateComputeModeCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
expectedScmCmd.setMaskBits(stateComputeModeCmd->getMaskBits());
EXPECT_TRUE(memcmp(&expectedScmCmd, stateComputeModeCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
}
MTLTEST_F(MtlComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsLowerThan128ThenSmallGRFModeIsProgrammed) {
setUpImpl<FamilyType>();
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
char buff[1024]{};
LinearStream stream(buff, 1024);
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
expectedScmCmd.setLargeGrfMode(false);
auto expectedBitsMask = FamilyType::stateComputeModeLargeGrfModeMask;
overrideComputeModeRequest<FamilyType>(false, false, false, true, 127u);
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
EXPECT_EQ(cmdsSize, stream.getUsed());
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
EXPECT_TRUE(isValueSet(scmCmd->getMaskBits(), expectedBitsMask));
expectedScmCmd.setMaskBits(scmCmd->getMaskBits());
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
}
MTLTEST_F(MtlComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsGreaterThan128ThenLargeGRFModeIsProgrammed) {
setUpImpl<FamilyType>();
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
auto cmdsSize = sizeof(STATE_COMPUTE_MODE) + sizeof(PIPE_CONTROL);
char buff[1024]{};
LinearStream stream(buff, 1024);
auto expectedScmCmd = FamilyType::cmdInitStateComputeMode;
expectedScmCmd.setLargeGrfMode(true);
auto expectedBitsMask = FamilyType::stateComputeModeLargeGrfModeMask;
overrideComputeModeRequest<FamilyType>(false, false, false, true, 256u);
getCsrHw<FamilyType>()->programComputeMode(stream, flags, *defaultHwInfo);
EXPECT_EQ(cmdsSize, stream.getUsed());
auto scmCmd = reinterpret_cast<STATE_COMPUTE_MODE *>(ptrOffset(stream.getCpuBase(), sizeof(PIPE_CONTROL)));
EXPECT_TRUE(isValueSet(scmCmd->getMaskBits(), expectedBitsMask));
expectedScmCmd.setMaskBits(scmCmd->getMaskBits());
EXPECT_TRUE(memcmp(&expectedScmCmd, scmCmd, sizeof(STATE_COMPUTE_MODE)) == 0);
}

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/test_macros/hw_test_base.h"
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfPipeControlPriorToNonPipelinedStateCommandsWARequiredThenFalseIsReturned, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(CommandEncodeStatesImageTest, giveNumSamplersOneWhenDispatchKernelThensamplerStateWasCopied_SamplerSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(CommandEncoderTests, givenRequiredWorkGroupOrderWhenCallAdjustWalkOrderThenWalkerIsNotChanged_IsAtMostXeHpcCore, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyWithoutSharedHandlesWhenComputeModeIsProgrammedThenCorrectCommandsAreAdded_ForceNonCoherentSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyWithSharedHandlesWhenComputeModeIsProgrammedThenCorrectCommandsAreAdded_ForceNonCoherentSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyRequirementWithoutSharedHandlesWhenFlushTaskCalledThenProgramCmdOnlyIfChanged_ForceNonCoherentSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenCoherencyRequirementWithSharedHandlesWhenFlushTaskCalledThenProgramCmdsWhenNeeded_ForceNonCoherentSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenFlushWithoutSharedHandlesWhenPreviouslyUsedThenProgramPcAndSCM_ForceNonCoherentSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenLargeGrfModeChangeIsRequiredThenCorrectCommandsAreAdded_ForceNonCoherentSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsLowerThan128ThenSmallGRFModeIsProgrammed_ForceNonCoherentSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ComputeModeRequirements, givenComputeModeProgrammingWhenRequiredGRFNumberIsGreaterThan128ThenLargeGRFModeIsProgrammed_ForceNonCoherentSupportedMatcher, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenAskedIfPatIndexProgrammingSupportedThenReturnFalse, IGFX_METEORLAKE);
HWTEST_EXCLUDE_PRODUCT(ProductHelperTest, givenProductHelperWhenIsAdjustWalkOrderAvailableCallThenFalseReturn, IGFX_METEORLAKE);

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/xe_hpg_core/mtl/product_configs_mtl.h"
#include "shared/test/unit_test/fixtures/product_config_fixture.h"
namespace NEO {
INSTANTIATE_TEST_CASE_P(ProductConfigHwInfoMtlTests,
ProductConfigHwInfoTests,
::testing::Combine(::testing::ValuesIn(AOT_MTL::productConfigs),
::testing::Values(IGFX_METEORLAKE)));
INSTANTIATE_TEST_CASE_P(ProductConfigHwInfoMtlTests,
ProductConfigHwInfoBadRevisionTests,
::testing::Combine(::testing::Values(AOT::XE_LPG_MD_A0, AOT::XE_LPG_LG_A0),
::testing::Values(IGFX_METEORLAKE)));
} // namespace NEO

View File

@@ -0,0 +1,139 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/helpers/hw_helper_tests.h"
#include "shared/test/common/helpers/variable_backup.h"
#include "shared/test/common/mocks/ult_device_factory.h"
#include "shared/test/common/test_macros/hw_test.h"
using namespace NEO;
using GfxCoreHelperTestMtl = GfxCoreHelperTest;
MTLTEST_F(GfxCoreHelperTestMtl, givenVariousMtlReleasesWhenGetExtensionsIsCalledThenMatrixMultiplyAccumulateExtensionsAreCorrectlyReported) {
auto &gfxCoreHelper = GfxCoreHelper::get(defaultHwInfo->platform.eRenderCoreFamily);
auto hwInfo = *defaultHwInfo;
unsigned int gmdReleases[] = {70, 71, 72, 73};
hwInfo.ipVersion.architecture = 12;
for (auto gmdRelease : gmdReleases) {
hwInfo.ipVersion.release = gmdRelease;
auto extensions = gfxCoreHelper.getExtensions(hwInfo);
EXPECT_EQ(!MTL::isLpg(hwInfo), hasSubstr(extensions, std::string("cl_intel_subgroup_matrix_multiply_accumulate")));
EXPECT_EQ(!MTL::isLpg(hwInfo), hasSubstr(extensions, std::string("cl_intel_subgroup_split_matrix_multiply_accumulate")));
}
}
using ProductHelperTestMtl = Test<DeviceFixture>;
MTLTEST_F(ProductHelperTestMtl, givenMtlWhenCallIsAdjustWalkOrderAvailableThenReturnProperValue) {
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
const auto &productHelper = *ProductHelper::get(defaultHwInfo->platform.eProductFamily);
unsigned int gmdReleases[] = {70, 71, 72, 73};
defaultHwInfo->ipVersion.architecture = 12;
for (auto gmdRelease : gmdReleases) {
defaultHwInfo->ipVersion.release = gmdRelease;
EXPECT_EQ(!MTL::isLpg(*defaultHwInfo), productHelper.isAdjustWalkOrderAvailable(*defaultHwInfo));
}
}
MTLTEST_F(GfxCoreHelperTestMtl, givenAllocationThenCheckResourceCompatibilityReturnsTrue) {
auto &helper = GfxCoreHelper::get(renderCoreFamily);
auto allocation = std::make_unique<GraphicsAllocation>(0, AllocationType::BUFFER, nullptr, 0u, 0, MemoryPool::MemoryNull, 3u, 0llu);
EXPECT_TRUE(helper.checkResourceCompatibility(*allocation));
}
MTLTEST_F(GfxCoreHelperTestMtl, givenisCompressionEnabledAndWaAuxTable64KGranularWhenCheckIs1MbAlignmentSupportedThenReturnCorrectValue) {
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
auto hardwareInfo = *defaultHwInfo;
auto isCompressionEnabled = true;
hardwareInfo.workaroundTable.flags.waAuxTable64KGranular = true;
EXPECT_FALSE(gfxCoreHelper.is1MbAlignmentSupported(hardwareInfo, isCompressionEnabled));
isCompressionEnabled = false;
hardwareInfo.workaroundTable.flags.waAuxTable64KGranular = true;
EXPECT_FALSE(gfxCoreHelper.is1MbAlignmentSupported(hardwareInfo, isCompressionEnabled));
isCompressionEnabled = false;
hardwareInfo.workaroundTable.flags.waAuxTable64KGranular = false;
EXPECT_FALSE(gfxCoreHelper.is1MbAlignmentSupported(hardwareInfo, isCompressionEnabled));
isCompressionEnabled = true;
hardwareInfo.workaroundTable.flags.waAuxTable64KGranular = false;
EXPECT_TRUE(gfxCoreHelper.is1MbAlignmentSupported(hardwareInfo, isCompressionEnabled));
}
MTLTEST_F(GfxCoreHelperTestMtl, givenRevisionEnumAndPlatformFamilyTypeThenProperValueForIsWorkaroundRequiredIsReturned) {
uint32_t steppings[] = {
REVISION_A0,
REVISION_B,
CommonConstants::invalidStepping,
};
auto hardwareInfo = *defaultHwInfo;
const auto &productHelper = getHelper<ProductHelper>();
for (auto stepping : steppings) {
hardwareInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(stepping, hardwareInfo);
if (stepping == REVISION_A0) {
EXPECT_TRUE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, productHelper));
} else {
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hardwareInfo, productHelper));
}
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_B, REVISION_A0, hardwareInfo, productHelper));
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_A1, hardwareInfo, productHelper));
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_C, hardwareInfo, productHelper));
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_D, hardwareInfo, productHelper));
EXPECT_FALSE(GfxCoreHelper::isWorkaroundRequired(REVISION_D, REVISION_A0, hardwareInfo, productHelper));
}
}
MTLTEST_F(ProductHelperTestMtl, givenMultitileConfigWhenConfiguringHwInfoThenEnableBlitter) {
auto &productHelper = getHelper<ProductHelper>();
HardwareInfo hwInfo = *defaultHwInfo;
for (uint32_t tileCount = 0; tileCount <= 4; tileCount++) {
hwInfo.gtSystemInfo.MultiTileArchInfo.TileCount = tileCount;
productHelper.configureHardwareCustom(&hwInfo, nullptr);
EXPECT_TRUE(hwInfo.capabilityTable.blitterOperationsSupported);
}
}
MTLTEST_F(GfxCoreHelperTestMtl, givenMtlWhenSetForceNonCoherentThenNothingChanged) {
using FORCE_NON_COHERENT = typename FamilyType::STATE_COMPUTE_MODE::FORCE_NON_COHERENT;
auto productHelper = ProductHelper::get(productFamily);
auto stateComputeMode = FamilyType::cmdInitStateComputeMode;
auto properties = StateComputeModeProperties{};
properties.isCoherencyRequired.set(true);
productHelper->setForceNonCoherent(&stateComputeMode, properties);
EXPECT_EQ(FORCE_NON_COHERENT::FORCE_NON_COHERENT_FORCE_DISABLED, stateComputeMode.getForceNonCoherent());
EXPECT_EQ(0u, stateComputeMode.getMaskBits());
}
MTLTEST_F(GfxCoreHelperTestMtl, GivenVariousValuesWhenComputeSlmSizeIsCalledThenCorrectValueIsReturned) {
auto hardwareInfo = *defaultHwInfo;
for (auto &testInput : computeSlmValuesXeHPAndLaterTestsInput) {
EXPECT_EQ(testInput.expected, GfxCoreHelperHw<FamilyType>::get().computeSlmValues(hardwareInfo, testInput.slmSize));
}
}

View File

@@ -0,0 +1,174 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/os_interface/hw_info_config_tests.h"
#include "aubstream/product_family.h"
using namespace NEO;
using MtlProductHelper = ProductHelperTest;
MTLTEST_F(MtlProductHelper, givenMtlConfigWhenSetupHardwareInfoBaseThenGtSystemInfoIsCorrect) {
HardwareInfo hwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
MtlHwConfig::setupHardwareInfoBase(&hwInfo, false);
EXPECT_EQ(336u, gtSystemInfo.TotalVsThreads);
EXPECT_EQ(336u, gtSystemInfo.TotalHsThreads);
EXPECT_EQ(336u, gtSystemInfo.TotalDsThreads);
EXPECT_EQ(336u, gtSystemInfo.TotalGsThreads);
EXPECT_EQ(64u, gtSystemInfo.TotalPsThreadsWindowerRange);
EXPECT_EQ(8u, gtSystemInfo.CsrSizeInMb);
EXPECT_FALSE(gtSystemInfo.IsL3HashModeEnabled);
EXPECT_FALSE(gtSystemInfo.IsDynamicallyPopulated);
}
MTLTEST_F(MtlProductHelper, givenMtlConfigWhenSetupHardwareInfoThenGtSystemInfoHasNonZeroValues) {
HardwareInfo hwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
MtlHwConfig::setupHardwareInfo(&hwInfo, false);
EXPECT_GT(gtSystemInfo.SliceCount, 0u);
EXPECT_GT(gtSystemInfo.SubSliceCount, 0u);
EXPECT_GT(gtSystemInfo.DualSubSliceCount, 0u);
EXPECT_GT(gtSystemInfo.EUCount, 0u);
EXPECT_GT(gtSystemInfo.MaxEuPerSubSlice, 0u);
EXPECT_GT(gtSystemInfo.MaxSlicesSupported, 0u);
EXPECT_GT_VAL(gtSystemInfo.L3CacheSizeInKb, 0u);
EXPECT_GT(gtSystemInfo.L3BankCount, 0u);
EXPECT_TRUE(gtSystemInfo.CCSInfo.IsValid);
EXPECT_GT(gtSystemInfo.CCSInfo.NumberOfCCSEnabled, 0u);
}
MTLTEST_F(MtlProductHelper, whenGettingAubstreamProductFamilyThenProperEnumValueIsReturned) {
EXPECT_EQ(aub_stream::ProductFamily::Mtl, productHelper->getAubStreamProductFamily());
}
MTLTEST_F(MtlProductHelper, givenProductHelperWhenGettingEvictIfNecessaryFlagSupportedThenExpectTrue) {
EXPECT_TRUE(productHelper->isEvictionIfNecessaryFlagSupported());
}
MTLTEST_F(MtlProductHelper, givenProductHelperWhenGetCommandsStreamPropertiesSupportThenExpectCorrectValues) {
EXPECT_FALSE(productHelper->getScmPropertyThreadArbitrationPolicySupport());
EXPECT_TRUE(productHelper->getScmPropertyCoherencyRequiredSupport());
EXPECT_TRUE(productHelper->getScmPropertyZPassAsyncComputeThreadLimitSupport());
EXPECT_TRUE(productHelper->getScmPropertyPixelAsyncComputeThreadLimitSupport());
EXPECT_TRUE(productHelper->getScmPropertyLargeGrfModeSupport());
EXPECT_FALSE(productHelper->getScmPropertyDevicePreemptionModeSupport());
EXPECT_FALSE(productHelper->getStateBaseAddressPropertyGlobalAtomicsSupport());
EXPECT_TRUE(productHelper->getStateBaseAddressPropertyStatelessMocsSupport());
EXPECT_TRUE(productHelper->getStateBaseAddressPropertyBindingTablePoolBaseAddressSupport());
EXPECT_TRUE(productHelper->getFrontEndPropertyScratchSizeSupport());
EXPECT_TRUE(productHelper->getFrontEndPropertyPrivateScratchSizeSupport());
EXPECT_TRUE(productHelper->getPreemptionDbgPropertyPreemptionModeSupport());
EXPECT_TRUE(productHelper->getPreemptionDbgPropertyStateSipSupport());
EXPECT_FALSE(productHelper->getPreemptionDbgPropertyCsrSurfaceSupport());
EXPECT_FALSE(productHelper->getFrontEndPropertyComputeDispatchAllWalkerSupport());
EXPECT_TRUE(productHelper->getFrontEndPropertyDisableEuFusionSupport());
EXPECT_TRUE(productHelper->getFrontEndPropertyDisableOverDispatchSupport());
EXPECT_TRUE(productHelper->getFrontEndPropertySingleSliceDispatchCcsModeSupport());
EXPECT_TRUE(productHelper->getPipelineSelectPropertyModeSelectedSupport());
EXPECT_FALSE(productHelper->getPipelineSelectPropertyMediaSamplerDopClockGateSupport());
EXPECT_TRUE(productHelper->getPipelineSelectPropertySystolicModeSupport());
}
MTLTEST_F(MtlProductHelper, givenProductHelperWhenAdditionalKernelExecInfoSupportCheckedThenCorrectValueIsReturned) {
auto hwInfo = *defaultHwInfo;
EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(hwInfo));
FrontEndPropertiesSupport fePropertiesSupport{};
productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, hwInfo);
EXPECT_TRUE(fePropertiesSupport.disableOverdispatch);
hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, hwInfo);
EXPECT_TRUE(productHelper->isDisableOverdispatchAvailable(hwInfo));
productHelper->fillFrontEndPropertiesSupportStructure(fePropertiesSupport, hwInfo);
EXPECT_TRUE(fePropertiesSupport.disableOverdispatch);
}
MTLTEST_F(MtlProductHelper, givenCompressionFtrEnabledWhenAskingForPageTableManagerThenReturnCorrectValue) {
auto hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.ftrRenderCompressedBuffers = false;
hwInfo.capabilityTable.ftrRenderCompressedImages = false;
EXPECT_FALSE(productHelper->isPageTableManagerSupported(hwInfo));
hwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
hwInfo.capabilityTable.ftrRenderCompressedImages = false;
EXPECT_TRUE(productHelper->isPageTableManagerSupported(hwInfo));
hwInfo.capabilityTable.ftrRenderCompressedBuffers = false;
hwInfo.capabilityTable.ftrRenderCompressedImages = true;
EXPECT_TRUE(productHelper->isPageTableManagerSupported(hwInfo));
hwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
hwInfo.capabilityTable.ftrRenderCompressedImages = true;
EXPECT_TRUE(productHelper->isPageTableManagerSupported(hwInfo));
}
MTLTEST_F(MtlProductHelper, givenSteppingWhenIsPipeControlPriorToNonPipelinedStateCommandsWARequiredIsCalledOnCcsThenThenAllowOnA0) {
HardwareInfo hwInfo = *defaultHwInfo;
auto isRcs = false;
{
hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_A0, hwInfo);
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs);
EXPECT_FALSE(isExtendedWARequired);
EXPECT_TRUE(isBasicWARequired);
}
{
hwInfo.platform.usRevId = productHelper->getHwRevIdFromStepping(REVISION_B, hwInfo);
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs);
EXPECT_FALSE(isExtendedWARequired);
EXPECT_FALSE(isBasicWARequired);
}
}
MTLTEST_F(MtlProductHelper, givenMtlNotLpgWhenIsBFloat16ConversionSupportedIsCalledThenTrueIsReturned) {
auto hwInfo = *defaultHwInfo.get();
uint32_t notLpgArchitecture = 10;
HardwareIpVersion aotConfig = {0};
aotConfig.architecture = notLpgArchitecture;
CompilerProductHelper::get(hwInfo.platform.eProductFamily)->setProductConfigForHwInfo(hwInfo, aotConfig);
EXPECT_TRUE(productHelper->isBFloat16ConversionSupported(hwInfo));
}
MTLTEST_F(MtlProductHelper, givenMtlLpgWhenIsBFloat16ConversionSupportedIsCalledThenFalseIsReturned) {
auto hwInfo = *defaultHwInfo.get();
uint32_t lpgArchitecture = 12;
uint32_t lpgRelease = 71;
HardwareIpVersion aotConfig = {0};
aotConfig.architecture = lpgArchitecture;
aotConfig.release = lpgRelease;
CompilerProductHelper::get(hwInfo.platform.eProductFamily)->setProductConfigForHwInfo(hwInfo, aotConfig);
EXPECT_FALSE(productHelper->isBFloat16ConversionSupported(hwInfo));
}

View File

@@ -0,0 +1,105 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_info.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/test_macros/hw_test.h"
using namespace NEO;
using MtlHwInfoTests = ::testing::Test;
MTLTEST_F(MtlHwInfoTests, WhenSetupHardwareInfoWithSetupFeatureTableFlagTrueOrFalseIsCalledThenFeatureTableHasCorrectValues) {
HardwareInfo hwInfo = *defaultHwInfo;
FeatureTable &featureTable = hwInfo.featureTable;
WorkaroundTable &workaroundTable = hwInfo.workaroundTable;
EXPECT_FALSE(featureTable.flags.ftrLocalMemory);
EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS);
EXPECT_FALSE(featureTable.flags.ftrLinearCCS);
EXPECT_FALSE(featureTable.flags.ftrE2ECompression);
EXPECT_FALSE(featureTable.flags.ftrCCSNode);
EXPECT_FALSE(featureTable.flags.ftrCCSRing);
EXPECT_FALSE(featureTable.flags.ftrMultiTileArch);
EXPECT_FALSE(workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface);
EXPECT_FALSE(workaroundTable.flags.waUntypedBufferCompression);
MtlHwConfig::setupHardwareInfo(&hwInfo, false);
EXPECT_FALSE(featureTable.flags.ftrLocalMemory);
EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS);
EXPECT_FALSE(featureTable.flags.ftrLinearCCS);
EXPECT_FALSE(featureTable.flags.ftrE2ECompression);
EXPECT_FALSE(featureTable.flags.ftrCCSNode);
EXPECT_FALSE(featureTable.flags.ftrCCSRing);
EXPECT_FALSE(featureTable.flags.ftrMultiTileArch);
EXPECT_FALSE(workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface);
EXPECT_FALSE(workaroundTable.flags.waUntypedBufferCompression);
MtlHwConfig::setupHardwareInfo(&hwInfo, true);
EXPECT_FALSE(featureTable.flags.ftrLocalMemory);
EXPECT_FALSE(featureTable.flags.ftrFlatPhysCCS);
EXPECT_TRUE(featureTable.flags.ftrLinearCCS);
EXPECT_FALSE(featureTable.flags.ftrE2ECompression);
EXPECT_TRUE(featureTable.flags.ftrCCSNode);
EXPECT_TRUE(featureTable.flags.ftrCCSRing);
EXPECT_FALSE(featureTable.flags.ftrMultiTileArch);
EXPECT_TRUE(workaroundTable.flags.wa4kAlignUVOffsetNV12LinearSurface);
EXPECT_TRUE(workaroundTable.flags.waUntypedBufferCompression);
}
MTLTEST_F(MtlHwInfoTests, WhenSetupHardwareInfoWithSetupFeatureTableFlagTrueOrFalseIsCalledThenFeatureTableHasCorrectValueOfFtrLinearCCS) {
HardwareInfo hwInfo = *defaultHwInfo;
FeatureTable &featureTable = hwInfo.featureTable;
EXPECT_FALSE(featureTable.flags.ftrLinearCCS);
MtlHwConfig::setupHardwareInfo(&hwInfo, false);
EXPECT_FALSE(featureTable.flags.ftrLinearCCS);
MtlHwConfig::setupHardwareInfo(&hwInfo, true);
EXPECT_TRUE(featureTable.flags.ftrLinearCCS);
}
MTLTEST_F(MtlHwInfoTests, WhenSetupHardwareInfoThenCorrectValuesOfCCSAndMultiTileInfoAreSet) {
HardwareInfo hwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
MtlHwConfig::setupHardwareInfo(&hwInfo, false);
EXPECT_FALSE(gtSystemInfo.MultiTileArchInfo.IsValid);
EXPECT_TRUE(gtSystemInfo.CCSInfo.IsValid);
EXPECT_TRUE(1u == gtSystemInfo.CCSInfo.NumberOfCCSEnabled);
EXPECT_TRUE(0b1u == gtSystemInfo.CCSInfo.Instances.CCSEnableMask);
}
MTLTEST_F(MtlHwInfoTests, GivenEmptyHwInfoForUnitTestsWhenSetupHardwareInfoIsCalledThenNonZeroValuesAreSet) {
HardwareInfo hwInfoToSet;
GT_SYSTEM_INFO &gtSystemInfo = hwInfoToSet.gtSystemInfo;
MtlHwConfig::setupHardwareInfo(&hwInfoToSet, false);
EXPECT_GT_VAL(gtSystemInfo.SliceCount, 0u);
EXPECT_GT_VAL(gtSystemInfo.SubSliceCount, 0u);
EXPECT_GT_VAL(gtSystemInfo.DualSubSliceCount, 0u);
EXPECT_GT_VAL(gtSystemInfo.EUCount, 0u);
EXPECT_GT_VAL(gtSystemInfo.MaxEuPerSubSlice, 0u);
EXPECT_GT_VAL(gtSystemInfo.MaxSlicesSupported, 0u);
EXPECT_GT_VAL(gtSystemInfo.MaxSubSlicesSupported, 0u);
EXPECT_GT_VAL(gtSystemInfo.L3BankCount, 0u);
EXPECT_TRUE(gtSystemInfo.CCSInfo.IsValid);
EXPECT_GT_VAL(gtSystemInfo.CCSInfo.NumberOfCCSEnabled, 0u);
EXPECT_NE_VAL(hwInfoToSet.featureTable.ftrBcsInfo, 0u);
EXPECT_TRUE(gtSystemInfo.IsDynamicallyPopulated);
for (uint32_t i = 0; i < gtSystemInfo.SliceCount; i++) {
EXPECT_TRUE(gtSystemInfo.SliceInfo[i].Enabled);
}
}

View File

@@ -0,0 +1,9 @@
#
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(UNIX)
target_sources(neo_shared_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_tests_mtl.cpp)
endif()

View File

@@ -0,0 +1,45 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/libult/linux/drm_mock.h"
#include "shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.h"
using namespace NEO;
struct MtlProductHelperLinux : ProductHelperTestLinux {
void SetUp() override {
ProductHelperTestLinux::SetUp();
drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]);
osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
}
};
MTLTEST_F(MtlProductHelperLinux, WhenConfiguringHwInfoThenZeroIsReturned) {
auto ret = productHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, getRootDeviceEnvironment());
EXPECT_EQ(0, ret);
}
MTLTEST_F(MtlProductHelperLinux, GivenMtlWhenConfigureHardwareCustomThenKmdNotifyIsEnabled) {
OSInterface osIface;
productHelper->configureHardwareCustom(&pInHwInfo, &osIface);
EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(150ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission);
EXPECT_EQ(20ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForDirectSubmissionMicroseconds);
}
MTLTEST_F(MtlProductHelperLinux, givenMtlWhenIsBlitterForImagesSupportedIsCalledThenTrueIsReturned) {
EXPECT_TRUE(productHelper->isBlitterForImagesSupported());
}
MTLTEST_F(MtlProductHelperLinux, givenMtlWhenisVmBindPatIndexProgrammingSupportedIsCalledThenTrueIsReturned) {
EXPECT_TRUE(productHelper->isVmBindPatIndexProgrammingSupported());
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/hw_test.h"
#include <memory>
using namespace NEO;
using SamplerTestMtl = ::testing::Test;
HWTEST2_F(SamplerTestMtl, givenMtlSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter, IsMTL) {
EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
auto state = FamilyType::cmdInitSamplerState;
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
ProductHelper::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
}
HWTEST2_F(SamplerTestMtl, giveMtlSamplerWhenForcingLowQualityFilteringAndAppendSamplerStateParamsThenEnableLowQualityFilter, IsMTL) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
auto state = FamilyType::cmdInitSamplerState;
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
ProductHelper::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
}

View File

@@ -0,0 +1,17 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
using namespace NEO;
using MtlUsDeviceIdTest = Test<DeviceFixture>;
MTLTEST_F(MtlUsDeviceIdTest, givenMtlProductWhenCheckFp64SupportThenReturnFalse) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsFP64);
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/unit_test/fixtures/command_container_fixture.h"
#include "shared/test/unit_test/mocks/mock_dispatch_kernel_encoder_interface.h"
using namespace NEO;
using CommandEncodeStatesTest = Test<CommandEncodeStatesFixture>;
HWTEST2_F(CommandEncodeStatesTest, givenEventAddressWhenEncodeAndMtlThenMocsIndex2IsSet, IsMTL) {
using POSTSYNC_DATA = typename FamilyType::POSTSYNC_DATA;
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
uint32_t dims[] = {2, 1, 1};
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
uint64_t eventAddress = MemoryConstants::cacheLineSize * 123;
bool requiresUncachedMocs = false;
EncodeDispatchKernelArgs dispatchArgs = createDefaultDispatchKernelArgs(pDevice, dispatchInterface.get(), dims, requiresUncachedMocs);
dispatchArgs.eventAddress = eventAddress;
dispatchArgs.isTimestampEvent = true;
dispatchArgs.dcFlushEnable = MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, pDevice->getHardwareInfo());
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dispatchArgs, nullptr);
GenCmdList commands;
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
auto itor = find<WALKER_TYPE *>(commands.begin(), commands.end());
ASSERT_NE(itor, commands.end());
auto cmd = genCmdCast<WALKER_TYPE *>(*itor);
auto gmmHelper = pDevice->getGmmHelper();
EXPECT_EQ(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED), cmd->getPostSync().getMocs());
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_container/command_encoder.h"
#include "shared/source/command_stream/linear_stream.h"
#include "shared/source/command_stream/stream_properties.h"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using CommandEncodeMTLTest = ::testing::Test;
MTLTEST_F(CommandEncodeMTLTest, whenProgrammingStateComputeModeThenProperFieldsAreSet) {
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
using PIXEL_ASYNC_COMPUTE_THREAD_LIMIT = typename STATE_COMPUTE_MODE::PIXEL_ASYNC_COMPUTE_THREAD_LIMIT;
using Z_PASS_ASYNC_COMPUTE_THREAD_LIMIT = typename STATE_COMPUTE_MODE::Z_PASS_ASYNC_COMPUTE_THREAD_LIMIT;
uint8_t buffer[64]{};
StateComputeModeProperties properties;
auto pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
EncodeComputeMode<FamilyType>::programComputeModeCommand(*pLinearStream, properties, *defaultHwInfo, nullptr);
auto pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
auto expectedMask = FamilyType::stateComputeModeLargeGrfModeMask;
EXPECT_EQ(expectedMask, pScm->getMaskBits());
EXPECT_EQ(STATE_COMPUTE_MODE::PIXEL_ASYNC_COMPUTE_THREAD_LIMIT_DISABLED, pScm->getPixelAsyncComputeThreadLimit());
EXPECT_EQ(STATE_COMPUTE_MODE::Z_PASS_ASYNC_COMPUTE_THREAD_LIMIT_MAX_60, pScm->getZPassAsyncComputeThreadLimit());
EXPECT_FALSE(pScm->getLargeGrfMode());
properties.isCoherencyRequired.value = 1;
properties.zPassAsyncComputeThreadLimit.value = 1;
properties.pixelAsyncComputeThreadLimit.value = 1;
properties.largeGrfMode.value = 1;
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
EncodeComputeMode<FamilyType>::programComputeModeCommand(*pLinearStream, properties, *defaultHwInfo, nullptr);
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
expectedMask |= FamilyType::stateComputeModeZPassAsyncComputeThreadLimitMask |
FamilyType::stateComputeModePixelAsyncComputeThreadLimitMask;
EXPECT_EQ(expectedMask, pScm->getMaskBits());
EXPECT_EQ(STATE_COMPUTE_MODE::PIXEL_ASYNC_COMPUTE_THREAD_LIMIT_MAX_2, pScm->getPixelAsyncComputeThreadLimit());
EXPECT_EQ(STATE_COMPUTE_MODE::Z_PASS_ASYNC_COMPUTE_THREAD_LIMIT_MAX_64, pScm->getZPassAsyncComputeThreadLimit());
EXPECT_TRUE(pScm->getLargeGrfMode());
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/unit_test/image/image_surface_state_fixture.h"
using namespace NEO;
using ImageSurfaceStateTestsMtl = ImageSurfaceStateTests;
MTLTEST_F(ImageSurfaceStateTestsMtl, givenMtlWhenCallSetFilterModeThenDisallowLowQualityFliteringIsAllwaysFalse) {
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
auto surfaceState = std::make_unique<char[]>(size);
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
setFilterMode<FamilyType>(castSurfaceState, &pDevice->getHardwareInfo());
EXPECT_FALSE(castSurfaceState->getDisallowLowQualityFiltering());
}
MTLTEST_F(ImageSurfaceStateTestsMtl, givenMtlWhenCallSetImageSurfaceStateThenDisallowLowQualityFliteringIsAllwaysFalse) {
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
auto surfaceState = std::make_unique<char[]>(size);
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
const uint32_t cubeFaceIndex = 2u;
SurfaceFormatInfo surfaceFormatInfo;
surfaceFormatInfo.GenxSurfaceFormat = GFX3DSTATE_SURFACEFORMAT::GFX3DSTATE_SURFACEFORMAT_A32_FLOAT;
imageInfo.surfaceFormat = &surfaceFormatInfo;
SurfaceOffsets surfaceOffsets;
surfaceOffsets.offset = 0u;
surfaceOffsets.xOffset = 11u;
surfaceOffsets.yOffset = 12u;
surfaceOffsets.yOffsetForUVplane = 13u;
const uint64_t gpuAddress = 0x000001a78a8a8000;
setImageSurfaceState<FamilyType>(castSurfaceState, imageInfo, mockGmm.get(), *gmmHelper, cubeFaceIndex, gpuAddress, surfaceOffsets, true);
EXPECT_FALSE(castSurfaceState->getDisallowLowQualityFiltering());
}