mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 01:04:57 +08:00
Move ProductHelper ownership to RootDeviceEnvironment
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d7a78db328
commit
104126ddd7
@@ -272,7 +272,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
productFamily = hwInfoForTests.platform.eProductFamily;
|
||||
renderCoreFamily = hwInfoForTests.platform.eRenderCoreFamily;
|
||||
uint32_t threadsPerEu = productHelperFactory[productFamily]->threadsPerEu;
|
||||
|
||||
PLATFORM &platform = hwInfoForTests.platform;
|
||||
if (revId != -1) {
|
||||
platform.usRevId = revId;
|
||||
@@ -282,6 +282,9 @@ int main(int argc, char **argv) {
|
||||
uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily];
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, hwInfoForTests);
|
||||
|
||||
auto productHelper = ProductHelper::create(hwInfoForTests.platform.eProductFamily);
|
||||
uint32_t threadsPerEu = productHelper->threadsPerEu;
|
||||
|
||||
// set Gt and FeatureTable to initial state
|
||||
hardwareInfoSetup[productFamily](&hwInfoForTests, setupFeatureTableAndWorkaroundTable, hwInfoConfig);
|
||||
GT_SYSTEM_INFO >SystemInfo = hwInfoForTests.gtSystemInfo;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/source/indirect_heap/indirect_heap.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
|
||||
#include "shared/test/common/helpers/raii_hw_info_config.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_helper.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
@@ -541,11 +542,9 @@ HWTEST2_F(L0DebuggerSimpleTest, givenUseCsrImmediateSubmissionDisabledCommandLis
|
||||
HWTEST2_F(L0DebuggerTest, givenDebuggerEnabledAndL1CachePolicyWBWhenAppendingThenDebugSurfaceHasCachePolicyWBP, IsAtLeastXeHpgCore) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
|
||||
MockProductHelperHw<productFamily> productHelper;
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
productHelper.returnedL1CachePolicy = RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB;
|
||||
productHelper.returnedL1CachePolicyIfDebugger = RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP;
|
||||
NEO::RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->returnedL1CachePolicy = RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB;
|
||||
raii.mockProductHelper->returnedL1CachePolicyIfDebugger = RENDER_SURFACE_STATE::L1_CACHE_POLICY_WBP;
|
||||
|
||||
Mock<::L0::Kernel> kernel;
|
||||
ze_result_t returnValue;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
||||
#include "shared/test/common/helpers/mock_hw_info_config_hw.h"
|
||||
#include "shared/test/common/helpers/raii_gfx_core_helper.h"
|
||||
#include "shared/test/common/helpers/raii_hw_info_config.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_device.h"
|
||||
@@ -936,12 +937,10 @@ HWTEST2_F(DeviceTest, givenAllThreadArbitrationPoliciesWhenPassingSchedulingHint
|
||||
|
||||
Mock<L0::DeviceImp> deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
MockProductHelperHw<productFamily> productHelper;
|
||||
productHelper.threadArbPolicies = {ThreadArbitrationPolicy::AgeBased,
|
||||
ThreadArbitrationPolicy::RoundRobin,
|
||||
ThreadArbitrationPolicy::RoundRobinAfterDependency};
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
NEO::RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*neoMockDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->threadArbPolicies = {ThreadArbitrationPolicy::AgeBased,
|
||||
ThreadArbitrationPolicy::RoundRobin,
|
||||
ThreadArbitrationPolicy::RoundRobinAfterDependency};
|
||||
|
||||
ze_device_module_properties_t kernelProperties = {};
|
||||
kernelProperties.stype = ZE_STRUCTURE_TYPE_KERNEL_PROPERTIES;
|
||||
@@ -969,10 +968,8 @@ HWTEST2_F(DeviceTest, givenIncorrectThreadArbitrationPolicyWhenPassingScheduling
|
||||
|
||||
Mock<L0::DeviceImp> deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment());
|
||||
|
||||
MockProductHelperHw<productFamily> productHelper;
|
||||
productHelper.threadArbPolicies = {ThreadArbitrationPolicy::NotPresent};
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
NEO::RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*neoMockDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->threadArbPolicies = {ThreadArbitrationPolicy::NotPresent};
|
||||
|
||||
ze_device_module_properties_t kernelProperties = {};
|
||||
kernelProperties.stype = ZE_STRUCTURE_TYPE_KERNEL_PROPERTIES;
|
||||
@@ -1709,11 +1706,8 @@ HWTEST2_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesForMemoryExtProper
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
MockProductHelperHw<productFamily> productHelper;
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
|
||||
NEO::RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*this->neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
auto &productHelper = device->getProductHelper();
|
||||
ze_device_memory_properties_t memProperties = {};
|
||||
ze_device_memory_ext_properties_t memExtProperties = {};
|
||||
memExtProperties.stype = ZE_STRUCTURE_TYPE_DEVICE_MEMORY_EXT_PROPERTIES;
|
||||
@@ -1729,6 +1723,7 @@ HWTEST2_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesForMemoryExtProper
|
||||
ZE_DEVICE_MEMORY_EXT_TYPE_GDDR6,
|
||||
};
|
||||
|
||||
auto &hwInfo = device->getHwInfo();
|
||||
auto bandwidthPerNanoSecond = productHelper.getDeviceMemoryMaxBandWidthInBytesPerSecond(hwInfo, nullptr, 0) / 1000000000;
|
||||
|
||||
EXPECT_EQ(memExtProperties.type, sysInfoMemType[hwInfo.gtSystemInfo.MemoryType]);
|
||||
@@ -1744,11 +1739,8 @@ HWTEST2_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesWith2LevelsOfPnext
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
auto hwInfo = *NEO::defaultHwInfo;
|
||||
MockProductHelperHw<productFamily> productHelper;
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
|
||||
NEO::RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
auto &productHelper = device->getProductHelper();
|
||||
ze_device_memory_properties_t memProperties = {};
|
||||
ze_base_properties_t baseProperties{};
|
||||
ze_device_memory_ext_properties_t memExtProperties = {};
|
||||
@@ -1769,6 +1761,7 @@ HWTEST2_F(DeviceGetMemoryTests, whenCallingGetMemoryPropertiesWith2LevelsOfPnext
|
||||
ZE_DEVICE_MEMORY_EXT_TYPE_GDDR6,
|
||||
};
|
||||
|
||||
auto &hwInfo = device->getHwInfo();
|
||||
auto bandwidthPerNanoSecond = productHelper.getDeviceMemoryMaxBandWidthInBytesPerSecond(hwInfo, nullptr, 0) / 1000000000;
|
||||
|
||||
EXPECT_EQ(memExtProperties.type, sysInfoMemType[hwInfo.gtSystemInfo.MemoryType]);
|
||||
@@ -2140,9 +2133,7 @@ HWTEST2_F(MultipleDevicesEnabledImplicitScalingTest, GivenImplicitScalingEnabled
|
||||
EXPECT_EQ(res, ZE_RESULT_SUCCESS);
|
||||
EXPECT_EQ(1u, count);
|
||||
|
||||
MockProductHelperHw<productFamily> productHelper;
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
NEO::RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
|
||||
ze_device_memory_properties_t memProperties = {};
|
||||
ze_device_memory_ext_properties_t memExtProperties = {};
|
||||
@@ -2159,10 +2150,10 @@ HWTEST2_F(MultipleDevicesEnabledImplicitScalingTest, GivenImplicitScalingEnabled
|
||||
ZE_DEVICE_MEMORY_EXT_TYPE_GDDR6,
|
||||
};
|
||||
|
||||
auto bandwidthPerNanoSecond = productHelper.getDeviceMemoryMaxBandWidthInBytesPerSecond(hwInfo, nullptr, 0) / 1000000000;
|
||||
auto bandwidthPerNanoSecond = raii.mockProductHelper->getDeviceMemoryMaxBandWidthInBytesPerSecond(device->getHwInfo(), nullptr, 0) / 1000000000;
|
||||
|
||||
EXPECT_EQ(memExtProperties.type, sysInfoMemType[hwInfo.gtSystemInfo.MemoryType]);
|
||||
EXPECT_EQ(memExtProperties.physicalSize, productHelper.getDeviceMemoryPhysicalSizeInBytes(nullptr, 0) * numSubDevices);
|
||||
EXPECT_EQ(memExtProperties.physicalSize, raii.mockProductHelper->getDeviceMemoryPhysicalSizeInBytes(nullptr, 0) * numSubDevices);
|
||||
EXPECT_EQ(memExtProperties.readBandwidth, bandwidthPerNanoSecond * numSubDevices);
|
||||
EXPECT_EQ(memExtProperties.writeBandwidth, memExtProperties.readBandwidth);
|
||||
EXPECT_EQ(memExtProperties.bandwidthUnit, ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC);
|
||||
@@ -3520,8 +3511,9 @@ struct MultipleDevicesDifferentLocalMemorySupportTest : public MultipleDevicesTe
|
||||
|
||||
struct MultipleDevicesDifferentFamilyAndLocalMemorySupportTest : public MultipleDevicesTest {
|
||||
void SetUp() override {
|
||||
if ((NEO::ProductHelper::get(IGFX_SKYLAKE) == nullptr) ||
|
||||
(NEO::ProductHelper::get(IGFX_KABYLAKE) == nullptr)) {
|
||||
|
||||
if ((NEO::ProductHelper::create(IGFX_SKYLAKE) == nullptr) ||
|
||||
(NEO::ProductHelper::create(IGFX_KABYLAKE) == nullptr)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -16,7 +16,8 @@ using namespace NEO;
|
||||
typedef api_tests clGetPlatformIDsTests;
|
||||
|
||||
TEST(clGetPlatformIDsMultiPlatformTest, whenCreateDevicesWithDifferentProductFamilyThenClGetPlatformIdsCreatesMultiplePlatformsProperlySorted) {
|
||||
if ((ProductHelper::get(IGFX_SKYLAKE) == nullptr) || (ProductHelper::get(IGFX_KABYLAKE) == nullptr)) {
|
||||
|
||||
if ((ProductHelper::create(IGFX_SKYLAKE) == nullptr) || (ProductHelper::create(IGFX_KABYLAKE) == nullptr)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
DebugManagerStateRestore restorer;
|
||||
|
||||
@@ -273,7 +273,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
productFamily = hwInfoForTests.platform.eProductFamily;
|
||||
renderCoreFamily = hwInfoForTests.platform.eRenderCoreFamily;
|
||||
uint32_t threadsPerEu = ProductHelper::get(productFamily)->threadsPerEu;
|
||||
PLATFORM &platform = hwInfoForTests.platform;
|
||||
if (revId != -1) {
|
||||
platform.usRevId = revId;
|
||||
@@ -283,6 +282,9 @@ int main(int argc, char **argv) {
|
||||
uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily];
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, hwInfoForTests);
|
||||
|
||||
auto productHelper = ProductHelper::create(hwInfoForTests.platform.eProductFamily);
|
||||
uint32_t threadsPerEu = productHelper->threadsPerEu;
|
||||
|
||||
// set Gt and FeatureTable to initial state
|
||||
hardwareInfoSetup[productFamily](&hwInfoForTests, setupFeatureTableAndWorkaroundTable, hwInfoConfig);
|
||||
GT_SYSTEM_INFO >SystemInfo = hwInfoForTests.gtSystemInfo;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -129,7 +129,7 @@ HWTEST_F(UnifiedSharingImageTestsWithMemoryManager, givenCompressedImageAndNoPag
|
||||
MemoryManagerReturningCompressedAllocations memoryManager{};
|
||||
VariableBackup<MemoryManager *> memoryManagerBackup{&this->context->memoryManager, &memoryManager};
|
||||
using ProductHelperNotSupportingPageTableManager = MockProductHelper<false>;
|
||||
RAIIProductHelperFactory<ProductHelperNotSupportingPageTableManager> productHelperBackup{this->context->getDevice(0)->getHardwareInfo().platform.eProductFamily};
|
||||
RAIIProductHelperFactory<ProductHelperNotSupportingPageTableManager> productHelperBackup{*this->context->getDevice(0)->getExecutionEnvironment()->rootDeviceEnvironments[0]};
|
||||
|
||||
cl_mem_flags flags{};
|
||||
cl_int retVal{};
|
||||
@@ -146,7 +146,7 @@ HWTEST_F(UnifiedSharingImageTestsWithMemoryManager, givenCompressedImageAndPageT
|
||||
MemoryManagerReturningCompressedAllocations memoryManager{};
|
||||
VariableBackup<MemoryManager *> memoryManagerBackup{&this->context->memoryManager, &memoryManager};
|
||||
using ProductHelperNotSupportingPageTableManager = MockProductHelper<true>;
|
||||
RAIIProductHelperFactory<ProductHelperNotSupportingPageTableManager> productHelperBackup{this->context->getDevice(0)->getHardwareInfo().platform.eProductFamily};
|
||||
RAIIProductHelperFactory<ProductHelperNotSupportingPageTableManager> productHelperBackup{*this->context->getDevice(0)->getExecutionEnvironment()->rootDeviceEnvironments[0]};
|
||||
|
||||
cl_mem_flags flags{};
|
||||
cl_int retVal{};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -45,10 +45,12 @@ HWTEST_F(PrepareDeviceEnvironmentsTests, givenRcsAndCcsNotSupportedWhenInitializ
|
||||
REQUIRE_64BIT_OR_SKIP();
|
||||
|
||||
NEO::ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1u);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
||||
auto &productHelper = executionEnvironment.rootDeviceEnvironments[0]->getProductHelper();
|
||||
|
||||
auto productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
productHelper->configureHardwareCustom(&hwInfo, nullptr);
|
||||
productHelper.configureHardwareCustom(&hwInfo, nullptr);
|
||||
|
||||
bool expectedValue = false;
|
||||
if (hwInfo.featureTable.flags.ftrRcsNode || hwInfo.featureTable.flags.ftrCCSNode) {
|
||||
|
||||
@@ -133,8 +133,7 @@ BindlessHeapsHelper *RootDeviceEnvironment::getBindlessHeapsHelper() const {
|
||||
}
|
||||
|
||||
const ProductHelper &RootDeviceEnvironment::getProductHelper() const {
|
||||
auto &productHelper = *ProductHelper::get(this->getHardwareInfo()->platform.eProductFamily);
|
||||
return productHelper;
|
||||
return *productHelper;
|
||||
}
|
||||
|
||||
void RootDeviceEnvironment::createBindlessHeapsHelper(MemoryManager *memoryManager, bool availableDevices, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield) {
|
||||
@@ -153,6 +152,7 @@ CompilerInterface *RootDeviceEnvironment::getCompilerInterface() {
|
||||
}
|
||||
|
||||
void RootDeviceEnvironment::initHelpers() {
|
||||
initProductHelper();
|
||||
initGfxCoreHelper();
|
||||
initApiGfxCoreHelper();
|
||||
}
|
||||
@@ -162,6 +162,11 @@ void RootDeviceEnvironment::initGfxCoreHelper() {
|
||||
gfxCoreHelper = GfxCoreHelper::create(this->getHardwareInfo()->platform.eRenderCoreFamily);
|
||||
}
|
||||
}
|
||||
void RootDeviceEnvironment::initProductHelper() {
|
||||
if (productHelper == nullptr) {
|
||||
productHelper = ProductHelper::create(this->getHardwareInfo()->platform.eProductFamily);
|
||||
}
|
||||
}
|
||||
|
||||
BuiltIns *RootDeviceEnvironment::getBuiltIns() {
|
||||
if (this->builtins.get() == nullptr) {
|
||||
@@ -189,8 +194,8 @@ HelperType &RootDeviceEnvironment::getHelper() const {
|
||||
auto &compilerProductHelper = *CompilerProductHelper::get(this->getHardwareInfo()->platform.eProductFamily);
|
||||
return compilerProductHelper;
|
||||
} else if constexpr (std::is_same_v<HelperType, ProductHelper>) {
|
||||
auto &productHelper = *ProductHelper::get(this->getHardwareInfo()->platform.eProductFamily);
|
||||
return productHelper;
|
||||
UNRECOVERABLE_IF(productHelper == nullptr);
|
||||
return *productHelper;
|
||||
} else {
|
||||
static_assert(std::is_same_v<HelperType, GfxCoreHelper>, "Only CompilerProductHelper, ProductHelper and GfxCoreHelper are supported");
|
||||
UNRECOVERABLE_IF(gfxCoreHelper == nullptr);
|
||||
|
||||
@@ -68,7 +68,7 @@ struct RootDeviceEnvironment {
|
||||
void createBindlessHeapsHelper(MemoryManager *memoryManager, bool availableDevices, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield);
|
||||
void limitNumberOfCcs(uint32_t numberOfCcs);
|
||||
bool isNumberOfCcsLimited() const;
|
||||
|
||||
void initProductHelper();
|
||||
void initHelpers();
|
||||
void initGfxCoreHelper();
|
||||
void initApiGfxCoreHelper();
|
||||
@@ -90,6 +90,7 @@ struct RootDeviceEnvironment {
|
||||
std::unique_ptr<SWTagsManager> tagsManager;
|
||||
std::unique_ptr<ApiGfxCoreHelper> apiGfxCoreHelper;
|
||||
std::unique_ptr<GfxCoreHelper> gfxCoreHelper;
|
||||
std::unique_ptr<ProductHelper> productHelper;
|
||||
|
||||
ExecutionEnvironment &executionEnvironment;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -9,6 +9,6 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
ProductHelper *productHelperFactory[IGFX_MAX_PRODUCT] = {};
|
||||
ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT] = {};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
namespace AOT {
|
||||
@@ -37,7 +38,8 @@ class OSInterface;
|
||||
enum class DriverModelType;
|
||||
enum class AllocationType;
|
||||
|
||||
extern ProductHelper *productHelperFactory[IGFX_MAX_PRODUCT];
|
||||
using ProductHelperCreateFunctionType = std::unique_ptr<ProductHelper> (*)();
|
||||
extern ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT];
|
||||
|
||||
enum class UsmAccessCapabilities {
|
||||
Host = 0,
|
||||
@@ -49,9 +51,12 @@ enum class UsmAccessCapabilities {
|
||||
|
||||
class ProductHelper {
|
||||
public:
|
||||
static ProductHelper *get(PRODUCT_FAMILY product) {
|
||||
return productHelperFactory[product];
|
||||
static std::unique_ptr<ProductHelper> create(PRODUCT_FAMILY product) {
|
||||
auto productHelperCreateFunction = productHelperFactory[product];
|
||||
auto productHelper = productHelperCreateFunction();
|
||||
return productHelper;
|
||||
}
|
||||
|
||||
static constexpr uint32_t uuidSize = 16u;
|
||||
static constexpr uint32_t luidSize = 8u;
|
||||
int configureHwInfoWddm(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
@@ -188,9 +193,11 @@ class ProductHelper {
|
||||
|
||||
virtual bool isMultiContextResourceDeferDeletionSupported() const = 0;
|
||||
|
||||
MOCKABLE_VIRTUAL ~ProductHelper() = default;
|
||||
virtual ~ProductHelper() = default;
|
||||
|
||||
protected:
|
||||
ProductHelper() = default;
|
||||
|
||||
virtual LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual void fillScmPropertiesSupportStructureBase(StateComputeModePropertiesSupport &propertiesSupport) const = 0;
|
||||
|
||||
@@ -201,10 +208,15 @@ class ProductHelper {
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
class ProductHelperHw : public ProductHelper {
|
||||
public:
|
||||
static ProductHelper *get() {
|
||||
static ProductHelperHw<gfxProduct> instance;
|
||||
return &instance;
|
||||
static std::unique_ptr<ProductHelper> create() {
|
||||
auto productHelper = std::unique_ptr<ProductHelper>(new ProductHelperHw());
|
||||
|
||||
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;
|
||||
productHelper->threadsPerEu = GfxProduct::threadsPerEu;
|
||||
|
||||
return productHelper;
|
||||
}
|
||||
|
||||
int configureHardwareCustom(HardwareInfo *hwInfo, OSInterface *osIface) const override;
|
||||
void adjustPlatformForProductFamily(HardwareInfo *hwInfo) override;
|
||||
void adjustSamplerState(void *sampler, const HardwareInfo &hwInfo) const override;
|
||||
@@ -337,6 +349,8 @@ class ProductHelperHw : public ProductHelper {
|
||||
|
||||
bool isMultiContextResourceDeferDeletionSupported() const override;
|
||||
|
||||
~ProductHelperHw() override = default;
|
||||
|
||||
protected:
|
||||
ProductHelperHw() = default;
|
||||
|
||||
@@ -351,12 +365,12 @@ class ProductHelperHw : public ProductHelper {
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
struct EnableProductProductHelper {
|
||||
typedef typename HwMapper<gfxProduct>::GfxProduct GfxProduct;
|
||||
|
||||
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;
|
||||
|
||||
EnableProductProductHelper() {
|
||||
ProductHelper *pProductHelper = ProductHelperHw<gfxProduct>::get();
|
||||
productHelperFactory[gfxProduct] = pProductHelper;
|
||||
pProductHelper->threadsPerEu = GfxProduct::threadsPerEu;
|
||||
auto productHelperCreateFunction = ProductHelperHw<gfxProduct>::create;
|
||||
productHelperFactory[gfxProduct] = productHelperCreateFunction;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -101,9 +101,11 @@ bool Wddm::init() {
|
||||
hardwareInfo->capabilityTable.instrumentationEnabled =
|
||||
(hardwareInfo->capabilityTable.instrumentationEnabled && instrumentationEnabled);
|
||||
|
||||
rootDeviceEnvironment.initProductHelper();
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
productHelper.adjustPlatformForProductFamily(hardwareInfo);
|
||||
rootDeviceEnvironment.initHelpers();
|
||||
rootDeviceEnvironment.initApiGfxCoreHelper();
|
||||
rootDeviceEnvironment.initGfxCoreHelper();
|
||||
|
||||
if (productHelper.configureHwInfoWddm(hardwareInfo, hardwareInfo, rootDeviceEnvironment)) {
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,26 +7,43 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
|
||||
namespace NEO {
|
||||
extern ProductHelper *productHelperFactory[IGFX_MAX_PRODUCT];
|
||||
extern ProductHelperCreateFunctionType productHelperFactory[IGFX_MAX_PRODUCT];
|
||||
|
||||
template <typename MockProductHelper>
|
||||
class RAIIProductHelperFactory {
|
||||
public:
|
||||
PRODUCT_FAMILY productFamily;
|
||||
ProductHelper *productHelper;
|
||||
MockProductHelper mockProductHelper{};
|
||||
|
||||
RAIIProductHelperFactory(PRODUCT_FAMILY productFamily) {
|
||||
this->productFamily = productFamily;
|
||||
productHelper = productHelperFactory[this->productFamily];
|
||||
productHelperFactory[this->productFamily] = &mockProductHelper;
|
||||
ProductHelperCreateFunctionType createProductHelper;
|
||||
std::unique_ptr<ProductHelper> productHelperBackup;
|
||||
MockProductHelper *mockProductHelper;
|
||||
RootDeviceEnvironment &rootDeviceEnvironment;
|
||||
|
||||
static std::unique_ptr<ProductHelper> create() {
|
||||
|
||||
return std::unique_ptr<ProductHelper>(new MockProductHelper());
|
||||
}
|
||||
|
||||
ProductHelperCreateFunctionType createMockProductHelper = create;
|
||||
|
||||
RAIIProductHelperFactory(RootDeviceEnvironment &rootDeviceEnvironment) : rootDeviceEnvironment(rootDeviceEnvironment) {
|
||||
|
||||
this->productFamily = rootDeviceEnvironment.getHardwareInfo()->platform.eProductFamily;
|
||||
createProductHelper = productHelperFactory[productFamily];
|
||||
productHelperFactory[productFamily] = createMockProductHelper;
|
||||
productHelperBackup = createMockProductHelper();
|
||||
rootDeviceEnvironment.productHelper.swap(productHelperBackup);
|
||||
mockProductHelper = static_cast<MockProductHelper *>(rootDeviceEnvironment.productHelper.get());
|
||||
}
|
||||
|
||||
~RAIIProductHelperFactory() {
|
||||
productHelperFactory[this->productFamily] = productHelper;
|
||||
productHelperFactory[productFamily] = createProductHelper;
|
||||
rootDeviceEnvironment.productHelper.swap(productHelperBackup);
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
@@ -432,6 +432,8 @@ struct UnknownProduct {
|
||||
static constexpr bool stateSip = false;
|
||||
static constexpr bool csrSurface = false;
|
||||
};
|
||||
|
||||
static const uint32_t threadsPerEu = 8;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -22,10 +22,10 @@ struct ProductConfigTest : public T {
|
||||
void SetUp() override {
|
||||
T::SetUp();
|
||||
hwInfo = *NEO::defaultHwInfo;
|
||||
productHelper = NEO::ProductHelper::get(productFamily);
|
||||
productHelper = NEO::ProductHelper::create(productFamily);
|
||||
}
|
||||
|
||||
NEO::ProductHelper *productHelper = nullptr;
|
||||
std::unique_ptr<NEO::ProductHelper> productHelper = nullptr;
|
||||
NEO::HardwareInfo hwInfo = {};
|
||||
AOT::PRODUCT_CONFIG productConfig = AOT::UNKNOWN_ISA;
|
||||
};
|
||||
|
||||
@@ -196,7 +196,7 @@ TYPED_TEST(SklHwInfoTests, givenGTSystemInfoTypeWhenConfigureHardwareCustomThenS
|
||||
TypeParam::setupHardwareInfo(&hwInfo, false);
|
||||
auto sliceCount = gtSystemInfo.SliceCount;
|
||||
|
||||
ProductHelper *productHelper = ProductHelper::get(PRODUCT_FAMILY::IGFX_SKYLAKE);
|
||||
auto productHelper = ProductHelper::create(PRODUCT_FAMILY::IGFX_SKYLAKE);
|
||||
|
||||
productHelper->configureHardwareCustom(&hwInfo, osInterface.get());
|
||||
EXPECT_EQ(gtSystemInfo.SliceCount, sliceCount);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.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/raii_hw_info_config.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
@@ -139,17 +140,13 @@ HWTEST2_F(GfxCoreHelperTestPvcAndLater, WhenIsCooperativeDispatchSupportedThenCo
|
||||
bool isRcsAvailableValue = true;
|
||||
};
|
||||
|
||||
MockProductHelperHw<productFamily> productHelper;
|
||||
MockExecutionEnvironment mockExecutionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *mockExecutionEnvironment.rootDeviceEnvironments[0];
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(hwInfo.platform.eProductFamily)]};
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
|
||||
RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(rootDeviceEnvironment);
|
||||
MockGfxCoreHelper gfxCoreHelper{};
|
||||
|
||||
for (auto isCooperativeEngineSupported : ::testing::Bool()) {
|
||||
productHelper.isCooperativeEngineSupportedValue = isCooperativeEngineSupported;
|
||||
raii.mockProductHelper->isCooperativeEngineSupportedValue = isCooperativeEngineSupported;
|
||||
for (auto isRcsAvailable : ::testing::Bool()) {
|
||||
gfxCoreHelper.isRcsAvailableValue = isRcsAvailable;
|
||||
for (auto engineGroupType : {EngineGroupType::RenderCompute, EngineGroupType::Compute,
|
||||
|
||||
@@ -267,7 +267,6 @@ int main(int argc, char **argv) {
|
||||
|
||||
productFamily = hwInfoForTests.platform.eProductFamily;
|
||||
renderCoreFamily = hwInfoForTests.platform.eRenderCoreFamily;
|
||||
uint32_t threadsPerEu = productHelperFactory[productFamily]->threadsPerEu;
|
||||
PLATFORM &platform = hwInfoForTests.platform;
|
||||
if (revId != -1) {
|
||||
platform.usRevId = revId;
|
||||
@@ -278,6 +277,9 @@ int main(int argc, char **argv) {
|
||||
uint64_t hwInfoConfig = defaultHardwareInfoConfigTable[productFamily];
|
||||
setHwInfoValuesFromConfig(hwInfoConfig, hwInfoForTests);
|
||||
|
||||
auto productHelper = ProductHelper::create(hwInfoForTests.platform.eProductFamily);
|
||||
uint32_t threadsPerEu = productHelper->threadsPerEu;
|
||||
|
||||
// set Gt and FeatureTable to initial state
|
||||
hardwareInfoSetup[productFamily](&hwInfoForTests, setupFeatureTableAndWorkaroundTable, hwInfoConfig);
|
||||
GT_SYSTEM_INFO >SystemInfo = hwInfoForTests.gtSystemInfo;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#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/raii_hw_info_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_driver_model.h"
|
||||
@@ -21,33 +22,28 @@
|
||||
namespace NEO {
|
||||
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, MockExecutionEnvironment *executionEnvironment) {
|
||||
std::unique_ptr<MockDriverModel> mockDriverModel = std::make_unique<MockDriverModel>();
|
||||
mockDriverModel->pciBusInfo = pciBusInfo;
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(numSubDevices);
|
||||
ExecutionEnvironment *executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), false, 1);
|
||||
executionEnvironment->parseAffinityMask();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface.reset(new OSInterface);
|
||||
executionEnvironment->memoryManager.reset(new MockMemoryManagerOsAgnosticContext(*executionEnvironment));
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::move(mockDriverModel));
|
||||
return std::make_unique<UltDeviceFactory>(1, numSubDevices, *executionEnvironment);
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
void setupMockProductHelper() {
|
||||
mockProductHelper.reset(new MockProductHelperHw<gfxProduct>());
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
std::unique_ptr<ProductHelper> mockProductHelper = nullptr;
|
||||
};
|
||||
|
||||
HWTEST2_F(MultipleDeviceBdfUuidTest, GivenValidBdfWithCombinationOfAffinityMaskThenUuidIsCorrectForRootAndSubDevices, MatchAny) {
|
||||
setupMockProductHelper<productFamily>();
|
||||
VariableBackup<ProductHelper *> backupProductHelper(&productHelperFactory[productFamily], mockProductHelper.get());
|
||||
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory;
|
||||
auto mockExecutionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get(), false, 1);
|
||||
RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*mockExecutionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
DebugManager.flags.ZE_AFFINITY_MASK.set("0.0,0.2,0.3");
|
||||
PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd);
|
||||
const auto deviceFactory = createDevices(pciBusInfo, 4);
|
||||
deviceFactory = createDevices(pciBusInfo, 4, mockExecutionEnvironment.release());
|
||||
|
||||
std::array<uint8_t, NEO::ProductHelper::uuidSize> uuid;
|
||||
uint8_t expectedUuid[NEO::ProductHelper::uuidSize] = {};
|
||||
@@ -92,14 +88,15 @@ HWTEST2_F(MultipleDeviceBdfUuidTest, GivenValidBdfWithCombinationOfAffinityMaskT
|
||||
|
||||
HWTEST2_F(MultipleDeviceBdfUuidTest, GivenDefaultAffinityMaskWhenRetrievingDeviceUuidFromBdfThenCorrectUuidIsRetrieved, MatchAny) {
|
||||
|
||||
setupMockProductHelper<productFamily>();
|
||||
VariableBackup<ProductHelper *> backupProductHelper(&productHelperFactory[productFamily], mockProductHelper.get());
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory;
|
||||
auto mockExecutionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get(), false, 1);
|
||||
RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*mockExecutionEnvironment->rootDeviceEnvironments[0]);
|
||||
std::array<uint8_t, 16> uuid;
|
||||
const uint32_t numSubDevices = 2;
|
||||
uint8_t expectedUuid[NEO::ProductHelper::uuidSize] = {};
|
||||
DebugManager.flags.ZE_AFFINITY_MASK.set("default");
|
||||
PhysicalDevicePciBusInfo pciBusInfo(0x54ad, 0x34, 0xab, 0xcd);
|
||||
const auto deviceFactory = createDevices(pciBusInfo, numSubDevices);
|
||||
deviceFactory = createDevices(pciBusInfo, numSubDevices, mockExecutionEnvironment.release());
|
||||
|
||||
uint16_t vendorId = 0x8086; // Intel
|
||||
uint16_t deviceId = static_cast<uint16_t>(deviceFactory->rootDevices[0]->getHardwareInfo().platform.usDeviceID);
|
||||
@@ -130,29 +127,30 @@ HWTEST2_F(MultipleDeviceBdfUuidTest, GivenDefaultAffinityMaskWhenRetrievingDevic
|
||||
|
||||
HWTEST2_F(MultipleDeviceBdfUuidTest, GivenIncorrectBdfWhenRetrievingDeviceUuidFromBdfThenUuidIsNotRetrieved, MatchAny) {
|
||||
|
||||
setupMockProductHelper<productFamily>();
|
||||
VariableBackup<ProductHelper *> backupProductHelper(&productHelperFactory[productFamily], mockProductHelper.get());
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory;
|
||||
auto mockExecutionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get(), false, 1);
|
||||
RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*mockExecutionEnvironment->rootDeviceEnvironments[0]);
|
||||
PhysicalDevicePciBusInfo pciBusInfo(PhysicalDevicePciBusInfo::invalidValue,
|
||||
PhysicalDevicePciBusInfo::invalidValue,
|
||||
PhysicalDevicePciBusInfo::invalidValue,
|
||||
PhysicalDevicePciBusInfo::invalidValue);
|
||||
const auto deviceFactory = createDevices(pciBusInfo, 2);
|
||||
deviceFactory = createDevices(pciBusInfo, 2, mockExecutionEnvironment.release());
|
||||
|
||||
std::array<uint8_t, 16> uuid;
|
||||
EXPECT_EQ(false, deviceFactory->rootDevices[0]->getUuid(uuid));
|
||||
}
|
||||
|
||||
HWTEST2_F(MultipleDeviceBdfUuidTest, GivenNoSubDevicesInAffinityMaskwhenRetrievingDeviceUuidFromBdfThenUuidOfRootDeviceIsRetrieved, MatchAny) {
|
||||
|
||||
setupMockProductHelper<productFamily>();
|
||||
VariableBackup<ProductHelper *> backupProductHelper(&productHelperFactory[productFamily], mockProductHelper.get());
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory;
|
||||
auto mockExecutionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get(), false, 1);
|
||||
RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*mockExecutionEnvironment->rootDeviceEnvironments[0]);
|
||||
std::array<uint8_t, NEO::ProductHelper::uuidSize> uuid{};
|
||||
uint8_t expectedUuid[NEO::ProductHelper::uuidSize] = {};
|
||||
|
||||
PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd);
|
||||
|
||||
DebugManager.flags.ZE_AFFINITY_MASK.set("0");
|
||||
const auto deviceFactory = createDevices(pciBusInfo, 2);
|
||||
deviceFactory = createDevices(pciBusInfo, 2, mockExecutionEnvironment.release());
|
||||
|
||||
uint16_t vendorId = 0x8086; // Intel
|
||||
uint16_t deviceId = static_cast<uint16_t>(deviceFactory->rootDevices[0]->getHardwareInfo().platform.usDeviceID);
|
||||
@@ -176,11 +174,12 @@ HWTEST2_F(MultipleDeviceBdfUuidTest, GivenNoSubDevicesInAffinityMaskwhenRetrievi
|
||||
|
||||
HWTEST2_F(MultipleDeviceBdfUuidTest, GivenValidBdfWithOneBitEnabledInAffinityMaskThenUuidOfRootDeviceIsBasedOnAffinityMask, MatchAny) {
|
||||
|
||||
setupMockProductHelper<productFamily>();
|
||||
VariableBackup<ProductHelper *> backupProductHelper(&productHelperFactory[productFamily], mockProductHelper.get());
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory;
|
||||
auto mockExecutionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get(), false, 1);
|
||||
RAIIProductHelperFactory<MockProductHelperHw<productFamily>> raii(*mockExecutionEnvironment->rootDeviceEnvironments[0]);
|
||||
DebugManager.flags.ZE_AFFINITY_MASK.set("0.3");
|
||||
PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd);
|
||||
const auto deviceFactory = createDevices(pciBusInfo, 4);
|
||||
deviceFactory = createDevices(pciBusInfo, 4, mockExecutionEnvironment.release());
|
||||
|
||||
std::array<uint8_t, NEO::ProductHelper::uuidSize> uuid;
|
||||
uint8_t expectedUuid[NEO::ProductHelper::uuidSize] = {};
|
||||
@@ -211,8 +210,8 @@ using DeviceUuidEnablementTest = MultipleDeviceBdfUuidTest;
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
class MockProductHelperHwUuidEnablementTest : public ProductHelperHw<gfxProduct> {
|
||||
public:
|
||||
const bool returnStatus;
|
||||
MockProductHelperHwUuidEnablementTest(bool returnStatus) : returnStatus(returnStatus) {}
|
||||
bool returnStatus;
|
||||
MockProductHelperHwUuidEnablementTest() {}
|
||||
bool getUuid(Device *device, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const override {
|
||||
uuid.fill(255u);
|
||||
return returnStatus;
|
||||
@@ -221,14 +220,17 @@ class MockProductHelperHwUuidEnablementTest : public ProductHelperHw<gfxProduct>
|
||||
|
||||
HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDefaultWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIstUsed, MatchAny) {
|
||||
|
||||
mockProductHelper.reset(new MockProductHelperHwUuidEnablementTest<productFamily>(true));
|
||||
VariableBackup<ProductHelper *> backupProductHelper(&productHelperFactory[productFamily], mockProductHelper.get());
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory;
|
||||
auto mockExecutionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get(), false, 1);
|
||||
RAIIProductHelperFactory<MockProductHelperHwUuidEnablementTest<productFamily>> raii(*mockExecutionEnvironment->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->returnStatus = true;
|
||||
|
||||
std::array<uint8_t, 16> uuid, expectedUuid;
|
||||
uuid.fill(0u);
|
||||
expectedUuid.fill(255u);
|
||||
|
||||
PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd);
|
||||
const auto deviceFactory = createDevices(pciBusInfo, 2);
|
||||
deviceFactory = createDevices(pciBusInfo, 2, mockExecutionEnvironment.release());
|
||||
|
||||
EXPECT_EQ(true, deviceFactory->rootDevices[0]->getUuid(uuid));
|
||||
|
||||
@@ -242,15 +244,18 @@ HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDefaultWhenDev
|
||||
|
||||
HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsEnabledWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIsUsed, MatchAny) {
|
||||
|
||||
mockProductHelper.reset(new MockProductHelperHwUuidEnablementTest<productFamily>(true));
|
||||
VariableBackup<ProductHelper *> backupProductHelper(&productHelperFactory[productFamily], mockProductHelper.get());
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory;
|
||||
auto mockExecutionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get(), false, 1);
|
||||
RAIIProductHelperFactory<MockProductHelperHwUuidEnablementTest<productFamily>> raii(*mockExecutionEnvironment->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->returnStatus = true;
|
||||
|
||||
DebugManager.flags.EnableChipsetUniqueUUID.set(1);
|
||||
std::array<uint8_t, 16> uuid, expectedUuid;
|
||||
uuid.fill(0u);
|
||||
expectedUuid.fill(255u);
|
||||
PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd);
|
||||
|
||||
const auto deviceFactory = createDevices(pciBusInfo, 2);
|
||||
deviceFactory = createDevices(pciBusInfo, 2, mockExecutionEnvironment.release());
|
||||
EXPECT_EQ(true, deviceFactory->rootDevices[0]->getUuid(uuid));
|
||||
|
||||
auto &gfxCoreHelper = deviceFactory->rootDevices[0]->getGfxCoreHelper();
|
||||
@@ -263,15 +268,18 @@ HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsEnabledWhenDev
|
||||
|
||||
HWTEST2_F(DeviceUuidEnablementTest, GivenEnableChipsetUniqueUUIDIsDisabledWhenDeviceIsCreatedThenChipsetUniqueUuidUsingTelemetryIsNotUsed, MatchAny) {
|
||||
|
||||
mockProductHelper.reset(new MockProductHelperHwUuidEnablementTest<productFamily>(true));
|
||||
VariableBackup<ProductHelper *> backupProductHelper(&productHelperFactory[productFamily], mockProductHelper.get());
|
||||
std::unique_ptr<UltDeviceFactory> deviceFactory;
|
||||
auto mockExecutionEnvironment = std::make_unique<MockExecutionEnvironment>(defaultHwInfo.get(), false, 1);
|
||||
RAIIProductHelperFactory<MockProductHelperHwUuidEnablementTest<productFamily>> raii(*mockExecutionEnvironment->rootDeviceEnvironments[0]);
|
||||
raii.mockProductHelper->returnStatus = true;
|
||||
|
||||
DebugManager.flags.EnableChipsetUniqueUUID.set(0);
|
||||
std::array<uint8_t, 16> uuid, expectedUuid;
|
||||
uuid.fill(0u);
|
||||
expectedUuid.fill(255u);
|
||||
|
||||
PhysicalDevicePciBusInfo pciBusInfo(0x00, 0x34, 0xab, 0xcd);
|
||||
const auto deviceFactory = createDevices(pciBusInfo, 2);
|
||||
deviceFactory = createDevices(pciBusInfo, 2, mockExecutionEnvironment.release());
|
||||
|
||||
EXPECT_EQ(true, deviceFactory->rootDevices[0]->getUuid(uuid));
|
||||
EXPECT_FALSE(0 == std::memcmp(uuid.data(), expectedUuid.data(), 16));
|
||||
|
||||
@@ -294,12 +294,6 @@ HWTEST_F(ProductHelperTest, WhenAllowRenderCompressionIsCalledThenTrueIsReturned
|
||||
HWTEST_F(ProductHelperTest, givenVariousDebugKeyValuesWhenGettingLocalMemoryAccessModeThenCorrectValueIsReturned) {
|
||||
DebugManagerStateRestore restore{};
|
||||
|
||||
struct MockProductHelper : ProductHelperHw<IGFX_UNKNOWN> {
|
||||
using ProductHelper::getDefaultLocalMemoryAccessMode;
|
||||
};
|
||||
auto mockProductHelper = static_cast<MockProductHelper &>(*ProductHelper::get(productFamily));
|
||||
EXPECT_EQ(mockProductHelper.getDefaultLocalMemoryAccessMode(pInHwInfo), mockProductHelper.getLocalMemoryAccessMode(pInHwInfo));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::Default, productHelper->getLocalMemoryAccessMode(pInHwInfo));
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
#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/raii_hw_info_config.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -27,18 +29,23 @@ struct MockProductHelperTestLinux : ProductHelperTestLinux {
|
||||
ProductHelperTestLinux::SetUp();
|
||||
|
||||
testPlatform->eRenderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily;
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
|
||||
raii = new RAIIProductHelperFactory<MockProductHelperHw<IGFX_UNKNOWN>>(*this->executionEnvironment->rootDeviceEnvironments[0]);
|
||||
mockProductHelper = raii->mockProductHelper;
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
delete raii;
|
||||
ProductHelperTestLinux::TearDown();
|
||||
}
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(IGFX_UNKNOWN)]};
|
||||
MockProductHelperHw<IGFX_UNKNOWN> mockProductHelper;
|
||||
|
||||
RAIIProductHelperFactory<MockProductHelperHw<IGFX_UNKNOWN>> *raii;
|
||||
|
||||
MockProductHelperHw<IGFX_UNKNOWN> *mockProductHelper;
|
||||
};
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, GivenDummyConfigWhenConfiguringHwInfoThenSucceeds) {
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
}
|
||||
|
||||
@@ -47,7 +54,7 @@ HWTEST2_F(MockProductHelperTestLinux, givenDebugFlagSetWhenEnablingBlitterOperat
|
||||
HardwareInfo hardwareInfo = *defaultHwInfo;
|
||||
|
||||
DebugManager.flags.EnableBlitterOperationsSupport.set(1);
|
||||
mockProductHelper.configureHardwareCustom(&hardwareInfo, nullptr);
|
||||
mockProductHelper->configureHardwareCustom(&hardwareInfo, nullptr);
|
||||
EXPECT_FALSE(hardwareInfo.capabilityTable.blitterOperationsSupported);
|
||||
}
|
||||
|
||||
@@ -58,20 +65,20 @@ HWTEST2_F(MockProductHelperTestLinux, givenUnsupportedChipsetUniqueUUIDWhenGetti
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, GivenDummyConfigThenEdramIsDetected) {
|
||||
mockProductHelper.use128MbEdram = true;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
mockProductHelper->use128MbEdram = true;
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(1u, outHwInfo.featureTable.flags.ftrEDram);
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, givenEnabledPlatformCoherencyWhenConfiguringHwInfoThenIgnoreAndSetAsDisabled) {
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_FALSE(outHwInfo.capabilityTable.ftrSupportsCoherency);
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, givenDisabledPlatformCoherencyWhenConfiguringHwInfoThenSetValidCapability) {
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_FALSE(outHwInfo.capabilityTable.ftrSupportsCoherency);
|
||||
}
|
||||
@@ -80,7 +87,7 @@ TEST_F(MockProductHelperTestLinux, GivenFailGetEuCountWhenConfiguringHwInfoThenF
|
||||
drm->storedRetValForEUVal = -4;
|
||||
drm->failRetTopology = true;
|
||||
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(-4, ret);
|
||||
}
|
||||
|
||||
@@ -88,14 +95,14 @@ TEST_F(MockProductHelperTestLinux, GivenFailGetSsCountWhenConfiguringHwInfoThenF
|
||||
drm->storedRetValForSSVal = -5;
|
||||
drm->failRetTopology = true;
|
||||
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(-5, ret);
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, whenFailGettingTopologyThenFallbackToEuCountIoctl) {
|
||||
drm->failRetTopology = true;
|
||||
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_NE(-1, ret);
|
||||
}
|
||||
|
||||
@@ -136,21 +143,21 @@ TEST_F(MockProductHelperTestLinux, givenInvalidTopologyDataWhenConfiguringThenRe
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, GivenFailingCustomConfigWhenConfiguringHwInfoThenFails) {
|
||||
mockProductHelper.failOnConfigureHardwareCustom = true;
|
||||
mockProductHelper->failOnConfigureHardwareCustom = true;
|
||||
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(-1, ret);
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, whenConfigureHwInfoIsCalledThenAreNonPersistentContextsSupportedReturnsTrue) {
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_TRUE(drm->areNonPersistentContextsSupported());
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, whenConfigureHwInfoIsCalledAndPersitentContextIsUnsupportedThenAreNonPersistentContextsSupportedReturnsFalse) {
|
||||
drm->storedPersistentContextsSupport = 0;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_FALSE(drm->areNonPersistentContextsSupported());
|
||||
}
|
||||
@@ -162,11 +169,11 @@ HWTEST_F(MockProductHelperTestLinux, GivenPreemptionDrmEnabledMidThreadOnWhenCon
|
||||
I915_SCHEDULER_CAP_PRIORITY |
|
||||
I915_SCHEDULER_CAP_PREEMPTION;
|
||||
|
||||
mockProductHelper.enableMidThreadPreemption = true;
|
||||
mockProductHelper->enableMidThreadPreemption = true;
|
||||
|
||||
UnitTestHelper<FamilyType>::setExtraMidThreadPreemptionFlag(pInHwInfo, true);
|
||||
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(PreemptionMode::MidThread, outHwInfo.capabilityTable.defaultPreemptionMode);
|
||||
EXPECT_TRUE(drm->isPreemptionSupported());
|
||||
@@ -178,8 +185,8 @@ TEST_F(MockProductHelperTestLinux, GivenPreemptionDrmEnabledThreadGroupOnWhenCon
|
||||
I915_SCHEDULER_CAP_ENABLED |
|
||||
I915_SCHEDULER_CAP_PRIORITY |
|
||||
I915_SCHEDULER_CAP_PREEMPTION;
|
||||
mockProductHelper.enableThreadGroupPreemption = true;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
mockProductHelper->enableThreadGroupPreemption = true;
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(PreemptionMode::ThreadGroup, outHwInfo.capabilityTable.defaultPreemptionMode);
|
||||
EXPECT_TRUE(drm->isPreemptionSupported());
|
||||
@@ -190,7 +197,7 @@ TEST_F(MockProductHelperTestLinux, givenDebugFlagSetWhenConfiguringHwInfoThenPri
|
||||
DebugManager.flags.PrintIoctlEntries.set(true);
|
||||
|
||||
testing::internal::CaptureStdout(); // start capturing
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
std::array<std::string, 1> expectedStrings = {{"DRM_IOCTL_I915_GETPARAM: param: I915_PARAM_HAS_SCHEDULER, output value: 7, retCode: 0"
|
||||
@@ -212,8 +219,8 @@ TEST_F(MockProductHelperTestLinux, GivenPreemptionDrmEnabledMidBatchOnWhenConfig
|
||||
I915_SCHEDULER_CAP_ENABLED |
|
||||
I915_SCHEDULER_CAP_PRIORITY |
|
||||
I915_SCHEDULER_CAP_PREEMPTION;
|
||||
mockProductHelper.enableMidBatchPreemption = true;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
mockProductHelper->enableMidBatchPreemption = true;
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(PreemptionMode::MidBatch, outHwInfo.capabilityTable.defaultPreemptionMode);
|
||||
EXPECT_TRUE(drm->isPreemptionSupported());
|
||||
@@ -225,7 +232,7 @@ TEST_F(MockProductHelperTestLinux, WhenConfiguringHwInfoThenPreemptionIsSupporte
|
||||
I915_SCHEDULER_CAP_ENABLED |
|
||||
I915_SCHEDULER_CAP_PRIORITY |
|
||||
I915_SCHEDULER_CAP_PREEMPTION;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode);
|
||||
EXPECT_TRUE(drm->isPreemptionSupported());
|
||||
@@ -234,11 +241,11 @@ TEST_F(MockProductHelperTestLinux, WhenConfiguringHwInfoThenPreemptionIsSupporte
|
||||
TEST_F(MockProductHelperTestLinux, GivenPreemptionDrmDisabledAllPreemptionWhenConfiguringHwInfoThenPreemptionIsNotSupported) {
|
||||
pInHwInfo.capabilityTable.defaultPreemptionMode = PreemptionMode::MidThread;
|
||||
drm->storedPreemptionSupport = 0;
|
||||
mockProductHelper.enableMidThreadPreemption = true;
|
||||
mockProductHelper.enableMidBatchPreemption = true;
|
||||
mockProductHelper.enableThreadGroupPreemption = true;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
mockProductHelper.enableMidThreadPreemption = true;
|
||||
mockProductHelper->enableMidThreadPreemption = true;
|
||||
mockProductHelper->enableMidBatchPreemption = true;
|
||||
mockProductHelper->enableThreadGroupPreemption = true;
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
mockProductHelper->enableMidThreadPreemption = true;
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode);
|
||||
EXPECT_FALSE(drm->isPreemptionSupported());
|
||||
@@ -250,10 +257,10 @@ TEST_F(MockProductHelperTestLinux, GivenPreemptionDrmEnabledAllPreemptionDriverT
|
||||
I915_SCHEDULER_CAP_ENABLED |
|
||||
I915_SCHEDULER_CAP_PRIORITY |
|
||||
I915_SCHEDULER_CAP_PREEMPTION;
|
||||
mockProductHelper.enableMidBatchPreemption = true;
|
||||
mockProductHelper.enableThreadGroupPreemption = true;
|
||||
mockProductHelper.enableMidThreadPreemption = true;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
mockProductHelper->enableMidBatchPreemption = true;
|
||||
mockProductHelper->enableThreadGroupPreemption = true;
|
||||
mockProductHelper->enableMidThreadPreemption = true;
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(PreemptionMode::ThreadGroup, outHwInfo.capabilityTable.defaultPreemptionMode);
|
||||
EXPECT_TRUE(drm->isPreemptionSupported());
|
||||
@@ -265,10 +272,10 @@ TEST_F(MockProductHelperTestLinux, GivenPreemptionDrmEnabledAllPreemptionDriverM
|
||||
I915_SCHEDULER_CAP_ENABLED |
|
||||
I915_SCHEDULER_CAP_PRIORITY |
|
||||
I915_SCHEDULER_CAP_PREEMPTION;
|
||||
mockProductHelper.enableMidBatchPreemption = true;
|
||||
mockProductHelper.enableThreadGroupPreemption = true;
|
||||
mockProductHelper.enableMidThreadPreemption = true;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
mockProductHelper->enableMidBatchPreemption = true;
|
||||
mockProductHelper->enableThreadGroupPreemption = true;
|
||||
mockProductHelper->enableMidThreadPreemption = true;
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(PreemptionMode::MidBatch, outHwInfo.capabilityTable.defaultPreemptionMode);
|
||||
EXPECT_TRUE(drm->isPreemptionSupported());
|
||||
@@ -280,10 +287,10 @@ TEST_F(MockProductHelperTestLinux, GivenConfigPreemptionDrmEnabledAllPreemptionD
|
||||
I915_SCHEDULER_CAP_ENABLED |
|
||||
I915_SCHEDULER_CAP_PRIORITY |
|
||||
I915_SCHEDULER_CAP_PREEMPTION;
|
||||
mockProductHelper.enableMidBatchPreemption = true;
|
||||
mockProductHelper.enableThreadGroupPreemption = true;
|
||||
mockProductHelper.enableMidThreadPreemption = true;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
mockProductHelper->enableMidBatchPreemption = true;
|
||||
mockProductHelper->enableThreadGroupPreemption = true;
|
||||
mockProductHelper->enableMidThreadPreemption = true;
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(PreemptionMode::Disabled, outHwInfo.capabilityTable.defaultPreemptionMode);
|
||||
EXPECT_TRUE(drm->isPreemptionSupported());
|
||||
@@ -292,7 +299,7 @@ TEST_F(MockProductHelperTestLinux, GivenConfigPreemptionDrmEnabledAllPreemptionD
|
||||
TEST_F(MockProductHelperTestLinux, givenPlatformEnabledFtrCompressionWhenInitializingThenFlagsAreSet) {
|
||||
pInHwInfo.capabilityTable.ftrRenderCompressedImages = true;
|
||||
pInHwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
|
||||
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
|
||||
@@ -300,7 +307,7 @@ TEST_F(MockProductHelperTestLinux, givenPlatformEnabledFtrCompressionWhenInitial
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, givenPointerToHwInfoWhenConfigureHwInfoCalledThenRequiedSurfaceSizeIsSettedProperly) {
|
||||
EXPECT_EQ(MemoryConstants::pageSize, pInHwInfo.capabilityTable.requiredPreemptionSurfaceSize);
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
auto expectedSize = static_cast<size_t>(outHwInfo.gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte);
|
||||
auto &gfxCoreHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
|
||||
@@ -312,53 +319,53 @@ TEST_F(MockProductHelperTestLinux, givenInstrumentationForHardwareIsEnabledOrDis
|
||||
int ret;
|
||||
|
||||
pInHwInfo.capabilityTable.instrumentationEnabled = false;
|
||||
ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
ASSERT_EQ(0, ret);
|
||||
EXPECT_FALSE(outHwInfo.capabilityTable.instrumentationEnabled);
|
||||
|
||||
pInHwInfo.capabilityTable.instrumentationEnabled = true;
|
||||
ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
ASSERT_EQ(0, ret);
|
||||
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled);
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, givenGttSizeReturnedWhenInitializingHwInfoThenSetSvmFtr) {
|
||||
drm->storedGTTSize = MemoryConstants::max64BitAppAddress;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_FALSE(outHwInfo.capabilityTable.ftrSvm);
|
||||
|
||||
drm->storedGTTSize = MemoryConstants::max64BitAppAddress + 1;
|
||||
ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_TRUE(outHwInfo.capabilityTable.ftrSvm);
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, givenGttSizeReturnedWhenInitializingHwInfoThenSetGpuAddressSpace) {
|
||||
drm->storedGTTSize = maxNBitValue(40) + 1;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
EXPECT_EQ(drm->storedGTTSize - 1, outHwInfo.capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
|
||||
TEST_F(MockProductHelperTestLinux, givenFailingGttSizeIoctlWhenInitializingHwInfoThenSetDefaultValues) {
|
||||
drm->storedRetValForGetGttSize = -1;
|
||||
int ret = mockProductHelper.configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
int ret = mockProductHelper->configureHwInfoDrm(&pInHwInfo, &outHwInfo, *executionEnvironment->rootDeviceEnvironments[0].get());
|
||||
EXPECT_EQ(0, ret);
|
||||
|
||||
EXPECT_TRUE(outHwInfo.capabilityTable.ftrSvm);
|
||||
EXPECT_NE(0u, outHwInfo.capabilityTable.gpuAddressSpace);
|
||||
EXPECT_EQ(pInHwInfo.capabilityTable.gpuAddressSpace, outHwInfo.capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
using HwConfigLinux = ::testing::Test;
|
||||
|
||||
HWTEST2_F(MockProductHelperTestLinux, givenPlatformWithPlatformQuerySupportedWhenItIsCalledThenReturnTrue, IsAtLeastMtl) {
|
||||
auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper<ProductHelper>();
|
||||
HWTEST2_F(HwConfigLinux, givenPlatformWithPlatformQuerySupportedWhenItIsCalledThenReturnTrue, IsAtLeastMtl) {
|
||||
MockExecutionEnvironment mockExecutionEnvironment{};
|
||||
auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
|
||||
|
||||
EXPECT_TRUE(productHelper.isPlatformQuerySupported());
|
||||
}
|
||||
|
||||
using HwConfigLinux = ::testing::Test;
|
||||
|
||||
HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwInfoThenMaxSlicesSupportedSetToAvailableCountInGtSystemInfo, MatchAny) {
|
||||
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1);
|
||||
|
||||
@@ -613,7 +613,9 @@ class MockProductHelperForRtKernels : public ProductHelperHw<IGFX_UNKNOWN> {
|
||||
};
|
||||
|
||||
HWTEST_F(MidThreadPreemptionTests, givenKernelWithRayTracingWhenGettingPreemptionFlagsThenMidThreadPreemptionIsEnabledBasedOnProductHelperCapability) {
|
||||
RAIIProductHelperFactory<MockProductHelperForRtKernels> productHelperBackup{defaultHwInfo->platform.eProductFamily};
|
||||
MockExecutionEnvironment mockExecutionEnvironment{};
|
||||
|
||||
RAIIProductHelperFactory<MockProductHelperForRtKernels> productHelperBackup{*mockExecutionEnvironment.rootDeviceEnvironments[0]};
|
||||
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
|
||||
KernelDescriptor kernelDescriptor{};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test//common/helpers/raii_hw_info_config.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
@@ -41,9 +42,7 @@ HWTEST2_F(CommandEncodeStatesTestXeHpgCore, givenRequiredWorkGroupOrderAndIsAdju
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[0];
|
||||
|
||||
MockProductHelper<productFamily> productHelper{};
|
||||
VariableBackup<ProductHelper *> productHelperFactoryBackup{&NEO::productHelperFactory[static_cast<size_t>(defaultHwInfo->platform.eProductFamily)]};
|
||||
productHelperFactoryBackup = &productHelper;
|
||||
RAIIProductHelperFactory<MockProductHelper<productFamily>> raii(rootDeviceEnvironment);
|
||||
|
||||
WALKER_TYPE walkerCmd{};
|
||||
WALKER_TYPE walkerOnStart{};
|
||||
@@ -59,4 +58,4 @@ HWTEST2_F(CommandEncodeStatesTestXeHpgCore, givenRequiredWorkGroupOrderAndIsAdju
|
||||
uint32_t linearOrder = 0u;
|
||||
EncodeDispatchKernel<FamilyType>::adjustWalkOrder(walkerCmd, linearOrder, rootDeviceEnvironment);
|
||||
EXPECT_EQ(WALKER_TYPE::DISPATCH_WALK_ORDER::LINERAR_WALKER, walkerCmd.getDispatchWalkOrder());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user