mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-10 15:12:56 +08:00
Add mock helper for hwInfoConfig
Signed-off-by: Katarzyna Cencelewska <katarzyna.cencelewska@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e75c313ce7
commit
b983ea120b
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/fixtures/device_fixture.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/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_driver_model.h"
|
||||
@@ -17,15 +18,6 @@
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
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 {
|
||||
|
||||
std::unique_ptr<UltDeviceFactory> createDevices(PhysicalDevicePciBusInfo &pciBusInfo, uint32_t numSubDevices) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/helpers/hw_helper.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/mock_hw_info_config_hw.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_gmm.h"
|
||||
@@ -189,16 +190,7 @@ HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenConvertingHwRevIdAndSteppingThe
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, givenVariousValuesWhenGettingAubStreamSteppingFromHwRevIdThenReturnValuesAreCorrect) {
|
||||
struct MockHwInfoConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
|
||||
uint32_t getSteppingFromHwRevId(const HardwareInfo &hwInfo) const override {
|
||||
return returnedStepping;
|
||||
}
|
||||
std::vector<int32_t> getKernelSupportedThreadArbitrationPolicies() override {
|
||||
return {};
|
||||
}
|
||||
uint32_t returnedStepping = 0;
|
||||
};
|
||||
MockHwInfoConfig mockHwInfoConfig;
|
||||
MockHwInfoConfigHw<IGFX_UNKNOWN> mockHwInfoConfig;
|
||||
mockHwInfoConfig.returnedStepping = REVISION_A0;
|
||||
EXPECT_EQ(AubMemDump::SteppingValues::A, mockHwInfoConfig.getAubStreamSteppingFromHwRevId(pInHwInfo));
|
||||
mockHwInfoConfig.returnedStepping = REVISION_A1;
|
||||
|
||||
@@ -12,40 +12,11 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.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 <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;
|
||||
|
||||
struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux {
|
||||
@@ -60,7 +31,7 @@ struct HwInfoConfigTestLinuxDummy : HwInfoConfigTestLinux {
|
||||
HwInfoConfigTestLinux::TearDown();
|
||||
}
|
||||
VariableBackup<HwInfoConfig *> hwInfoConfigFactoryBackup{&NEO::hwInfoConfigFactory[static_cast<size_t>(IGFX_UNKNOWN)]};
|
||||
DummyHwConfig hwConfig;
|
||||
MockHwInfoConfigHw<IGFX_UNKNOWN> hwConfig;
|
||||
};
|
||||
|
||||
TEST_F(HwInfoConfigTestLinuxDummy, GivenDummyConfigWhenConfiguringHwInfoThenSucceeds) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#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 <memory>
|
||||
@@ -17,9 +18,6 @@ namespace NEO {
|
||||
struct MockExecutionEnvironment;
|
||||
struct RootDeviceEnvironment;
|
||||
|
||||
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
|
||||
};
|
||||
|
||||
struct HwInfoConfigTestWindows : public HwInfoConfigTest {
|
||||
HwInfoConfigTestWindows();
|
||||
~HwInfoConfigTestWindows();
|
||||
@@ -28,7 +26,7 @@ struct HwInfoConfigTestWindows : public HwInfoConfigTest {
|
||||
void TearDown() override;
|
||||
|
||||
std::unique_ptr<OSInterface> osInterface;
|
||||
DummyHwConfig hwConfig;
|
||||
MockHwInfoConfigHw<IGFX_UNKNOWN> hwConfig;
|
||||
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user