mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Move local memory access mode getters from HwHelper to HwInfoConfig
Signed-off-by: Rafal Maziejuk <rafal.maziejuk@intel.com> Related-To: NEO-4541
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
0222649dba
commit
09ac89339e
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/device_binary_format/patchtokens_decoder.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/kernel/kernel_descriptor.h"
|
||||
#include "shared/source/utilities/stackvec.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/helpers/pause_on_gpu_properties.h"
|
||||
#include "shared/source/helpers/vec.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "shared/source/built_ins/built_ins.h"
|
||||
#include "shared/source/gmm_helper/gmm_helper.h"
|
||||
#include "shared/source/helpers/cache_policy.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/memory_manager/allocations_list.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/event/event.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/source/command_queue/command_queue.h"
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/built_ins/built_ins.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/memory_manager/allocations_list.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/unit_test_helper.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/gmm_helper/gmm.h"
|
||||
#include "shared/source/helpers/basic_math.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
|
||||
#include "opencl/test/unit_test/command_queue/enqueue_read_buffer_fixture.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "shared/source/device/device.h"
|
||||
#include "shared/source/helpers/blit_commands_helper.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/mocks/mock_deferred_deleter.h"
|
||||
|
@ -97,16 +97,6 @@ DG1TEST_F(HwHelperTestDg1, givenDg1WhenSteppingB0ThenIntegerDivisionEmulationIsN
|
||||
EXPECT_FALSE(helper.isForceEmuInt32DivRemSPWARequired(hardwareInfo));
|
||||
}
|
||||
|
||||
DG1TEST_F(HwHelperTestDg1, givenDg1WhenGettingLocalMemoryAccessModeThenReturnCpuAccessDefault) {
|
||||
struct MockHwHelper : HwHelperHw<FamilyType> {
|
||||
using HwHelper::getDefaultLocalMemoryAccessMode;
|
||||
};
|
||||
|
||||
auto hwHelper = static_cast<MockHwHelper &>(HwHelper::get(renderCoreFamily));
|
||||
|
||||
EXPECT_EQ(LocalMemoryAccessMode::Default, hwHelper.getDefaultLocalMemoryAccessMode(*defaultHwInfo));
|
||||
}
|
||||
|
||||
DG1TEST_F(HwHelperTestDg1, givenBufferAllocationTypeWhenSetExtraAllocationDataIsCalledThenIsLockableIsSet) {
|
||||
auto &hwHelper = HwHelper::get(renderCoreFamily);
|
||||
AllocationData allocData{};
|
||||
|
@ -14,10 +14,9 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(Dg1HwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
|
||||
if (IGFX_DG1 != productFamily) {
|
||||
return;
|
||||
}
|
||||
using Dg1HwInfoConfig = ::testing::Test;
|
||||
|
||||
DG1TEST_F(Dg1HwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
GT_SYSTEM_INFO >SystemInfo = hwInfo.gtSystemInfo;
|
||||
|
||||
|
@ -82,13 +82,3 @@ TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpAndVariousSteppingsWhenGettingIsWorka
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpWhenGettingLocalMemoryAccessModeThenReturnCpuAccessDefault) {
|
||||
struct MockHwHelper : HwHelperHw<FamilyType> {
|
||||
using HwHelper::getDefaultLocalMemoryAccessMode;
|
||||
};
|
||||
|
||||
auto hwHelper = static_cast<MockHwHelper &>(HwHelper::get(renderCoreFamily));
|
||||
|
||||
EXPECT_EQ(LocalMemoryAccessMode::Default, hwHelper.getDefaultLocalMemoryAccessMode(*defaultHwInfo));
|
||||
}
|
||||
|
@ -953,6 +953,7 @@ HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenMinimalSIMDSizeIsQueriedThen8Is
|
||||
HWTEST_F(HwHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {
|
||||
DebugManagerStateRestore restore{};
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
hwInfo.capabilityTable.blitterOperationsSupported = true;
|
||||
|
||||
@ -961,7 +962,7 @@ HWTEST_F(HwHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLo
|
||||
EXPECT_TRUE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
|
||||
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
|
||||
|
||||
auto expectedDefaultValue = (helper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed);
|
||||
auto expectedDefaultValue = (hwInfoConfig.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed);
|
||||
EXPECT_EQ(expectedDefaultValue, helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
|
||||
@ -1013,23 +1014,6 @@ HWTEST_F(HwHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequiredFo
|
||||
EXPECT_FALSE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
|
||||
}
|
||||
|
||||
HWTEST_F(HwHelperTest, givenVariousDebugKeyValuesWhenGettingLocalMemoryAccessModeThenCorrectValueIsReturned) {
|
||||
struct MockHwHelper : HwHelperHw<FamilyType> {
|
||||
using HwHelper::getDefaultLocalMemoryAccessMode;
|
||||
};
|
||||
|
||||
DebugManagerStateRestore restore{};
|
||||
auto hwHelper = static_cast<MockHwHelper &>(HwHelper::get(renderCoreFamily));
|
||||
EXPECT_EQ(hwHelper.getDefaultLocalMemoryAccessMode(*defaultHwInfo), hwHelper.getLocalMemoryAccessMode(*defaultHwInfo));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::Default, hwHelper.getLocalMemoryAccessMode(*defaultHwInfo));
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::CpuAccessAllowed, hwHelper.getLocalMemoryAccessMode(*defaultHwInfo));
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(3);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::CpuAccessDisallowed, hwHelper.getLocalMemoryAccessMode(*defaultHwInfo));
|
||||
}
|
||||
|
||||
HWTEST2_F(HwHelperTest, givenDefaultHwHelperHwWhenGettingIsBlitCopyRequiredForLocalMemoryThenFalseIsReturned, IsAtMostGen11) {
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
MockGraphicsAllocation graphicsAllocation;
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/memory_manager/allocations_list.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
@ -242,3 +242,21 @@ HWTEST_F(HwInfoConfigTest, WhenAllowStatelessCompressionIsCalledThenReturnCorrec
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, givenVariousDebugKeyValuesWhenGettingLocalMemoryAccessModeThenCorrectValueIsReturned) {
|
||||
struct MockHwInfoConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
|
||||
using HwInfoConfig::getDefaultLocalMemoryAccessMode;
|
||||
};
|
||||
|
||||
DebugManagerStateRestore restore{};
|
||||
auto mockHwInfoConfig = static_cast<MockHwInfoConfig &>(*HwInfoConfig::get(productFamily));
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
EXPECT_EQ(mockHwInfoConfig.getDefaultLocalMemoryAccessMode(pInHwInfo), mockHwInfoConfig.getLocalMemoryAccessMode(pInHwInfo));
|
||||
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::Default, hwInfoConfig.getLocalMemoryAccessMode(pInHwInfo));
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(1);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::CpuAccessAllowed, hwInfoConfig.getLocalMemoryAccessMode(pInHwInfo));
|
||||
DebugManager.flags.ForceLocalMemoryAccessMode.set(3);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::CpuAccessDisallowed, hwInfoConfig.getLocalMemoryAccessMode(pInHwInfo));
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/test_macros/test_checks_shared.h"
|
||||
|
@ -221,8 +221,8 @@ bool MemorySynchronizationCommands<TGLLPFamily>::isPipeControlPriorToPipelineSel
|
||||
|
||||
template <>
|
||||
void HwHelperHw<TGLLPFamily>::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const {
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
if (hwHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
if (hwInfoConfig.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed) {
|
||||
if (GraphicsAllocation::isCpuAccessRequired(properties.allocationType)) {
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ namespace NEO {
|
||||
template <typename GfxFamily>
|
||||
uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitWidthOverride(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
if (hwHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
if (hwInfoConfig.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed) {
|
||||
return 1024;
|
||||
}
|
||||
return 0;
|
||||
@ -29,8 +29,8 @@ uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitWidthOverride(const RootDevice
|
||||
template <typename GfxFamily>
|
||||
uint64_t BlitCommandsHelper<GfxFamily>::getMaxBlitHeightOverride(const RootDeviceEnvironment &rootDeviceEnvironment) {
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
if (hwHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
if (hwInfoConfig.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed) {
|
||||
return 1024;
|
||||
}
|
||||
return 0;
|
||||
|
@ -13,7 +13,9 @@ namespace NEO {
|
||||
|
||||
template <>
|
||||
void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData, const AllocationProperties &properties, const HardwareInfo &hwInfo) const {
|
||||
if (LocalMemoryAccessMode::CpuAccessDisallowed == getLocalMemoryAccessMode(hwInfo)) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
|
||||
if (LocalMemoryAccessMode::CpuAccessDisallowed == hwInfoConfig.getLocalMemoryAccessMode(hwInfo)) {
|
||||
if (properties.allocationType == GraphicsAllocation::AllocationType::LINEAR_STREAM ||
|
||||
properties.allocationType == GraphicsAllocation::AllocationType::INTERNAL_HEAP ||
|
||||
properties.allocationType == GraphicsAllocation::AllocationType::PRINTF_SURFACE ||
|
||||
@ -28,7 +30,6 @@ void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData,
|
||||
}
|
||||
}
|
||||
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
if (hwInfoConfig.allowStatelessCompression(hwInfo)) {
|
||||
if (properties.allocationType == GraphicsAllocation::AllocationType::GLOBAL_SURFACE ||
|
||||
properties.allocationType == GraphicsAllocation::AllocationType::CONSTANT_SURFACE ||
|
||||
|
@ -36,12 +36,6 @@ struct HardwareCapabilities;
|
||||
struct RootDeviceEnvironment;
|
||||
struct PipeControlArgs;
|
||||
|
||||
enum class LocalMemoryAccessMode {
|
||||
Default = 0,
|
||||
CpuAccessAllowed = 1,
|
||||
CpuAccessDisallowed = 3
|
||||
};
|
||||
|
||||
class HwHelper {
|
||||
public:
|
||||
static HwHelper &get(GFXCORE_FAMILY gfxCore);
|
||||
@ -68,7 +62,6 @@ class HwHelper {
|
||||
virtual bool isBufferSizeSuitableForRenderCompression(const size_t size, const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0;
|
||||
virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const = 0;
|
||||
virtual LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
|
||||
static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo);
|
||||
static bool renderCompressedImagesSupported(const HardwareInfo &hwInfo);
|
||||
static bool cacheFlushAfterWalkerSupported(const HardwareInfo &hwInfo);
|
||||
@ -159,8 +152,6 @@ class HwHelper {
|
||||
virtual void adjustPreemptionSurfaceSize(size_t &csrSize) const = 0;
|
||||
|
||||
protected:
|
||||
virtual LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
|
||||
|
||||
HwHelper() = default;
|
||||
};
|
||||
|
||||
@ -316,8 +307,6 @@ class HwHelperHw : public HwHelper {
|
||||
|
||||
bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const override;
|
||||
|
||||
LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
bool isBankOverrideRequired(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
uint32_t getDefaultThreadArbitrationPolicy() const override;
|
||||
@ -391,8 +380,6 @@ class HwHelperHw : public HwHelper {
|
||||
void adjustPreemptionSurfaceSize(size_t &csrSize) const override;
|
||||
|
||||
protected:
|
||||
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
static const AuxTranslationMode defaultAuxTranslationMode;
|
||||
HwHelperHw() = default;
|
||||
};
|
||||
|
@ -421,7 +421,8 @@ inline bool HwHelperHw<GfxFamily>::isSpecialWorkgroupSizeRequired(const Hardware
|
||||
template <typename GfxFamily>
|
||||
inline bool HwHelperHw<GfxFamily>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
|
||||
return allocation.isAllocatedInLocalMemoryPool() &&
|
||||
(getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed || !allocation.isAllocationLockable());
|
||||
(HwInfoConfig::get(hwInfo.platform.eProductFamily)->getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed ||
|
||||
!allocation.isAllocationLockable());
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
@ -470,22 +471,6 @@ size_t HwHelperHw<GfxFamily>::getSingleTimestampPacketSize() const {
|
||||
return TimestampPackets<typename GfxFamily::TimestampPacketType>::getSinglePacketSize();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
LocalMemoryAccessMode HwHelperHw<GfxFamily>::getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||
switch (static_cast<LocalMemoryAccessMode>(DebugManager.flags.ForceLocalMemoryAccessMode.get())) {
|
||||
case LocalMemoryAccessMode::Default:
|
||||
case LocalMemoryAccessMode::CpuAccessAllowed:
|
||||
case LocalMemoryAccessMode::CpuAccessDisallowed:
|
||||
return static_cast<LocalMemoryAccessMode>(DebugManager.flags.ForceLocalMemoryAccessMode.get());
|
||||
}
|
||||
return getDefaultLocalMemoryAccessMode(hwInfo);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline LocalMemoryAccessMode HwHelperHw<GfxFamily>::getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||
return LocalMemoryAccessMode::Default;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t MemorySynchronizationCommands<GfxFamily>::getSizeForFullCacheFlush() {
|
||||
return sizeof(typename GfxFamily::PIPE_CONTROL);
|
||||
|
18
shared/source/helpers/local_memory_access_modes.h
Normal file
18
shared/source/helpers/local_memory_access_modes.h
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace NEO {
|
||||
|
||||
enum class LocalMemoryAccessMode {
|
||||
Default = 0,
|
||||
CpuAccessAllowed = 1,
|
||||
CpuAccessDisallowed = 3
|
||||
};
|
||||
|
||||
} // namespace NEO
|
@ -8,6 +8,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/unified_memory/usm_memory_support.h"
|
||||
|
||||
#include "igfxfmid.h"
|
||||
@ -56,7 +57,12 @@ class HwInfoConfig {
|
||||
virtual bool isDisableOverdispatchAvailable(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool allowRenderCompression(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool allowStatelessCompression(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
|
||||
|
||||
protected:
|
||||
virtual LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
|
||||
|
||||
public:
|
||||
uint32_t threadsPerEu;
|
||||
};
|
||||
|
||||
@ -94,6 +100,7 @@ class HwInfoConfigHw : public HwInfoConfig {
|
||||
bool isDisableOverdispatchAvailable(const HardwareInfo &hwInfo) const override;
|
||||
bool allowRenderCompression(const HardwareInfo &hwInfo) const override;
|
||||
bool allowStatelessCompression(const HardwareInfo &hwInfo) const override;
|
||||
LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
|
||||
|
||||
protected:
|
||||
HwInfoConfigHw() = default;
|
||||
@ -102,6 +109,7 @@ class HwInfoConfigHw : public HwInfoConfig {
|
||||
void enableBlitterOperationsSupport(HardwareInfo *hwInfo);
|
||||
uint64_t getHostMemCapabilitiesValue();
|
||||
bool getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo);
|
||||
LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
|
@ -167,4 +167,20 @@ bool HwInfoConfigHw<gfxProduct>::allowStatelessCompression(const HardwareInfo &h
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
LocalMemoryAccessMode HwInfoConfigHw<gfxProduct>::getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||
return LocalMemoryAccessMode::Default;
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
LocalMemoryAccessMode HwInfoConfigHw<gfxProduct>::getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||
switch (static_cast<LocalMemoryAccessMode>(DebugManager.flags.ForceLocalMemoryAccessMode.get())) {
|
||||
case LocalMemoryAccessMode::Default:
|
||||
case LocalMemoryAccessMode::CpuAccessAllowed:
|
||||
case LocalMemoryAccessMode::CpuAccessDisallowed:
|
||||
return static_cast<LocalMemoryAccessMode>(DebugManager.flags.ForceLocalMemoryAccessMode.get());
|
||||
}
|
||||
return getDefaultLocalMemoryAccessMode(hwInfo);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -90,8 +90,9 @@ void BlitCommandsHelper<Family>::appendExtraMemoryProperties(typename Family::XY
|
||||
|
||||
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
auto &hwHelper = HwHelperHw<Family>::get();
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||
|
||||
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo) && hwHelper.getLocalMemoryAccessMode(*hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed) {
|
||||
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo) && hwInfoConfig.getLocalMemoryAccessMode(*hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed) {
|
||||
blitCmd.setSourceTargetMemory(XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
blitCmd.setDestinationTargetMemory(XY_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
@ -103,9 +104,10 @@ void BlitCommandsHelper<Family>::appendExtraMemoryProperties(typename Family::XY
|
||||
|
||||
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
|
||||
auto &hwHelper = HwHelperHw<Family>::get();
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo->platform.eProductFamily);
|
||||
|
||||
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo) &&
|
||||
hwHelper.getLocalMemoryAccessMode(*hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed) {
|
||||
hwInfoConfig.getLocalMemoryAccessMode(*hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed) {
|
||||
blitCmd.setDestinationTargetMemory(XY_COLOR_BLT::DESTINATION_TARGET_MEMORY::DESTINATION_TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
}
|
||||
|
@ -43,8 +43,8 @@ inline bool HwHelperHw<Family>::isSpecialWorkgroupSizeRequired(const HardwareInf
|
||||
if (DebugManager.flags.ForceWorkgroupSize1x1x1.get() != -1) {
|
||||
return static_cast<bool>(DebugManager.flags.ForceWorkgroupSize1x1x1.get());
|
||||
} else {
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
return (!isSimulation && hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo) && hwHelper.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed);
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
return (!isSimulation && isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo) && hwInfoConfig.getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,14 +117,6 @@ bool HwHelperHw<Family>::isBufferSizeSuitableForRenderCompression(const size_t s
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
LocalMemoryAccessMode HwHelperHw<Family>::getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||
if (isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)) {
|
||||
return LocalMemoryAccessMode::CpuAccessDisallowed;
|
||||
}
|
||||
return LocalMemoryAccessMode::Default;
|
||||
}
|
||||
|
||||
template <>
|
||||
const StackVec<uint32_t, 6> HwHelperHw<Family>::getThreadsPerEUConfigs() const {
|
||||
return {4, 8};
|
||||
|
@ -40,7 +40,7 @@ int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OS
|
||||
template <>
|
||||
bool HwInfoConfigHw<gfxProduct>::getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo) {
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo) && (hwHelper.getLocalMemoryAccessMode(*hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed)) {
|
||||
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo) && (getLocalMemoryAccessMode(*hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -83,3 +83,11 @@ bool HwInfoConfigHw<gfxProduct>::allowStatelessCompression(const HardwareInfo &h
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
LocalMemoryAccessMode HwInfoConfigHw<gfxProduct>::getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||
if (HwHelper::get(hwInfo.platform.eRenderCoreFamily).isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo)) {
|
||||
return LocalMemoryAccessMode::CpuAccessDisallowed;
|
||||
}
|
||||
return LocalMemoryAccessMode::Default;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ int HwInfoConfigHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, OS
|
||||
template <>
|
||||
bool HwInfoConfigHw<gfxProduct>::getHostMemCapabilitiesSupported(const HardwareInfo *hwInfo) {
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo) && (hwHelper.getLocalMemoryAccessMode(*hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed)) {
|
||||
if (hwHelper.isWorkaroundRequired(REVISION_A0, REVISION_B, *hwInfo) && (getLocalMemoryAccessMode(*hwInfo) == LocalMemoryAccessMode::CpuAccessAllowed)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -73,3 +73,14 @@ XEHPTEST_F(TestXeHPHwInfoConfig, givenHwInfoConfigWhenCreateMultipleSubDevicesAn
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
EXPECT_TRUE(hwInfoConfig.allowStatelessCompression(hwInfo));
|
||||
}
|
||||
|
||||
XEHPTEST_F(TestXeHPHwInfoConfig, givenSteppingWhenAskingForLocalMemoryAccessModeThenDisallowOnA0) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::CpuAccessDisallowed, hwInfoConfig.getLocalMemoryAccessMode(hwInfo));
|
||||
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::Default, hwInfoConfig.getLocalMemoryAccessMode(hwInfo));
|
||||
}
|
||||
|
@ -14,21 +14,6 @@
|
||||
using namespace NEO;
|
||||
using HwHelperTestXeHP = ::testing::Test;
|
||||
|
||||
XEHPTEST_F(HwHelperTestXeHP, givenSteppingWhenAskingForLocalMemoryAccessModeThenDisallowOnA0) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
auto renderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily;
|
||||
auto productFamily = defaultHwInfo->platform.eProductFamily;
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(productFamily);
|
||||
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::CpuAccessDisallowed, helper.getLocalMemoryAccessMode(hwInfo));
|
||||
|
||||
hwInfo.platform.usRevId = hwInfoConfig.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::Default, helper.getLocalMemoryAccessMode(hwInfo));
|
||||
}
|
||||
|
||||
XEHPTEST_F(HwHelperTestXeHP, givenSteppingAorBWhenCheckingSipWAThenTrueIsReturned) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
auto renderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily;
|
||||
|
@ -146,6 +146,16 @@ bool HwInfoConfigHw<IGFX_UNKNOWN>::allowStatelessCompression(const HardwareInfo
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
LocalMemoryAccessMode HwInfoConfigHw<IGFX_UNKNOWN>::getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||
return LocalMemoryAccessMode::Default;
|
||||
}
|
||||
|
||||
template <>
|
||||
LocalMemoryAccessMode HwInfoConfigHw<IGFX_UNKNOWN>::getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const {
|
||||
return LocalMemoryAccessMode::Default;
|
||||
}
|
||||
|
||||
void OsAgnosticHwInfoConfigTest::SetUp() {
|
||||
DeviceFixture::SetUp();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/local_memory_access_modes.h"
|
||||
#include "shared/source/program/program_initialization.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
Reference in New Issue
Block a user