Introduce getHelper - common getter for HwInfoConfig and HwHelper

Related-To: NEO-6853
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>

Added getHelper common getter for hwInfoConfig and hwHelper
and use it as CoreHelper(HwHelper) and ProductHelper(HwInfoConfig)
This commit is contained in:
Kamil Kopryk
2022-11-08 16:16:37 +00:00
committed by Compute-Runtime-Automation
parent eb349484f1
commit 46098e0e17
20 changed files with 140 additions and 103 deletions

View File

@@ -163,4 +163,21 @@ void RootDeviceEnvironment::limitNumberOfCcs(uint32_t numberOfCcs) {
bool RootDeviceEnvironment::isNumberOfCcsLimited() const {
return limitedNumberOfCcs;
}
template <typename HelperType>
HelperType &RootDeviceEnvironment::getHelper() const {
if constexpr (std::is_same_v<HelperType, ProductHelper>) {
auto &hwInfoConfig = *HwInfoConfig::get(this->getHardwareInfo()->platform.eProductFamily);
return hwInfoConfig;
}
if constexpr (std::is_same_v<HelperType, CoreHelper>) {
auto &hwHelper = HwHelper::get(this->getHardwareInfo()->platform.eRenderCoreFamily);
return hwHelper;
}
}
template ProductHelper &RootDeviceEnvironment::getHelper() const;
template CoreHelper &RootDeviceEnvironment::getHelper() const;
} // namespace NEO

View File

@@ -35,8 +35,12 @@ class OSTime;
class SipKernel;
class SWTagsManager;
class HwInfoConfig;
class HwHelper;
struct HardwareInfo;
using CoreHelper = HwHelper;
using ProductHelper = HwInfoConfig;
struct RootDeviceEnvironment {
protected:
std::unique_ptr<HardwareInfo> hwInfo;
@@ -69,6 +73,9 @@ struct RootDeviceEnvironment {
bool isNumberOfCcsLimited() const;
const HwInfoConfig &getHwInfoConfig() const;
template <typename HelperType>
HelperType &getHelper() const;
std::unique_ptr<SipKernel> sipKernels[static_cast<uint32_t>(SipKernelType::COUNT)];
std::unique_ptr<GmmHelper> gmmHelper;
std::unique_ptr<OSInterface> osInterface;
@@ -91,4 +98,5 @@ struct RootDeviceEnvironment {
private:
std::mutex mtx;
};
} // namespace NEO