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 b85222b4f3
commit fbac74e3c4
2 changed files with 105 additions and 0 deletions

View File

@ -26,6 +26,49 @@ uint32_t CompilerProductHelperHw<gfxProduct>::getDefaultHwIpVersion() const {
return AOT::MTL_M_A0;
}
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();
}
static EnableCompilerProductHelper<gfxProduct> enableCompilerProductHelperMTL;
} // namespace NEO

View File

@ -269,3 +269,65 @@ MTLTEST_F(ProductHelperTestMtl, givenMtlWhenCheckPreferredAllocationMethodThenAl
EXPECT_TRUE(preferredAllocationMethod.has_value());
EXPECT_EQ(GfxMemoryAllocationMethod::AllocateByKmd, preferredAllocationMethod.value());
}
MTLTEST_F(ProductHelperTestMtl, givenMtlWithoutHwIpVersionInHwInfoWhenGettingIpVersionThenCorrectValueIsReturnedBasedOnDeviceIdAndRevId) {
const auto &compilerProductHelper = getHelper<CompilerProductHelper>();
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));
}