2022-12-01 20:50:08 +08:00
|
|
|
/*
|
2024-05-26 22:46:04 +08:00
|
|
|
* Copyright (C) 2022-2024 Intel Corporation
|
2022-12-01 20:50:08 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-02-02 22:25:08 +08:00
|
|
|
#include "shared/source/helpers/compiler_product_helper.h"
|
2023-01-24 00:24:42 +08:00
|
|
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
2023-02-09 19:28:14 +08:00
|
|
|
#include "shared/test/common/test_macros/hw_test.h"
|
2022-12-01 20:50:08 +08:00
|
|
|
#include "shared/test/unit_test/fixtures/product_config_fixture.h"
|
|
|
|
|
|
|
|
using namespace NEO;
|
|
|
|
|
|
|
|
HWTEST2_P(ProductConfigHwInfoTests, givenAotConfigWhenSetHwInfoGmdIdThenCorrectValueIsSet, IsAtLeastMtl) {
|
|
|
|
HardwareIpVersion aotConfig = {0};
|
|
|
|
aotConfig.value = productConfig;
|
2023-04-18 16:54:04 +08:00
|
|
|
compilerProductHelper->setProductConfigForHwInfo(hwInfo, aotConfig);
|
2023-04-12 22:02:38 +08:00
|
|
|
|
2022-12-01 20:50:08 +08:00
|
|
|
EXPECT_EQ(hwInfo.ipVersion.architecture, aotConfig.architecture);
|
|
|
|
EXPECT_EQ(hwInfo.ipVersion.release, aotConfig.release);
|
|
|
|
EXPECT_EQ(hwInfo.ipVersion.revision, aotConfig.revision);
|
|
|
|
|
2023-04-18 16:54:04 +08:00
|
|
|
auto ret = compilerProductHelper->getHwIpVersion(hwInfo);
|
2023-04-12 22:02:38 +08:00
|
|
|
EXPECT_EQ(ret, productConfig);
|
2022-12-01 20:50:08 +08:00
|
|
|
}
|
|
|
|
|
2023-05-31 19:29:22 +08:00
|
|
|
HWTEST2_P(ProductConfigHwInfoTests, givenUnknownAotConfigWhenGetProductConfigThenDefaultConfigIsReturned, IsAtLeastMtl) {
|
2022-12-01 20:50:08 +08:00
|
|
|
hwInfo.ipVersion = {};
|
2024-05-26 22:46:04 +08:00
|
|
|
hwInfo.platform.usDeviceID = 0;
|
2024-05-29 05:09:23 +08:00
|
|
|
hwInfo.platform.usRevId = CommonConstants::invalidRevisionID;
|
2023-04-18 16:54:04 +08:00
|
|
|
auto ret = compilerProductHelper->getHwIpVersion(hwInfo);
|
2023-05-31 19:29:22 +08:00
|
|
|
EXPECT_EQ(ret, compilerProductHelper->getDefaultHwIpVersion());
|
2022-12-01 20:50:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2023-04-18 16:54:04 +08:00
|
|
|
auto ret = compilerProductHelper->getHwIpVersion(hwInfo);
|
2022-12-01 20:50:08 +08:00
|
|
|
EXPECT_EQ(ret, productConfig);
|
2023-04-12 22:54:36 +08:00
|
|
|
}
|
2024-06-06 19:17:54 +08:00
|
|
|
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(ProductConfigHwInfoTests);
|
2023-04-12 22:54:36 +08:00
|
|
|
|
|
|
|
TEST(ProductConfigHwInfoTest, givenDefaultAotConfigWhenGetProductConfigThenSameValueIsReturned) {
|
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
2023-04-18 16:54:04 +08:00
|
|
|
auto &compilerProductHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<CompilerProductHelper>();
|
2023-04-12 22:54:36 +08:00
|
|
|
auto hwInfo = *defaultHwInfo;
|
2023-04-18 16:54:04 +08:00
|
|
|
auto ret = compilerProductHelper.getHwIpVersion(hwInfo);
|
2023-04-12 22:54:36 +08:00
|
|
|
EXPECT_EQ(ret, hwInfo.ipVersion.value);
|
|
|
|
}
|