mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
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:

committed by
Compute-Runtime-Automation

parent
77b6918f30
commit
4aa1697e3c
@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/helpers/string.h"
|
||||
#include "shared/source/utilities/numeric.h"
|
||||
@ -110,8 +111,8 @@ ze_result_t SamplerCoreFamily<gfxCoreFamily>::initialize(Device *device, const z
|
||||
samplerState.setMaxLod(maxLodValue.getRawAccess());
|
||||
|
||||
auto &hwInfo = device->getHwInfo();
|
||||
|
||||
NEO::HwInfoConfig::get(hwInfo.platform.eProductFamily)->adjustSamplerState(&samplerState, hwInfo);
|
||||
auto &helper = device->getNEODevice()->getRootDeviceEnvironment().getHelper<NEO::ProductHelper>();
|
||||
helper.adjustSamplerState(&samplerState, hwInfo);
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ size_t HardwareCommandsHelper<GfxFamily>::sendIndirectState(
|
||||
samplerStateOffset = EncodeStates<GfxFamily>::copySamplerState(&dsh, samplerTable.tableOffset,
|
||||
samplerCount, samplerTable.borderColor,
|
||||
kernel.getDynamicStateHeap(), device.getBindlessHeapsHelper(),
|
||||
device.getHardwareInfo());
|
||||
device.getRootDeviceEnvironment());
|
||||
}
|
||||
|
||||
auto localWorkItems = localWorkSize[0] * localWorkSize[1] * localWorkSize[2];
|
||||
|
@ -1248,7 +1248,7 @@ void Kernel::setInlineSamplers() {
|
||||
UNRECOVERABLE_IF(errCode != CL_SUCCESS);
|
||||
|
||||
auto samplerState = ptrOffset(getDynamicStateHeap(), static_cast<size_t>(inlineSampler.getSamplerBindfulOffset()));
|
||||
sampler->setArg(const_cast<void *>(samplerState), clDevice.getHardwareInfo());
|
||||
sampler->setArg(const_cast<void *>(samplerState), clDevice.getRootDeviceEnvironment());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1717,7 +1717,7 @@ cl_int Kernel::setArgSampler(uint32_t argIndex,
|
||||
auto dsh = getDynamicStateHeap();
|
||||
auto samplerState = ptrOffset(dsh, argAsSmp.bindful);
|
||||
|
||||
pSampler->setArg(const_cast<void *>(samplerState), clDevice.getHardwareInfo());
|
||||
pSampler->setArg(const_cast<void *>(samplerState), clDevice.getRootDeviceEnvironment());
|
||||
|
||||
patch<uint32_t, uint32_t>(pSampler->getSnapWaValue(), crossThreadData, argAsSmp.metadataPayload.samplerSnapWa);
|
||||
patch<uint32_t, uint32_t>(getAddrModeEnum(pSampler->addressingMode), crossThreadData, argAsSmp.metadataPayload.samplerAddressingMode);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -41,4 +41,13 @@ MockDevice *ClDeviceFixture::createWithUsDeviceId(unsigned short usDeviceId) {
|
||||
hardwareInfo.platform.usDeviceID = usDeviceId;
|
||||
return MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo, rootDeviceIndex);
|
||||
}
|
||||
|
||||
template <typename HelperType>
|
||||
HelperType &ClDeviceFixture::getHelper() const {
|
||||
auto &helper = pClDevice->getRootDeviceEnvironment().getHelper<HelperType>();
|
||||
return helper;
|
||||
}
|
||||
|
||||
template ProductHelper &ClDeviceFixture::getHelper() const;
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -20,6 +20,9 @@ struct ClDeviceFixture {
|
||||
|
||||
MockDevice *createWithUsDeviceId(unsigned short usDeviceId);
|
||||
|
||||
template <typename HelperType>
|
||||
HelperType &getHelper() const;
|
||||
|
||||
MockDevice *pDevice = nullptr;
|
||||
MockClDevice *pClDevice = nullptr;
|
||||
volatile uint32_t *pTagMemory = nullptr;
|
||||
@ -29,4 +32,5 @@ struct ClDeviceFixture {
|
||||
const uint32_t rootDeviceIndex = 0u;
|
||||
MockClExecutionEnvironment *pClExecutionEnvironment = nullptr;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -1,11 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "opencl/source/sampler/sampler.h"
|
||||
|
||||
namespace NEO {
|
||||
@ -38,7 +39,7 @@ struct MockSampler : public Sampler {
|
||||
return filterMode;
|
||||
}
|
||||
|
||||
void setArg(void *memory, const HardwareInfo &hwInfo) override {
|
||||
void setArg(void *memory, const RootDeviceEnvironment &rootDeviceEnvironment) override {
|
||||
}
|
||||
};
|
||||
} // namespace NEO
|
||||
|
@ -581,7 +581,7 @@ HWTEST_P(FilterModeTest, WhenSettingKernelArgSamplerThenFiltersAreCorrect) {
|
||||
ptrOffset(pKernel->getDynamicStateHeap(),
|
||||
pKernelInfo->argAsSmp(0).bindful));
|
||||
|
||||
sampler->setArg(const_cast<SAMPLER_STATE *>(samplerState), *defaultHwInfo);
|
||||
sampler->setArg(const_cast<SAMPLER_STATE *>(samplerState), pClDevice->getRootDeviceEnvironment());
|
||||
|
||||
if (CL_FILTER_NEAREST == filterMode) {
|
||||
EXPECT_EQ(SAMPLER_STATE::MIN_MODE_FILTER_NEAREST, samplerState->getMinModeFilter());
|
||||
|
@ -16,24 +16,31 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
typedef Test<ClDeviceFixture> XeHPSamplerTest;
|
||||
using XeHPSamplerTest = Test<ClDeviceFixture>;
|
||||
|
||||
XEHPTEST_F(XeHPSamplerTest, givenXeHPSamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenDisableLowQualityFilter) {
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
|
||||
EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
|
||||
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
helper.adjustSamplerState(&state, *defaultHwInfo);
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPSamplerTest, givenXeHPSamplerWhenForcingLowQualityFilteringAndAppendSamplerStateParamsThenEnableLowQualityFilter) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
|
||||
EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
|
||||
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
helper.adjustSamplerState(&state, *defaultHwInfo);
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
|
||||
}
|
||||
|
@ -22,40 +22,46 @@ using namespace NEO;
|
||||
using SamplerTest = Test<ClDeviceFixture>;
|
||||
|
||||
HWTEST2_F(SamplerTest, givenDg2SamplerWhenUsingDefaultFilteringAndAppendSamplerStateParamsThenNotEnableLowQualityFilter, IsDG2) {
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
|
||||
EXPECT_FALSE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
|
||||
|
||||
helper.adjustSamplerState(&state, *defaultHwInfo);
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
}
|
||||
|
||||
HWTEST2_F(SamplerTest, givenDg2SamplerWhenForcingLowQualityFilteringAndAppendSamplerStateParamsThenEnableLowQualityFilter, IsDG2) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.ForceSamplerLowFilteringPrecision.set(true);
|
||||
EXPECT_TRUE(DebugManager.flags.ForceSamplerLowFilteringPrecision.get());
|
||||
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
|
||||
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
|
||||
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&state, *defaultHwInfo);
|
||||
|
||||
helper.adjustSamplerState(&state, *defaultHwInfo);
|
||||
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
|
||||
}
|
||||
|
||||
HWTEST2_F(SamplerTest, givenDg2BelowC0WhenProgrammingSamplerForNearestFilterWithMirrorAddressThenRoundEnableForRDirectionIsEnabled, IsDG2) {
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
|
||||
uint32_t revisions[] = {REVISION_A0, REVISION_B, REVISION_C};
|
||||
for (auto &revision : revisions) {
|
||||
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, *defaultHwInfo);
|
||||
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = helper.getHwRevIdFromStepping(revision, *defaultHwInfo);
|
||||
auto context = clUniquePtr(new MockContext());
|
||||
auto sampler = clUniquePtr(new SamplerHw<FamilyType>(context.get(), CL_FALSE, CL_ADDRESS_MIRRORED_REPEAT, CL_FILTER_NEAREST));
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_FALSE(state.getRAddressMinFilterRoundingEnable());
|
||||
EXPECT_FALSE(state.getRAddressMagFilterRoundingEnable());
|
||||
sampler->setArg(&state, pDevice->getHardwareInfo());
|
||||
sampler->setArg(&state, pDevice->getRootDeviceEnvironment());
|
||||
if (REVISION_C == revision) {
|
||||
EXPECT_FALSE(state.getRAddressMinFilterRoundingEnable());
|
||||
EXPECT_FALSE(state.getRAddressMagFilterRoundingEnable());
|
||||
@ -66,20 +72,20 @@ HWTEST2_F(SamplerTest, givenDg2BelowC0WhenProgrammingSamplerForNearestFilterWith
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(SamplerTest, givenDg2BelowC0WhenProgrammingSamplerForNearestFilterWitouthMirrorAddressThenRoundEnableForRDirectionIsDisabled, IsDG2) {
|
||||
HWTEST2_F(SamplerTest, givenDg2BelowC0WhenProgrammingSamplerForNearestFilterWithoutMirrorAddressThenRoundEnableForRDirectionIsDisabled, IsDG2) {
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
|
||||
uint32_t revisions[] = {REVISION_A0, REVISION_B, REVISION_C};
|
||||
for (auto &revision : revisions) {
|
||||
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, *defaultHwInfo);
|
||||
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = helper.getHwRevIdFromStepping(revision, *defaultHwInfo);
|
||||
auto context = clUniquePtr(new MockContext());
|
||||
auto sampler = clUniquePtr(new SamplerHw<FamilyType>(context.get(), CL_FALSE, CL_ADDRESS_NONE, CL_FILTER_NEAREST));
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_FALSE(state.getRAddressMinFilterRoundingEnable());
|
||||
EXPECT_FALSE(state.getRAddressMagFilterRoundingEnable());
|
||||
sampler->setArg(&state, pDevice->getHardwareInfo());
|
||||
sampler->setArg(&state, pDevice->getRootDeviceEnvironment());
|
||||
EXPECT_FALSE(state.getRAddressMinFilterRoundingEnable());
|
||||
EXPECT_FALSE(state.getRAddressMagFilterRoundingEnable());
|
||||
}
|
||||
@ -88,17 +94,17 @@ HWTEST2_F(SamplerTest, givenDg2BelowC0WhenProgrammingSamplerForNearestFilterWito
|
||||
HWTEST2_F(SamplerTest, givenDg2BelowC0WhenProgrammingSamplerForLinearFilterWithMirrorAddressThenRoundEnableForRDirectionIsEnabled, IsDG2) {
|
||||
using SAMPLER_STATE = typename FamilyType::SAMPLER_STATE;
|
||||
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
|
||||
uint32_t revisions[] = {REVISION_A0, REVISION_B, REVISION_C};
|
||||
for (auto &revision : revisions) {
|
||||
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(revision, *defaultHwInfo);
|
||||
pDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->platform.usRevId = helper.getHwRevIdFromStepping(revision, *defaultHwInfo);
|
||||
auto context = clUniquePtr(new MockContext());
|
||||
auto sampler = clUniquePtr(new SamplerHw<FamilyType>(context.get(), CL_FALSE, CL_ADDRESS_MIRRORED_REPEAT, CL_FILTER_LINEAR));
|
||||
auto state = FamilyType::cmdInitSamplerState;
|
||||
EXPECT_FALSE(state.getRAddressMinFilterRoundingEnable());
|
||||
EXPECT_FALSE(state.getRAddressMagFilterRoundingEnable());
|
||||
sampler->setArg(&state, pDevice->getHardwareInfo());
|
||||
sampler->setArg(&state, pDevice->getRootDeviceEnvironment());
|
||||
EXPECT_TRUE(state.getRAddressMinFilterRoundingEnable());
|
||||
EXPECT_TRUE(state.getRAddressMagFilterRoundingEnable());
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ struct EncodeStates {
|
||||
uint32_t borderColorOffset,
|
||||
const void *fnDynamicStateHeap,
|
||||
BindlessHeapsHelper *bindlessHeapHelper,
|
||||
const HardwareInfo &hwInfo);
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
|
@ -42,7 +42,7 @@ uint32_t EncodeStates<Family>::copySamplerState(IndirectHeap *dsh,
|
||||
uint32_t borderColorOffset,
|
||||
const void *fnDynamicStateHeap,
|
||||
BindlessHeapsHelper *bindlessHeapHelper,
|
||||
const HardwareInfo &hwInfo) {
|
||||
const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
auto sizeSamplerState = sizeof(SAMPLER_STATE) * samplerCount;
|
||||
auto borderColorSize = samplerStateOffset - borderColorOffset;
|
||||
|
||||
@ -80,14 +80,14 @@ uint32_t EncodeStates<Family>::copySamplerState(IndirectHeap *dsh,
|
||||
samplerStateOffsetInDsh = static_cast<uint32_t>(samplerStateInDsh.surfaceStateOffset);
|
||||
}
|
||||
|
||||
auto &helper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
auto srcSamplerState = reinterpret_cast<const SAMPLER_STATE *>(ptrOffset(fnDynamicStateHeap, samplerStateOffset));
|
||||
SAMPLER_STATE state = {};
|
||||
for (uint32_t i = 0; i < samplerCount; i++) {
|
||||
state = srcSamplerState[i];
|
||||
state.setIndirectStatePointer(static_cast<uint32_t>(borderColorOffsetInDsh));
|
||||
|
||||
HwInfoConfig::get(hwInfo.platform.eProductFamily)->adjustSamplerState(&state, hwInfo);
|
||||
|
||||
helper.adjustSamplerState(&state, hwInfo);
|
||||
dstSamplerState[i] = state;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
kernelDescriptor.payloadMappings.samplerTable.numSamplers,
|
||||
kernelDescriptor.payloadMappings.samplerTable.borderColor,
|
||||
args.dispatchInterface->getDynamicStateHeapData(),
|
||||
args.device->getBindlessHeapsHelper(), hwInfo);
|
||||
args.device->getBindlessHeapsHelper(), args.device->getRootDeviceEnvironment());
|
||||
}
|
||||
|
||||
idd.setSamplerStatePointer(samplerStateOffset);
|
||||
|
@ -141,7 +141,7 @@ void EncodeDispatchKernel<Family>::encode(CommandContainer &container, EncodeDis
|
||||
heap, kernelDescriptor.payloadMappings.samplerTable.tableOffset,
|
||||
kernelDescriptor.payloadMappings.samplerTable.numSamplers, kernelDescriptor.payloadMappings.samplerTable.borderColor,
|
||||
args.dispatchInterface->getDynamicStateHeapData(),
|
||||
args.device->getBindlessHeapsHelper(), hwInfo);
|
||||
args.device->getBindlessHeapsHelper(), args.device->getRootDeviceEnvironment());
|
||||
if (ApiSpecificConfig::getBindlessConfiguration()) {
|
||||
container.getResidencyContainer().push_back(args.device->getBindlessHeapsHelper()->getHeap(NEO::BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH)->getGraphicsAllocation());
|
||||
}
|
||||
|
@ -88,7 +88,8 @@ bool Wddm::init() {
|
||||
if (!hardwareInfoTable[productFamily]) {
|
||||
return false;
|
||||
}
|
||||
auto hardwareInfo = std::make_unique<HardwareInfo>();
|
||||
|
||||
auto hardwareInfo = rootDeviceEnvironment.getMutableHardwareInfo();
|
||||
hardwareInfo->platform = *gfxPlatform;
|
||||
hardwareInfo->featureTable = *featureTable;
|
||||
hardwareInfo->workaroundTable = *workaroundTable;
|
||||
@ -99,17 +100,16 @@ bool Wddm::init() {
|
||||
hardwareInfo->capabilityTable.instrumentationEnabled =
|
||||
(hardwareInfo->capabilityTable.instrumentationEnabled && instrumentationEnabled);
|
||||
|
||||
HwInfoConfig *hwConfig = HwInfoConfig::get(productFamily);
|
||||
|
||||
hwConfig->adjustPlatformForProductFamily(hardwareInfo.get());
|
||||
if (hwConfig->configureHwInfoWddm(hardwareInfo.get(), hardwareInfo.get(), nullptr)) {
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
productHelper.adjustPlatformForProductFamily(hardwareInfo);
|
||||
if (productHelper.configureHwInfoWddm(hardwareInfo, hardwareInfo, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
setPlatformSupportEvictIfNecessaryFlag(*hwConfig);
|
||||
setPlatformSupportEvictIfNecessaryFlag(productHelper);
|
||||
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*hardwareInfo);
|
||||
populateIpVersion(*hardwareInfo);
|
||||
rootDeviceEnvironment.setHwInfo(hardwareInfo.get());
|
||||
|
||||
rootDeviceEnvironment.initGmm();
|
||||
this->rootDeviceEnvironment.getGmmClientContext()->setHandleAllocator(this->hwDeviceId->getUmKmDataTranslator()->createGmmHandleAllocator());
|
||||
|
||||
|
@ -35,7 +35,7 @@ HWTEST_F(CommandEncodeStatesTest, GivenCommandStreamWhenEncodeCopySamplerStateTh
|
||||
|
||||
auto dsh = cmdContainer->getIndirectHeap(HeapType::DYNAMIC_STATE);
|
||||
auto usedBefore = dsh->getUsed();
|
||||
auto samplerStateOffset = EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, nullptr, pDevice->getHardwareInfo());
|
||||
auto samplerStateOffset = EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, nullptr, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(ptrOffset(dsh->getCpuBase(), samplerStateOffset));
|
||||
EXPECT_EQ(pSmplr->getIndirectStatePointer(), usedBefore);
|
||||
@ -59,7 +59,7 @@ HWTEST2_F(CommandEncodeStatesTest, givenDebugVariableSetWhenCopyingSamplerStateT
|
||||
|
||||
auto dsh = cmdContainer->getIndirectHeap(HeapType::DYNAMIC_STATE);
|
||||
|
||||
auto samplerStateOffset = EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, nullptr, pDevice->getHardwareInfo());
|
||||
auto samplerStateOffset = EncodeStates<FamilyType>::copySamplerState(dsh, 0, numSamplers, 0, &samplerState, nullptr, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
auto pSamplerState = reinterpret_cast<SAMPLER_STATE *>(ptrOffset(dsh->getCpuBase(), samplerStateOffset));
|
||||
EXPECT_EQ(pSamplerState->getLowQualityFilter(), SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE);
|
||||
@ -81,7 +81,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit
|
||||
SAMPLER_BORDER_COLOR_STATE samplerState;
|
||||
samplerState.init();
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo());
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getRootDeviceEnvironment());
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getDefaultBorderColorOffset();
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
@ -104,7 +104,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorWit
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorAlpha(1.0);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo());
|
||||
EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getRootDeviceEnvironment());
|
||||
auto expectedValue = pDevice->getBindlessHeapsHelper()->getAlphaBorderColorOffset();
|
||||
|
||||
auto pSmplr = reinterpret_cast<SAMPLER_STATE *>(dsh->getGraphicsAllocation()->getUnderlyingBuffer());
|
||||
@ -127,7 +127,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsRe
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorRed(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()), std::exception);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getRootDeviceEnvironment()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGreenChanelIsNotZeroThenExceptionThrown) {
|
||||
@ -146,7 +146,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsGr
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorGreen(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()), std::exception);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getRootDeviceEnvironment()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBlueChanelIsNotZeroThenExceptionThrown) {
|
||||
@ -164,7 +164,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsBl
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorBlue(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()), std::exception);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getRootDeviceEnvironment()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAlphaChanelIsNotZeroOrOneThenExceptionThrown) {
|
||||
@ -183,7 +183,7 @@ HWTEST_F(BindlessCommandEncodeStatesTest, GivenBindlessEnabledWhenBorderColorsAl
|
||||
samplerState.init();
|
||||
samplerState.setBorderColorAlpha(0.5);
|
||||
auto dsh = pDevice->getBindlessHeapsHelper()->getHeap(BindlessHeapsHelper::BindlesHeapType::GLOBAL_DSH);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getHardwareInfo()), std::exception);
|
||||
EXPECT_THROW(EncodeStates<FamilyType>::copySamplerState(dsh, borderColorSize, numSamplers, 0, &samplerState, pDevice->getBindlessHeapsHelper(), pDevice->getRootDeviceEnvironment()), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(CommandEncodeStatesTest, givenCreatedSurfaceStateBufferWhenAllocationProvidedThenUseAllocationAsInput) {
|
||||
|
@ -13,60 +13,60 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using HwInfoConfigTestWindowsGen12lp = HwInfoConfigTestWindows;
|
||||
using ProductHelperTestWindowsGen12lp = HwInfoConfigTestWindows;
|
||||
|
||||
GEN12LPTEST_F(HwInfoConfigTestWindowsGen12lp, givenE2ECSetByKmdWhenConfiguringHwThenAdjustInternalImageFlag) {
|
||||
GEN12LPTEST_F(ProductHelperTestWindowsGen12lp, givenE2ECSetByKmdWhenConfiguringHwThenAdjustInternalImageFlag) {
|
||||
FeatureTable &localFeatureTable = outHwInfo.featureTable;
|
||||
|
||||
auto &hwInfoConfig = rootDeviceEnvironment->getHwInfoConfig();
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
|
||||
localFeatureTable.flags.ftrE2ECompression = true;
|
||||
hwInfoConfig.configureHardwareCustom(&outHwInfo, nullptr);
|
||||
helper.configureHardwareCustom(&outHwInfo, nullptr);
|
||||
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
|
||||
EXPECT_TRUE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
|
||||
|
||||
localFeatureTable.flags.ftrE2ECompression = false;
|
||||
hwInfoConfig.configureHardwareCustom(&outHwInfo, nullptr);
|
||||
helper.configureHardwareCustom(&outHwInfo, nullptr);
|
||||
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedBuffers);
|
||||
EXPECT_FALSE(outHwInfo.capabilityTable.ftrRenderCompressedImages);
|
||||
}
|
||||
|
||||
GEN12LPTEST_F(HwInfoConfigTestWindowsGen12lp, givenGen12LpProductWhenAdjustPlatformForProductFamilyCalledThenOverrideWithCorrectFamily) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
GEN12LPTEST_F(ProductHelperTestWindowsGen12lp, givenGen12LpProductWhenAdjustPlatformForProductFamilyCalledThenOverrideWithCorrectFamily) {
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
|
||||
PLATFORM *testPlatform = &outHwInfo.platform;
|
||||
testPlatform->eDisplayCoreFamily = IGFX_GEN11_CORE;
|
||||
testPlatform->eRenderCoreFamily = IGFX_GEN11_CORE;
|
||||
hwInfoConfig->adjustPlatformForProductFamily(&outHwInfo);
|
||||
helper.adjustPlatformForProductFamily(&outHwInfo);
|
||||
|
||||
EXPECT_EQ(IGFX_GEN12LP_CORE, testPlatform->eRenderCoreFamily);
|
||||
EXPECT_EQ(IGFX_GEN12LP_CORE, testPlatform->eDisplayCoreFamily);
|
||||
}
|
||||
|
||||
GEN12LPTEST_F(HwInfoConfigTestWindowsGen12lp, givenCompressionFtrEnabledWhenAskingForPageTableManagerThenReturnCorrectValue) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
GEN12LPTEST_F(ProductHelperTestWindowsGen12lp, givenCompressionFtrEnabledWhenAskingForPageTableManagerThenReturnCorrectValue) {
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
|
||||
outHwInfo.capabilityTable.ftrRenderCompressedBuffers = false;
|
||||
outHwInfo.capabilityTable.ftrRenderCompressedImages = false;
|
||||
EXPECT_FALSE(hwInfoConfig.isPageTableManagerSupported(outHwInfo));
|
||||
EXPECT_FALSE(helper.isPageTableManagerSupported(outHwInfo));
|
||||
|
||||
outHwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
|
||||
outHwInfo.capabilityTable.ftrRenderCompressedImages = false;
|
||||
EXPECT_TRUE(hwInfoConfig.isPageTableManagerSupported(outHwInfo));
|
||||
EXPECT_TRUE(helper.isPageTableManagerSupported(outHwInfo));
|
||||
|
||||
outHwInfo.capabilityTable.ftrRenderCompressedBuffers = false;
|
||||
outHwInfo.capabilityTable.ftrRenderCompressedImages = true;
|
||||
EXPECT_TRUE(hwInfoConfig.isPageTableManagerSupported(outHwInfo));
|
||||
EXPECT_TRUE(helper.isPageTableManagerSupported(outHwInfo));
|
||||
|
||||
outHwInfo.capabilityTable.ftrRenderCompressedBuffers = true;
|
||||
outHwInfo.capabilityTable.ftrRenderCompressedImages = true;
|
||||
EXPECT_TRUE(hwInfoConfig.isPageTableManagerSupported(outHwInfo));
|
||||
EXPECT_TRUE(helper.isPageTableManagerSupported(outHwInfo));
|
||||
}
|
||||
|
||||
GEN12LPTEST_F(HwInfoConfigTestWindowsGen12lp, givenGen12LpSkuWhenGettingCapabilityCoherencyFlagThenExpectValidValue) {
|
||||
auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
GEN12LPTEST_F(ProductHelperTestWindowsGen12lp, givenGen12LpSkuWhenGettingCapabilityCoherencyFlagThenExpectValidValue) {
|
||||
auto &helper = getHelper<ProductHelper>();
|
||||
bool coherency = false;
|
||||
hwInfoConfig.setCapabilityCoherencyFlag(outHwInfo, coherency);
|
||||
helper.setCapabilityCoherencyFlag(outHwInfo, coherency);
|
||||
const bool checkDone = SpecialUltHelperGen12lp::additionalCoherencyCheck(outHwInfo.platform.eProductFamily, coherency);
|
||||
if (checkDone) {
|
||||
EXPECT_FALSE(coherency);
|
||||
@ -74,11 +74,11 @@ GEN12LPTEST_F(HwInfoConfigTestWindowsGen12lp, givenGen12LpSkuWhenGettingCapabili
|
||||
}
|
||||
|
||||
if (SpecialUltHelperGen12lp::isAdditionalCapabilityCoherencyFlagSettingRequired(outHwInfo.platform.eProductFamily)) {
|
||||
outHwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A1, outHwInfo);
|
||||
hwInfoConfig.setCapabilityCoherencyFlag(outHwInfo, coherency);
|
||||
outHwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A1, outHwInfo);
|
||||
helper.setCapabilityCoherencyFlag(outHwInfo, coherency);
|
||||
EXPECT_TRUE(coherency);
|
||||
outHwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, outHwInfo);
|
||||
hwInfoConfig.setCapabilityCoherencyFlag(outHwInfo, coherency);
|
||||
outHwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A0, outHwInfo);
|
||||
helper.setCapabilityCoherencyFlag(outHwInfo, coherency);
|
||||
EXPECT_FALSE(coherency);
|
||||
} else {
|
||||
EXPECT_TRUE(coherency);
|
||||
|
@ -39,6 +39,15 @@ void HwInfoConfigTestWindows::TearDown() {
|
||||
HwInfoConfigTest::TearDown();
|
||||
}
|
||||
|
||||
template <typename HelperType>
|
||||
HelperType &HwInfoConfigTestWindows::getHelper() const {
|
||||
auto &helper = rootDeviceEnvironment->getHelper<HelperType>();
|
||||
return helper;
|
||||
}
|
||||
|
||||
template ProductHelper &HwInfoConfigTestWindows::getHelper() const;
|
||||
template CoreHelper &HwInfoConfigTestWindows::getHelper() const;
|
||||
|
||||
TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenReturnSuccess) {
|
||||
int ret = hwConfig.configureHwInfoWddm(&pInHwInfo, &outHwInfo, osInterface.get());
|
||||
EXPECT_EQ(0, ret);
|
||||
|
@ -29,6 +29,9 @@ struct HwInfoConfigTestWindows : public HwInfoConfigTest {
|
||||
MockHwInfoConfigHw<IGFX_UNKNOWN> hwConfig;
|
||||
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
|
||||
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
|
||||
|
||||
template <typename HelperType>
|
||||
HelperType &getHelper() const;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user