fix: add fallback in setting hw ip version for MTL

setup hw ip version based on device id and revision id

Related-To: NEO-8231
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski 2023-08-02 14:59:11 +00:00 committed by Compute-Runtime-Automation
parent d7aea3e745
commit c7c7ba7159
2 changed files with 110 additions and 1 deletions

View File

@ -11,4 +11,49 @@ constexpr auto gfxProduct = IGFX_METEORLAKE;
#include "shared/source/xe_hpg_core/xe_lpg/compiler_product_helper_xe_lpg.inl"
namespace NEO {
template <>
uint32_t CompilerProductHelperHw<gfxProduct>::getProductConfigFromHwInfo(const HardwareInfo &hwInfo) const {
if (hwInfo.ipVersion.value) {
return hwInfo.ipVersion.value;
}
switch (hwInfo.platform.usDeviceID) {
case 0x7D40:
case 0x7D45: {
switch (hwInfo.platform.usRevId) {
case 0x0:
case 0x2:
return AOT::MTL_M_A0;
case 0x3:
case 0x8:
return AOT::MTL_M_B0;
}
break;
}
case 0x7D55:
case 0X7DD5: {
switch (hwInfo.platform.usRevId) {
case 0x0:
case 0x2:
return AOT::MTL_P_A0;
case 0x3:
case 0x8:
return AOT::MTL_P_B0;
}
break;
}
case 0x7D60: {
switch (hwInfo.platform.usRevId) {
case 0x0:
return AOT::MTL_M_A0;
case 0x2:
return AOT::MTL_M_B0;
}
break;
}
}
return getDefaultHwIpVersion();
}
} // namespace NEO
static NEO::EnableCompilerProductHelper<gfxProduct> enableCompilerProductHelperMTL;

View File

@ -5,14 +5,18 @@
*
*/
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/source/memory_manager/allocation_type.h"
#include "shared/source/os_interface/product_helper.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"
#include "shared/test/unit_test/os_interface/product_helper_tests.h"
#include "platforms.h"
using namespace NEO;
using MtlProductHelper = ProductHelperTest;
@ -21,6 +25,66 @@ MTLTEST_F(MtlProductHelper, givenProductHelperWhenCheckDirectSubmissionSupported
EXPECT_TRUE(productHelper->isDirectSubmissionSupported(releaseHelper));
}
MTLTEST_F(MtlProductHelper, givenMtlWithoutHwIpVersionInHwInfoWhenGettingIpVersionThenCorrectValueIsReturnedBasedOnDeviceIdAndRevId) {
auto hwInfo = *defaultHwInfo;
hwInfo.ipVersion = {};
auto mtlMDeviceIds = {0x7D40, 0x7D45};
auto mtlPDeviceIds = {0x7D55, 0X7DD5};
hwInfo.platform.usDeviceID = 0x7D60;
hwInfo.platform.usRevId = 0;
EXPECT_EQ(AOT::MTL_M_A0, compilerProductHelper->getHwIpVersion(hwInfo));
hwInfo.platform.usRevId = 2;
EXPECT_EQ(AOT::MTL_M_B0, compilerProductHelper->getHwIpVersion(hwInfo));
hwInfo.platform.usRevId = 0xdead;
EXPECT_EQ(compilerProductHelper->getDefaultHwIpVersion(), compilerProductHelper->getHwIpVersion(hwInfo));
for (auto &deviceId : mtlMDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
for (auto &revision : {0, 2}) {
hwInfo.platform.usRevId = revision;
EXPECT_EQ(AOT::MTL_M_A0, compilerProductHelper->getHwIpVersion(hwInfo));
}
for (auto &revision : {3, 8}) {
hwInfo.platform.usRevId = revision;
EXPECT_EQ(AOT::MTL_M_B0, compilerProductHelper->getHwIpVersion(hwInfo));
}
hwInfo.platform.usRevId = 0xdead;
EXPECT_EQ(compilerProductHelper->getDefaultHwIpVersion(), compilerProductHelper->getHwIpVersion(hwInfo));
}
for (auto &deviceId : mtlPDeviceIds) {
hwInfo.platform.usDeviceID = deviceId;
for (auto &revision : {0, 2}) {
hwInfo.platform.usRevId = revision;
EXPECT_EQ(AOT::MTL_P_A0, compilerProductHelper->getHwIpVersion(hwInfo));
}
for (auto &revision : {3, 8}) {
hwInfo.platform.usRevId = revision;
EXPECT_EQ(AOT::MTL_P_B0, compilerProductHelper->getHwIpVersion(hwInfo));
}
hwInfo.platform.usRevId = 0xdead;
EXPECT_EQ(compilerProductHelper->getDefaultHwIpVersion(), compilerProductHelper->getHwIpVersion(hwInfo));
}
hwInfo.platform.usDeviceID = 0;
hwInfo.platform.usRevId = 0xdead;
EXPECT_EQ(compilerProductHelper->getDefaultHwIpVersion(), compilerProductHelper->getHwIpVersion(hwInfo));
}
MTLTEST_F(MtlProductHelper, givenProductHelperWhenCheckOverrideAllocationCacheableThenTrueIsReturnedForCommandBuffer) {
AllocationData allocationData{};
allocationData.type = AllocationType::COMMAND_BUFFER;
@ -28,4 +92,4 @@ MTLTEST_F(MtlProductHelper, givenProductHelperWhenCheckOverrideAllocationCacheab
allocationData.type = AllocationType::BUFFER;
EXPECT_FALSE(productHelper->overrideAllocationCacheable(allocationData));
}
}