Move hwInfoConfig ownership to RootDeviceEnvironment 2/n

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

Use RootDeviceEnvironment getHelper<ProductHelper> for
- adjustSamplerState
- adjustPlatformForProductFamily.
This commit is contained in:
Kamil Kopryk
2022-11-10 00:05:51 +00:00
committed by Compute-Runtime-Automation
parent 77b6918f30
commit 4aa1697e3c
20 changed files with 121 additions and 77 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,6 +14,7 @@
namespace NEO {
class Context;
struct HardwareInfo;
struct RootDeviceEnvironment;
template <>
struct OpenCLObjectMapper<_cl_sampler> {
@@ -50,7 +51,7 @@ class Sampler : public BaseObject<_cl_sampler> {
cl_int getInfo(cl_sampler_info paramName, size_t paramValueSize,
void *paramValue, size_t *paramValueSizeRet);
virtual void setArg(void *memory, const HardwareInfo &hwInfo) = 0;
virtual void setArg(void *memory, const RootDeviceEnvironment &rootDeviceEnvironment) = 0;
bool isTransformable() const;
@@ -85,7 +86,7 @@ class Sampler : public BaseObject<_cl_sampler> {
template <typename GfxFamily>
struct SamplerHw : public Sampler {
void setArg(void *memory, const HardwareInfo &hwInfo) override;
void setArg(void *memory, const RootDeviceEnvironment &rootDeviceEnvironment) override;
static constexpr float getGenSamplerMaxLod() {
return 14.0f;
}

View File

@@ -5,6 +5,7 @@
*
*/
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/populate_factory.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/utilities/numeric.h"
@@ -14,7 +15,7 @@
namespace NEO {
template <typename GfxFamily>
void SamplerHw<GfxFamily>::setArg(void *memory, const HardwareInfo &hwInfo) {
void SamplerHw<GfxFamily>::setArg(void *memory, const RootDeviceEnvironment &rootDeviceEnvironment) {
using SAMPLER_STATE = typename GfxFamily::SAMPLER_STATE;
auto samplerState = reinterpret_cast<SAMPLER_STATE *>(memory);
samplerState->setNonNormalizedCoordinateEnable(!this->normalizedCoordinates);
@@ -90,6 +91,8 @@ void SamplerHw<GfxFamily>::setArg(void *memory, const HardwareInfo &hwInfo) {
samplerState->setMinLod(minLodValue.getRawAccess());
samplerState->setMaxLod(maxLodValue.getRawAccess());
HwInfoConfig::get(hwInfo.platform.eProductFamily)->adjustSamplerState(samplerState, hwInfo);
auto &helper = rootDeviceEnvironment.getHelper<ProductHelper>();
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
helper.adjustSamplerState(samplerState, hwInfo);
}
} // namespace NEO