mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
Refactor: dont use global gfxCoreHelper getter in l0 files 1/n
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
8d18a0cd12
commit
916b740e7d
@@ -78,7 +78,7 @@ class GfxCoreHelper {
|
||||
bool isReadOnly,
|
||||
uint32_t surfaceType,
|
||||
bool forceNonAuxMode,
|
||||
bool useL1Cache) = 0;
|
||||
bool useL1Cache) const = 0;
|
||||
virtual const EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual EngineGroupType getEngineGroupType(aub_stream::EngineType engineType, EngineUsage engineUsage, const HardwareInfo &hwInfo) const = 0;
|
||||
virtual const StackVec<size_t, 3> getDeviceSubGroupSizes() const = 0;
|
||||
@@ -244,9 +244,9 @@ class GfxCoreHelperHw : public GfxCoreHelper {
|
||||
bool isReadOnly,
|
||||
uint32_t surfaceType,
|
||||
bool forceNonAuxMode,
|
||||
bool useL1Cache) override;
|
||||
bool useL1Cache) const override;
|
||||
|
||||
MOCKABLE_VIRTUAL void setL1CachePolicy(bool useL1Cache, typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo);
|
||||
MOCKABLE_VIRTUAL void setL1CachePolicy(bool useL1Cache, typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) const;
|
||||
|
||||
const EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ void GfxCoreHelperHw<Family>::setRenderSurfaceStateForScratchResource(const Root
|
||||
bool isReadOnly,
|
||||
uint32_t surfaceType,
|
||||
bool forceNonAuxMode,
|
||||
bool useL1Cache) {
|
||||
bool useL1Cache) const {
|
||||
using RENDER_SURFACE_STATE = typename Family::RENDER_SURFACE_STATE;
|
||||
using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT;
|
||||
using AUXILIARY_SURFACE_MODE = typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
|
||||
@@ -174,7 +174,7 @@ void GfxCoreHelperHw<Family>::setRenderSurfaceStateForScratchResource(const Root
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void NEO::GfxCoreHelperHw<GfxFamily>::setL1CachePolicy(bool useL1Cache, typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) {}
|
||||
void NEO::GfxCoreHelperHw<GfxFamily>::setL1CachePolicy(bool useL1Cache, typename GfxFamily::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) const {}
|
||||
|
||||
template <typename Family>
|
||||
bool GfxCoreHelperHw<Family>::getEnableLocalMemory(const HardwareInfo &hwInfo) const {
|
||||
|
||||
@@ -55,7 +55,7 @@ uint32_t GfxCoreHelperHw<Family>::computeSlmValues(const HardwareInfo &hwInfo, u
|
||||
}
|
||||
|
||||
template <>
|
||||
void GfxCoreHelperHw<Family>::setL1CachePolicy(bool useL1Cache, typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) {
|
||||
void GfxCoreHelperHw<Family>::setL1CachePolicy(bool useL1Cache, typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) const {
|
||||
}
|
||||
|
||||
template <>
|
||||
|
||||
@@ -210,7 +210,7 @@ size_t MemorySynchronizationCommands<Family>::getSizeForAdditonalSynchronization
|
||||
}
|
||||
|
||||
template <>
|
||||
void GfxCoreHelperHw<Family>::setL1CachePolicy(bool useL1Cache, typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) {
|
||||
void GfxCoreHelperHw<Family>::setL1CachePolicy(bool useL1Cache, typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) const {
|
||||
if (useL1Cache) {
|
||||
surfaceState->setL1CachePolicyL1CacheControl(Family::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB);
|
||||
if (DebugManager.flags.OverrideL1CacheControlInSurfaceStateForScratchSpace.get() != -1) {
|
||||
|
||||
@@ -58,7 +58,7 @@ bool GfxCoreHelperHw<Family>::is1MbAlignmentSupported(const HardwareInfo &hwInfo
|
||||
}
|
||||
|
||||
template <>
|
||||
void GfxCoreHelperHw<Family>::setL1CachePolicy(bool useL1Cache, typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) {
|
||||
void GfxCoreHelperHw<Family>::setL1CachePolicy(bool useL1Cache, typename Family::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) const {
|
||||
if (useL1Cache) {
|
||||
surfaceState->setL1CachePolicyL1CacheControl(Family::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB);
|
||||
if (DebugManager.flags.OverrideL1CacheControlInSurfaceStateForScratchSpace.get() != -1) {
|
||||
|
||||
@@ -87,21 +87,11 @@ HWTEST_F(GfxCoreHelperTest, givenForceExtendedKernelIsaSizeSetWhenGettingISAPadd
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(GfxCoreHelperTest, WhenSettingRenderSurfaceStateForBufferThenL1CachePolicyIsSet) {
|
||||
HWTEST2_F(GfxCoreHelperTest, WhenSettingRenderSurfaceStateForBufferThenL1CachePolicyIsSet, IsAtLeastXeHpgCore) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE;
|
||||
class MockGfxCoreHelperHw : public GfxCoreHelperHw<FamilyType> {
|
||||
public:
|
||||
bool called = false;
|
||||
using GfxCoreHelperHw<FamilyType>::GfxCoreHelperHw;
|
||||
MockGfxCoreHelperHw() {}
|
||||
void setL1CachePolicy(bool useL1Cache, typename FamilyType::RENDER_SURFACE_STATE *surfaceState, const HardwareInfo *hwInfo) override {
|
||||
GfxCoreHelperHw<FamilyType>::setL1CachePolicy(useL1Cache, surfaceState, hwInfo);
|
||||
called = true;
|
||||
}
|
||||
};
|
||||
|
||||
MockGfxCoreHelperHw helper;
|
||||
auto &gfxCoreHelper = this->pDevice->getGfxCoreHelper();
|
||||
void *stateBuffer = alignedMalloc(sizeof(RENDER_SURFACE_STATE), sizeof(RENDER_SURFACE_STATE));
|
||||
ASSERT_NE(nullptr, stateBuffer);
|
||||
memset(stateBuffer, 0, sizeof(RENDER_SURFACE_STATE));
|
||||
@@ -116,14 +106,16 @@ HWTEST_F(GfxCoreHelperTest, WhenSettingRenderSurfaceStateForBufferThenL1CachePol
|
||||
uint32_t pitch = 0x40;
|
||||
SURFACE_TYPE type = RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER;
|
||||
|
||||
helper.setRenderSurfaceStateForScratchResource(rootDeviceEnvironment, stateBuffer, size, addr, offset, pitch, nullptr, false, type, false,
|
||||
false);
|
||||
ASSERT_EQ(helper.called, true);
|
||||
helper.called = false;
|
||||
gfxCoreHelper.setRenderSurfaceStateForScratchResource(rootDeviceEnvironment, stateBuffer, size, addr, offset, pitch, nullptr, false, type, false,
|
||||
false);
|
||||
|
||||
EXPECT_NE(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB, surfaceState->getL1CachePolicyL1CacheControl());
|
||||
|
||||
gfxCoreHelper.setRenderSurfaceStateForScratchResource(rootDeviceEnvironment, stateBuffer, size, addr, offset, pitch, nullptr, false, type, false,
|
||||
true);
|
||||
|
||||
EXPECT_EQ(FamilyType::RENDER_SURFACE_STATE::L1_CACHE_POLICY_WB, surfaceState->getL1CachePolicyL1CacheControl());
|
||||
|
||||
helper.setRenderSurfaceStateForScratchResource(rootDeviceEnvironment, stateBuffer, size, addr, offset, pitch, nullptr, false, type, false,
|
||||
true);
|
||||
ASSERT_EQ(helper.called, true);
|
||||
alignedFree(stateBuffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user