mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
refactor: add method to get Compiler Product Helper from root device environment
Reduce usage of compiler product helper global getter Related-To: NEO-6853 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
0eac749fcc
commit
e246e75b70
@@ -20,6 +20,7 @@
|
||||
#include "shared/source/gmm_helper/page_table_mngr.h"
|
||||
#include "shared/source/helpers/api_specific_config.h"
|
||||
#include "shared/source/helpers/bindless_heaps_helper.h"
|
||||
#include "shared/source/helpers/compiler_hw_info_config.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
@@ -170,17 +171,21 @@ bool RootDeviceEnvironment::isNumberOfCcsLimited() const {
|
||||
|
||||
template <typename HelperType>
|
||||
HelperType &RootDeviceEnvironment::getHelper() const {
|
||||
if constexpr (std::is_same_v<HelperType, ProductHelper>) {
|
||||
if constexpr (std::is_same_v<HelperType, CompilerProductHelper>) {
|
||||
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;
|
||||
} else {
|
||||
static_assert(std::is_same_v<HelperType, GfxCoreHelper>, "Only ProductHelper and GfxCoreHelper are supported");
|
||||
static_assert(std::is_same_v<HelperType, GfxCoreHelper>, "Only CompilerProductHelper, ProductHelper and GfxCoreHelper are supported");
|
||||
auto &gfxCoreHelper = GfxCoreHelper::get(this->getHardwareInfo()->platform.eRenderCoreFamily);
|
||||
return gfxCoreHelper;
|
||||
}
|
||||
}
|
||||
|
||||
template ProductHelper &RootDeviceEnvironment::getHelper() const;
|
||||
template CompilerProductHelper &RootDeviceEnvironment::getHelper() const;
|
||||
template GfxCoreHelper &RootDeviceEnvironment::getHelper() const;
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -260,7 +260,7 @@ HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsWhenCsrIsS
|
||||
hardwareInfoSetup[expectedHwInfo.platform.eProductFamily](&expectedHwInfo, true, 0x0);
|
||||
productHelper.configureHardwareCustom(&expectedHwInfo, nullptr);
|
||||
|
||||
const auto &compilerProductHelper = *NEO::CompilerProductHelper::get(expectedHwInfo.platform.eProductFamily);
|
||||
const auto &compilerProductHelper = exeEnv.rootDeviceEnvironments[i]->getHelper<CompilerProductHelper>();
|
||||
compilerProductHelper.setProductConfigForHwInfo(expectedHwInfo, deviceAot.aotConfig);
|
||||
expectedHwInfo.platform.usDeviceID = deviceAot.deviceIds->front();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user