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

@@ -8,6 +8,8 @@ set(NEO_CORE_OS_INTERFACE_AUB_TESTS
${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.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})

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;
};