Move HwInfoConfig tests to common file

Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com>
This commit is contained in:
Rafal Maziejuk
2021-08-30 14:34:53 +00:00
committed by Compute-Runtime-Automation
parent 51a5d5cec3
commit e96f1afa6f
5 changed files with 180 additions and 262 deletions

View File

@@ -44,112 +44,6 @@ int HwInfoConfigHw<IGFX_UNKNOWN>::configureHardwareCustom(HardwareInfo *hwInfo,
} }
return (hwInfo->platform.usDeviceID == 10) ? -1 : 0; return (hwInfo->platform.usDeviceID == 10) ? -1 : 0;
} }
template <>
cl_unified_shared_memory_capabilities_intel HwInfoConfigHw<IGFX_UNKNOWN>::getHostMemCapabilities(const HardwareInfo * /*hwInfo*/) {
return 0;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustPlatformForProductFamily(HardwareInfo *hwInfo) {
}
template <>
cl_unified_shared_memory_capabilities_intel HwInfoConfigHw<IGFX_UNKNOWN>::getDeviceMemCapabilities() {
return 0;
}
template <>
cl_unified_shared_memory_capabilities_intel HwInfoConfigHw<IGFX_UNKNOWN>::getSingleDeviceSharedMemCapabilities() {
return 0;
}
template <>
cl_unified_shared_memory_capabilities_intel HwInfoConfigHw<IGFX_UNKNOWN>::getCrossDeviceSharedMemCapabilities() {
return 0;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::getKernelExtendedProperties(uint32_t *fp16, uint32_t *fp32, uint32_t *fp64) {
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) {
return 0;
}
template <>
cl_unified_shared_memory_capabilities_intel HwInfoConfigHw<IGFX_UNKNOWN>::getSharedSystemMemCapabilities() {
return 0;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo){};
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::convertTimestampsFromOaToCsDomain(uint64_t &timestampData){};
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const {
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isMaxThreadsForWorkgroupWARequired(const HardwareInfo &hwInfo) const {
return false;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getMaxThreadsForWorkgroupInDSSOrSS(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice, uint32_t maxNumEUsPerDualSubSlice) const {
return 0;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const {
return 0;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) {}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isPageTableManagerSupported(const HardwareInfo &hwInfo) const {
return false;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (getSteppingFromHwRevId(hwInfo)) {
default:
case REVISION_A0:
case REVISION_A1:
case REVISION_A3:
return AubMemDump::SteppingValues::A;
case REVISION_B:
return AubMemDump::SteppingValues::B;
case REVISION_C:
return AubMemDump::SteppingValues::C;
case REVISION_D:
return AubMemDump::SteppingValues::D;
case REVISION_K:
return AubMemDump::SteppingValues::K;
}
}
} // namespace NEO } // namespace NEO
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> { struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
@@ -601,16 +495,6 @@ TEST_F(HwInfoConfigTestLinuxDummy, givenFailingGttSizeIoctlWhenInitializingHwInf
EXPECT_EQ(pInHwInfo.capabilityTable.gpuAddressSpace, outHwInfo.capabilityTable.gpuAddressSpace); EXPECT_EQ(pInHwInfo.capabilityTable.gpuAddressSpace, outHwInfo.capabilityTable.gpuAddressSpace);
} }
HWTEST_F(HwInfoConfigTestLinuxDummy, givenHardwareInfoWhenCallingIsAdditionalStateBaseAddressWARequiredThenFalseIsReturned) {
bool ret = hwConfig.isAdditionalStateBaseAddressWARequired(outHwInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestLinuxDummy, givenHardwareInfoWhenCallingIsMaxThreadsForWorkgroupWARequiredThenFalseIsReturned) {
bool ret = hwConfig.isMaxThreadsForWorkgroupWARequired(outHwInfo);
EXPECT_FALSE(ret);
}
using HwConfigLinux = ::testing::Test; using HwConfigLinux = ::testing::Test;
HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwInfoThenMaxSlicesSupportedSetToAvailableCountInGtSystemInfo, MatchAny) { HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwInfoThenMaxSlicesSupportedSetToAvailableCountInGtSystemInfo, MatchAny) {
@@ -665,18 +549,3 @@ HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwI
EXPECT_EQ(0, ret); EXPECT_EQ(0, ret);
EXPECT_EQ(8u, outHwInfo.gtSystemInfo.MaxEuPerSubSlice); EXPECT_EQ(8u, outHwInfo.gtSystemInfo.MaxEuPerSubSlice);
} }
HWTEST_F(HwInfoConfigTestLinuxDummy, givenHardwareInfoWhenCallingObtainBlitterPreferenceThenFalseIsReturned) {
bool ret = hwConfig.obtainBlitterPreference(outHwInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestLinuxDummy, givenHardwareInfoWhenCallingIsPageTableManagerSupportedThenFalseIsReturned) {
bool ret = hwConfig.isPageTableManagerSupported(outHwInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestLinuxDummy, givenHardwareInfoWhenCallingGetSteppingFromHwRevIdThenInvalidSteppingIsReturned) {
uint32_t ret = hwConfig.getSteppingFromHwRevId(outHwInfo);
EXPECT_EQ(CommonConstants::invalidStepping, ret);
}

View File

@@ -19,117 +19,11 @@
namespace NEO { namespace NEO {
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getHostMemCapabilities(const HardwareInfo * /*hwInfo*/) {
return 0;
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getDeviceMemCapabilities() {
return 0;
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getSingleDeviceSharedMemCapabilities() {
return 0;
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getCrossDeviceSharedMemCapabilities() {
return 0;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::getKernelExtendedProperties(uint32_t *fp16, uint32_t *fp32, uint32_t *fp64) {
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) {
return 0;
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getSharedSystemMemCapabilities() {
return 0;
}
template <> template <>
int HwInfoConfigHw<IGFX_UNKNOWN>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) { int HwInfoConfigHw<IGFX_UNKNOWN>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
return 0; return 0;
} }
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustPlatformForProductFamily(HardwareInfo *hwInfo) {
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::convertTimestampsFromOaToCsDomain(uint64_t &timestampData){};
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo){};
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const {
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isMaxThreadsForWorkgroupWARequired(const HardwareInfo &hwInfo) const {
return false;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getMaxThreadsForWorkgroupInDSSOrSS(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice, uint32_t maxNumEUsPerDualSubSlice) const {
return 0;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const {
return 0;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) {}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isPageTableManagerSupported(const HardwareInfo &hwInfo) const {
return false;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (getSteppingFromHwRevId(hwInfo)) {
default:
case REVISION_A0:
case REVISION_A1:
case REVISION_A3:
return AubMemDump::SteppingValues::A;
case REVISION_B:
return AubMemDump::SteppingValues::B;
case REVISION_C:
return AubMemDump::SteppingValues::C;
case REVISION_D:
return AubMemDump::SteppingValues::D;
case REVISION_K:
return AubMemDump::SteppingValues::K;
}
}
HwInfoConfigTestWindows::HwInfoConfigTestWindows() { HwInfoConfigTestWindows::HwInfoConfigTestWindows() {
this->executionEnvironment = std::make_unique<MockExecutionEnvironment>(); this->executionEnvironment = std::make_unique<MockExecutionEnvironment>();
this->rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment); this->rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
@@ -180,16 +74,6 @@ TEST_F(HwInfoConfigTestWindows, givenInstrumentationForHardwareIsEnabledOrDisabl
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled); EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled);
} }
HWTEST_F(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingIsAdditionalStateBaseAddressWARequiredThenFalseIsReturned) {
bool ret = hwConfig.isAdditionalStateBaseAddressWARequired(outHwInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingIsMaxThreadsForWorkgroupWARequiredThenFalseIsReturned) {
bool ret = hwConfig.isMaxThreadsForWorkgroupWARequired(outHwInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoThenSetCoherencySupportCorrectly) { HWTEST_F(HwInfoConfigTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoThenSetCoherencySupportCorrectly) {
HardwareInfo initialHwInfo = *defaultHwInfo; HardwareInfo initialHwInfo = *defaultHwInfo;
auto &hwHelper = HwHelper::get(initialHwInfo.platform.eRenderCoreFamily); auto &hwHelper = HwHelper::get(initialHwInfo.platform.eRenderCoreFamily);
@@ -207,19 +91,4 @@ HWTEST_F(HwInfoConfigTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoTh
EXPECT_EQ(initialCoherencyStatus, outHwInfo.capabilityTable.ftrSupportsCoherency); EXPECT_EQ(initialCoherencyStatus, outHwInfo.capabilityTable.ftrSupportsCoherency);
} }
HWTEST_F(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingObtainBlitterPreferenceThenFalseIsReturned) {
bool ret = hwConfig.obtainBlitterPreference(outHwInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingIsPageTableManagerSupportedThenFalseIsReturned) {
bool ret = hwConfig.isPageTableManagerSupported(outHwInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(HwInfoConfigTestWindows, givenHardwareInfoWhenCallingGetSteppingFromHwRevIdThenInvalidSteppingIsReturned) {
uint32_t ret = hwConfig.getSteppingFromHwRevId(outHwInfo);
EXPECT_EQ(CommonConstants::invalidStepping, ret);
}
} // namespace NEO } // namespace NEO

View File

@@ -8,6 +8,8 @@ set(NEO_CORE_OS_INTERFACE_AUB_TESTS
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/aub_memory_operations_handler_tests.cpp ${CMAKE_CURRENT_SOURCE_DIR}/aub_memory_operations_handler_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/aub_memory_operations_handler_tests.h ${CMAKE_CURRENT_SOURCE_DIR}/aub_memory_operations_handler_tests.h
${CMAKE_CURRENT_SOURCE_DIR}/os_agnostic_hw_info_config_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/os_agnostic_hw_info_config_tests.h
) )
set_property(GLOBAL PROPERTY NEO_CORE_OS_INTERFACE_AUB_TESTS ${NEO_CORE_OS_INTERFACE_AUB_TESTS}) set_property(GLOBAL PROPERTY NEO_CORE_OS_INTERFACE_AUB_TESTS ${NEO_CORE_OS_INTERFACE_AUB_TESTS})

View File

@@ -0,0 +1,152 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/unit_test/os_interface/os_agnostic_hw_info_config_tests.h"
#include "shared/source/helpers/hw_helper.h"
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) {
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::convertTimestampsFromOaToCsDomain(uint64_t &timestampData) {
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getMaxThreadsForWorkgroupInDSSOrSS(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice, uint32_t maxNumEUsPerDualSubSlice) const {
return 0;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getMaxThreadsForWorkgroup(const HardwareInfo &hwInfo, uint32_t maxNumEUsPerSubSlice) const {
return 0;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::setForceNonCoherent(void *const commandPtr, const StateComputeModeProperties &properties) {
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::adjustPlatformForProductFamily(HardwareInfo *hwInfo) {
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getSharedSystemMemCapabilities() {
return 0;
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getHostMemCapabilities(const HardwareInfo * /*hwInfo*/) {
return 0;
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getDeviceMemCapabilities() {
return 0;
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getSingleDeviceSharedMemCapabilities() {
return 0;
}
template <>
uint64_t HwInfoConfigHw<IGFX_UNKNOWN>::getCrossDeviceSharedMemCapabilities() {
return 0;
}
template <>
void HwInfoConfigHw<IGFX_UNKNOWN>::getKernelExtendedProperties(uint32_t *fp16, uint32_t *fp32, uint32_t *fp64) {
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getDeviceMemoryMaxClkRate(const HardwareInfo *hwInfo) {
return 0;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isAdditionalStateBaseAddressWARequired(const HardwareInfo &hwInfo) const {
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isMaxThreadsForWorkgroupWARequired(const HardwareInfo &hwInfo) const {
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::obtainBlitterPreference(const HardwareInfo &hwInfo) const {
return false;
}
template <>
bool HwInfoConfigHw<IGFX_UNKNOWN>::isPageTableManagerSupported(const HardwareInfo &hwInfo) const {
return false;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getHwRevIdFromStepping(uint32_t stepping, const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
return CommonConstants::invalidStepping;
}
template <>
uint32_t HwInfoConfigHw<IGFX_UNKNOWN>::getAubStreamSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
switch (getSteppingFromHwRevId(hwInfo)) {
default:
case REVISION_A0:
case REVISION_A1:
case REVISION_A3:
return AubMemDump::SteppingValues::A;
case REVISION_B:
return AubMemDump::SteppingValues::B;
case REVISION_C:
return AubMemDump::SteppingValues::C;
case REVISION_D:
return AubMemDump::SteppingValues::D;
case REVISION_K:
return AubMemDump::SteppingValues::K;
}
}
void OsAgnosticHwInfoConfigTest::SetUp() {
DeviceFixture::SetUp();
}
void OsAgnosticHwInfoConfigTest::TearDown() {
DeviceFixture::TearDown();
}
HWTEST_F(OsAgnosticHwInfoConfigTest, givenHardwareInfoWhenCallingObtainBlitterPreferenceThenFalseIsReturned) {
bool ret = hwConfig.obtainBlitterPreference(hardwareInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(OsAgnosticHwInfoConfigTest, givenHardwareInfoWhenCallingIsPageTableManagerSupportedThenFalseIsReturned) {
bool ret = hwConfig.isPageTableManagerSupported(hardwareInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(OsAgnosticHwInfoConfigTest, givenHardwareInfoWhenCallingGetSteppingFromHwRevIdThenInvalidSteppingIsReturned) {
uint32_t ret = hwConfig.getSteppingFromHwRevId(hardwareInfo);
EXPECT_EQ(CommonConstants::invalidStepping, ret);
}
HWTEST_F(OsAgnosticHwInfoConfigTest, givenHardwareInfoWhenCallingIsAdditionalStateBaseAddressWARequiredThenFalseIsReturned) {
bool ret = hwConfig.isAdditionalStateBaseAddressWARequired(hardwareInfo);
EXPECT_FALSE(ret);
}
HWTEST_F(OsAgnosticHwInfoConfigTest, givenHardwareInfoWhenCallingIsMaxThreadsForWorkgroupWARequiredThenFalseIsReturned) {
bool ret = hwConfig.isMaxThreadsForWorkgroupWARequired(hardwareInfo);
EXPECT_FALSE(ret);
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "test.h"
using namespace NEO;
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
};
struct OsAgnosticHwInfoConfigTest : public ::testing::Test,
public DeviceFixture {
void SetUp() override;
void TearDown() override;
DummyHwConfig hwConfig;
};