Add mock helper for hwInfoConfig

Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
Katarzyna Cencelewska 2022-06-21 11:43:43 +00:00 committed by Compute-Runtime-Automation
parent e75c313ce7
commit b983ea120b
36 changed files with 396 additions and 101 deletions

View File

@ -16,6 +16,7 @@
#include "shared/source/os_interface/os_time.h" #include "shared/source/os_interface/os_time.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
#include "shared/test/common/libult/ult_command_stream_receiver.h" #include "shared/test/common/libult/ult_command_stream_receiver.h"
#include "shared/test/common/mocks/mock_compilers.h" #include "shared/test/common/mocks/mock_compilers.h"
#include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/mocks/mock_device.h"
@ -846,13 +847,6 @@ HWTEST_F(DeviceTest, whenPassingSchedulingHintExpStructToGetPropertiesThenProper
} }
HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHintExpStructToGetPropertiesThenPropertiesWithAllFlagsAreReturned, MatchAny) { HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHintExpStructToGetPropertiesThenPropertiesWithAllFlagsAreReturned, MatchAny) {
struct MockHwInfoConfig : NEO::HwInfoConfigHw<productFamily> {
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
return threadArbPolicies;
}
std::vector<int32_t> threadArbPolicies;
};
const uint32_t rootDeviceIndex = 0u; const uint32_t rootDeviceIndex = 0u;
auto hwInfo = *NEO::defaultHwInfo; auto hwInfo = *NEO::defaultHwInfo;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo,
@ -860,7 +854,7 @@ HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHint
Mock<L0::DeviceImp> deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment()); Mock<L0::DeviceImp> deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
MockHwInfoConfig hwInfoConfig{}; MockHwInfoConfigHw<productFamily> hwInfoConfig;
hwInfoConfig.threadArbPolicies = {ThreadArbitrationPolicy::AgeBased, hwInfoConfig.threadArbPolicies = {ThreadArbitrationPolicy::AgeBased,
ThreadArbitrationPolicy::RoundRobin, ThreadArbitrationPolicy::RoundRobin,
ThreadArbitrationPolicy::RoundRobinAfterDependency}; ThreadArbitrationPolicy::RoundRobinAfterDependency};
@ -886,13 +880,6 @@ HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHint
} }
HWTEST2_F(DeviceTest, givenIncorrectThreadArbitrationPolicyWhenPassingSchedulingHintExpStructToGetPropertiesThenNoneIsReturned, MatchAny) { HWTEST2_F(DeviceTest, givenIncorrectThreadArbitrationPolicyWhenPassingSchedulingHintExpStructToGetPropertiesThenNoneIsReturned, MatchAny) {
struct MockHwInfoConfig : NEO::HwInfoConfigHw<productFamily> {
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
return threadArbPolicies;
}
std::vector<int32_t> threadArbPolicies;
};
const uint32_t rootDeviceIndex = 0u; const uint32_t rootDeviceIndex = 0u;
auto hwInfo = *NEO::defaultHwInfo; auto hwInfo = *NEO::defaultHwInfo;
auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, auto *neoMockDevice = NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo,
@ -900,7 +887,7 @@ HWTEST2_F(DeviceTest, givenIncorrectThreadArbitrationPolicyWhenPassingScheduling
Mock<L0::DeviceImp> deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment()); Mock<L0::DeviceImp> deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
MockHwInfoConfig hwInfoConfig{}; MockHwInfoConfigHw<productFamily> hwInfoConfig;
hwInfoConfig.threadArbPolicies = {ThreadArbitrationPolicy::NotPresent}; hwInfoConfig.threadArbPolicies = {ThreadArbitrationPolicy::NotPresent};
VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]}; VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
hwInfoConfigFactoryBackup = &hwInfoConfig; hwInfoConfigFactoryBackup = &hwInfoConfig;

View File

@ -10,6 +10,7 @@
#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/hw_helper_tests.h" #include "shared/test/common/helpers/hw_helper_tests.h"
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
using HwHelperTestPvcAndLater = HwHelperTest; using HwHelperTestPvcAndLater = HwHelperTest;
@ -130,13 +131,8 @@ HWTEST2_F(HwHelperTestPvcAndLater, WhenIsCooperativeDispatchSupportedThenCorrect
} }
bool isRcsAvailableValue = true; bool isRcsAvailableValue = true;
}; };
struct MockHwInfoConfig : NEO::HwInfoConfigHw<productFamily> {
bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override { MockHwInfoConfigHw<productFamily> hwInfoConfig;
return isCooperativeEngineSupportedValue;
}
bool isCooperativeEngineSupportedValue = true;
};
MockHwInfoConfig hwInfoConfig{};
auto hwInfo = *::defaultHwInfo; auto hwInfo = *::defaultHwInfo;
VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]}; VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
hwInfoConfigFactoryBackup = &hwInfoConfig; hwInfoConfigFactoryBackup = &hwInfoConfig;

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ELKHARTLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ICELAKE_LP;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_LAKEFIELD;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_N;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_P;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ALDERLAKE_S;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_DG1;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,13 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_ROCKETLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,11 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
using namespace NEO;
constexpr static auto gfxProduct = IGFX_BROADWELL;
#include "shared/source/os_interface/hw_info_config_hw.inl"

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_TIGERLAKE_LP;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_BROADWELL;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_BROXTON;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_COFFEELAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,14 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_GEMINILAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_KABYLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_SKYLAKE;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_UNKNOWN;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/os_interface/hw_info_config.h"
namespace NEO {
template <PRODUCT_FAMILY productFamily>
struct MockHwInfoConfigHw : NEO::HwInfoConfigHw<productFamily> {
using HwInfoConfig::getDefaultLocalMemoryAccessMode;
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override;
bool isCooperativeEngineSupported(const HardwareInfo &hwInfo) const override;
bool getUuid(Device *device, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) const override;
uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override;
int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) override;
bool use128MbEdram = false;
bool enableMidThreadPreemption = false;
bool enableThreadGroupPreemption = false;
bool enableMidBatchPreemption = false;
bool failOnConfigureHardwareCustom = false;
bool isCooperativeEngineSupportedValue = true;
uint32_t returnedStepping = 0;
std::vector<int32_t> threadArbPolicies = {};
};
} // namespace NEO

View File

@ -0,0 +1,48 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
template <>
std::vector<int32_t> MockHwInfoConfigHw<gfxProduct>::getKernelSupportedThreadArbitrationPolicies() {
return threadArbPolicies;
}
template <>
bool MockHwInfoConfigHw<gfxProduct>::isCooperativeEngineSupported(const HardwareInfo &hwInfo) const {
return isCooperativeEngineSupportedValue;
}
template <>
bool MockHwInfoConfigHw<gfxProduct>::getUuid(Device *device, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) const {
return false;
}
template <>
uint32_t MockHwInfoConfigHw<gfxProduct>::getSteppingFromHwRevId(const HardwareInfo &hwInfo) const {
return returnedStepping;
}
template <>
int MockHwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) {
FeatureTable *featureTable = &hwInfo->featureTable;
featureTable->flags.ftrGpGpuMidThreadLevelPreempt = 0;
featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = 0;
featureTable->flags.ftrGpGpuMidBatchPreempt = 0;
if (use128MbEdram) {
GT_SYSTEM_INFO *gtSystemInfo = &hwInfo->gtSystemInfo;
gtSystemInfo->EdramSizeInKb = 128 * 1000;
}
if (enableMidThreadPreemption) {
featureTable->flags.ftrGpGpuMidThreadLevelPreempt = 1;
}
if (enableThreadGroupPreemption) {
featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = 1;
}
if (enableMidBatchPreemption) {
featureTable->flags.ftrGpGpuMidBatchPreempt = 1;
}
return (failOnConfigureHardwareCustom) ? -1 : 0;
}

View File

@ -21,6 +21,10 @@ macro(macro_for_each_platform)
if(EXISTS ${SRC_FILE}) if(EXISTS ${SRC_FILE})
list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW ${SRC_FILE}) list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW ${SRC_FILE})
endif() endif()
set(SRC_FILE ${NEO_SHARED_TEST_DIRECTORY}/common${BRANCH_DIR}${CORE_TYPE_LOWER}${BRANCH}${PLATFORM_IT_LOWER}/mock_hw_info_config_${PLATFORM_IT_LOWER}.cpp)
if(EXISTS ${SRC_FILE})
list(APPEND neo_libult_common_SRCS_ENABLE_TESTED_HW ${SRC_FILE})
endif()
endforeach() endforeach()
endforeach() endforeach()
endmacro() endmacro()
@ -86,6 +90,8 @@ set(neo_libult_common_SRCS_LIB_ULT
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_leak_listener.h ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_leak_listener.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_management.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_management.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_management.h ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/memory_management.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/mock_hw_info_config_hw.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/mock_hw_info_config_hw.h
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/sip_init.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/sip_init.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.cpp ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.h ${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.h

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_XE_HP_SDV;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -1,15 +0,0 @@
#
# Copyright (C) 2021-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_XE_HP_SDV)
set(NEO_CORE_TESTS_XE_HP_CORE_XEHP
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xehp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xehp.cpp
)
target_sources(${TARGET_NAME} PRIVATE ${NEO_CORE_TESTS_XE_HP_CORE_XEHP})
endif()

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_PVC;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -0,0 +1,15 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
namespace NEO {
constexpr static auto gfxProduct = IGFX_DG2;
#include "shared/test/common/helpers/mock_hw_info_config_hw.inl"
template struct MockHwInfoConfigHw<gfxProduct>;
} // namespace NEO

View File

@ -8,6 +8,7 @@
#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/fixtures/device_fixture.h" #include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
#include "shared/test/common/helpers/ult_hw_config.h" #include "shared/test/common/helpers/ult_hw_config.h"
#include "shared/test/common/mocks/mock_device.h" #include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_driver_model.h" #include "shared/test/common/mocks/mock_driver_model.h"
@ -17,15 +18,6 @@
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
namespace NEO { namespace NEO {
template <PRODUCT_FAMILY gfxProduct>
class MockHwInfoConfigHw : public HwInfoConfigHw<gfxProduct> {
public:
bool getUuid(Device *device, std::array<uint8_t, HwInfoConfig::uuidSize> &uuid) const override {
return false;
}
};
struct MultipleDeviceBdfUuidTest : public ::testing::Test { struct MultipleDeviceBdfUuidTest : public ::testing::Test {
std::unique_ptr<UltDeviceFactory> createDevices(PhysicalDevicePciBusInfo &pciBusInfo, uint32_t numSubDevices) { std::unique_ptr<UltDeviceFactory> createDevices(PhysicalDevicePciBusInfo &pciBusInfo, uint32_t numSubDevices) {

View File

@ -11,6 +11,7 @@
#include "shared/source/helpers/hw_helper.h" #include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
#include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/helpers/unit_test_helper.h"
#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_gmm.h" #include "shared/test/common/mocks/mock_gmm.h"
@ -189,16 +190,7 @@ HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThe
} }
HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenGettingAubStreamSteppingFromHwRevIdThenReturnValuesAreCorrect) { HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenGettingAubStreamSteppingFromHwRevIdThenReturnValuesAreCorrect) {
struct MockHwInfoConfig : HwInfoConfigHw<IGFX_UNKNOWN> { MockHwInfoConfigHw<IGFX_UNKNOWN> mockHwInfoConfig;
uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override {
return returnedStepping;
}
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
return {};
}
uint32_t returnedStepping = 0;
};
MockHwInfoConfig mockHwInfoConfig;
mockHwInfoConfig.returnedStepping = REVISION_A0; mockHwInfoConfig.returnedStepping = REVISION_A0;
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo)); EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
mockHwInfoConfig.returnedStepping = REVISION_A1; mockHwInfoConfig.returnedStepping = REVISION_A1;

View File

@ -12,40 +12,11 @@
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h" #include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/hw_helper_tests.h" #include "shared/test/common/helpers/hw_helper_tests.h"
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
#include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/helpers/unit_test_helper.h"
#include <cstring> #include <cstring>
struct DummyHwConfig : NEO::HwInfoConfigHw<IGFX_UNKNOWN> {
int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) override {
FeatureTable *featureTable = &hwInfo->featureTable;
featureTable->flags.ftrGpGpuMidThreadLevelPreempt = 0;
featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = 0;
featureTable->flags.ftrGpGpuMidBatchPreempt = 0;
if (use128MbEdram) {
GT_SYSTEM_INFO *gtSystemInfo = &hwInfo->gtSystemInfo;
gtSystemInfo->EdramSizeInKb = 128 * 1000;
}
if (enableMidThreadPreemption) {
featureTable->flags.ftrGpGpuMidThreadLevelPreempt = 1;
}
if (enableThreadGroupPreemption) {
featureTable->flags.ftrGpGpuThreadGroupLevelPreempt = 1;
}
if (enableMidBatchPreemption) {
featureTable->flags.ftrGpGpuMidBatchPreempt = 1;
}
return (failOnConfigureHardwareCustom) ? -1 : 0;
}
bool use128MbEdram = false;
bool enableMidThreadPreemption = false;
bool enableThreadGroupPreemption = false;
bool enableMidBatchPreemption = false;
bool failOnConfigureHardwareCustom = false;
};
using namespace NEO; using namespace NEO;
struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux { struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux {
@ -60,7 +31,7 @@ struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux {
HwInfoConfigTestLinux::TearDown(); HwInfoConfigTestLinux::TearDown();
} }
VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast<size_t>(IGFX_UNKNOWN)]}; VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast<size_t>(IGFX_UNKNOWN)]};
DummyHwConfig hwConfig; MockHwInfoConfigHw<IGFX_UNKNOWN> hwConfig;
}; };
TEST_F(HwInfoConfigTestLinuxDummy, GivenDummyConfigWhenConfiguringHwInfoThenSucceeds) { TEST_F(HwInfoConfigTestLinuxDummy, GivenDummyConfigWhenConfiguringHwInfoThenSucceeds) {

View File

@ -8,6 +8,7 @@
#pragma once #pragma once
#include "shared/source/os_interface/hw_info_config.h" #include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
#include "shared/test/unit_test/os_interface/hw_info_config_tests.h" #include "shared/test/unit_test/os_interface/hw_info_config_tests.h"
#include <memory> #include <memory>
@ -17,9 +18,6 @@ namespace NEO {
struct MockExecutionEnvironment; struct MockExecutionEnvironment;
struct RootDeviceEnvironment; struct RootDeviceEnvironment;
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
};
struct HwInfoConfigTestWindows : public HwInfoConfigTest { struct HwInfoConfigTestWindows : public HwInfoConfigTest {
HwInfoConfigTestWindows(); HwInfoConfigTestWindows();
~HwInfoConfigTestWindows(); ~HwInfoConfigTestWindows();
@ -28,7 +26,7 @@ struct HwInfoConfigTestWindows : public HwInfoConfigTest {
void TearDown() override; void TearDown() override;
std::unique_ptr<OSInterface> osInterface; std::unique_ptr<OSInterface> osInterface;
DummyHwConfig hwConfig; MockHwInfoConfigHw<IGFX_UNKNOWN> hwConfig;
std::unique_ptr<MockExecutionEnvironment> executionEnvironment; std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment; std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
}; };

View File

@ -0,0 +1,17 @@
#
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_XE_HP_SDV)
set(NEO_CORE_TESTS_XE_HP_CORE_XE_HP_SDV
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xe_hp_sdv.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xe_hp_sdv.cpp
)
target_sources(${TARGET_NAME} PRIVATE ${NEO_CORE_TESTS_XE_HP_CORE_XE_HP_SDV})
add_subdirectories()
endif()

View File

@ -1,9 +0,0 @@
#
# Copyright (C) 2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_XE_HP_SDV)
add_subdirectories()
endif()