Only use blitter on dg1 for allocations with no cpu pointer.

Change-Id: Id52df50f5630461ffc83097d7e74d402599bed56
Signed-off-by: Piotr Zdunowski <piotr.zdunowski@intel.com>
This commit is contained in:
Piotr Zdunowski
2020-08-31 15:34:23 +02:00
committed by sys_ocldev
parent 442b6cfc47
commit a568739061
9 changed files with 34 additions and 13 deletions

View File

@@ -8,6 +8,7 @@
#include "shared/source/utilities/compiler_support.h" #include "shared/source/utilities/compiler_support.h"
#include "opencl/test/unit_test/helpers/hw_helper_tests.h" #include "opencl/test/unit_test/helpers/hw_helper_tests.h"
#include "opencl/test/unit_test/mocks/mock_graphics_allocation.h"
using HwHelperTestDg1 = HwHelperTest; using HwHelperTestDg1 = HwHelperTest;
@@ -76,7 +77,22 @@ DG1TEST_F(HwHelperTestDg1, givenDg1AndVariousSteppingsWhenGettingIsWorkaroundReq
} }
} }
DG1TEST_F(HwHelperTestDg1, givenDg1WhenPatchingGlobalBuffersThenUseBlitter) { DG1TEST_F(HwHelperTestDg1, givenDg1WhenPatchingCPUAccessibleGlobalBuffersThenDontUseBlitter) {
uint64_t gpuAddress = 0x1000;
void *buffer = reinterpret_cast<void *>(gpuAddress);
size_t size = 0x1000;
MockGraphicsAllocation mockAllocation(buffer, gpuAddress, size);
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
EXPECT_TRUE(hwHelper.forceBlitterUseForGlobalBuffers(hardwareInfo)); EXPECT_FALSE(hwHelper.forceBlitterUseForGlobalBuffers(hardwareInfo, &mockAllocation));
}
DG1TEST_F(HwHelperTestDg1, givenDg1WhenPatchingCPUInaccessibleGlobalBuffersThenUseBlitter) {
uint64_t gpuAddress = 0x1000;
void *buffer = reinterpret_cast<void *>(0x0);
size_t size = 0x1000;
MockGraphicsAllocation mockAllocation(buffer, gpuAddress, size);
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
EXPECT_TRUE(hwHelper.forceBlitterUseForGlobalBuffers(hardwareInfo, &mockAllocation));
} }

View File

@@ -953,8 +953,13 @@ HWTEST_F(HwHelperTest, whenPatchingGlobalBuffersThenDontForceBlitter) {
if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) { if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
GTEST_SKIP(); GTEST_SKIP();
} }
uint64_t gpuAddress = 0x1000;
void *buffer = reinterpret_cast<void *>(0x0);
size_t size = 0x1000;
MockGraphicsAllocation mockAllocation(buffer, gpuAddress, size);
HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily); HwHelper &hwHelper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
EXPECT_FALSE(hwHelper.forceBlitterUseForGlobalBuffers(hardwareInfo)); EXPECT_FALSE(hwHelper.forceBlitterUseForGlobalBuffers(hardwareInfo, &mockAllocation));
} }
HWTEST_F(HwHelperTest, givenVariousDebugKeyValuesWhenGettingLocalMemoryAccessModeThenCorrectValueIsReturned) { HWTEST_F(HwHelperTest, givenVariousDebugKeyValuesWhenGettingLocalMemoryAccessModeThenCorrectValueIsReturned) {

View File

@@ -267,7 +267,7 @@ void Linker::patchDataSegments(const SegmentInfo &globalVariablesSegInfo, const
if (pDevice && initData) { if (pDevice && initData) {
auto &hwInfo = pDevice->getHardwareInfo(); auto &hwInfo = pDevice->getHardwareInfo();
auto &helper = HwHelper::get(hwInfo.platform.eRenderCoreFamily); auto &helper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
if (dst->isAllocatedInLocalMemoryPool() && (helper.isBlitCopyRequiredForLocalMemory(hwInfo) || helper.forceBlitterUseForGlobalBuffers(hwInfo))) { if (dst->isAllocatedInLocalMemoryPool() && (helper.isBlitCopyRequiredForLocalMemory(hwInfo) || helper.forceBlitterUseForGlobalBuffers(hwInfo, dst))) {
useBlitter = true; useBlitter = true;
} }
} }

View File

@@ -64,7 +64,7 @@ bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) {
return (hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP || hwInfo.platform.eProductFamily == IGFX_ROCKETLAKE); return (hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP || hwInfo.platform.eProductFamily == IGFX_ROCKETLAKE);
} }
bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo) { bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation) {
return false; return false;
} }

View File

@@ -36,7 +36,7 @@ void setAdditionalPipelineSelectFields(void *pipelineSelectCmd,
bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo); bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo);
bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo); bool isForceEmuInt32DivRemSPWARequired(const HardwareInfo &hwInfo);
bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo); bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo);
bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo); bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation);
} // namespace Gen12LPHelpers } // namespace Gen12LPHelpers
} // namespace NEO } // namespace NEO

View File

@@ -89,8 +89,8 @@ bool is3DPipelineSelectWARequired(const HardwareInfo &hwInfo) {
return (hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP || hwInfo.platform.eProductFamily == IGFX_DG1 || hwInfo.platform.eProductFamily == IGFX_ROCKETLAKE); return (hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP || hwInfo.platform.eProductFamily == IGFX_DG1 || hwInfo.platform.eProductFamily == IGFX_ROCKETLAKE);
} }
bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo) { bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation) {
if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_DG1) { if (hwInfo.platform.eProductFamily == PRODUCT_FAMILY::IGFX_DG1 && allocation->getUnderlyingBuffer() == 0) {
return true; return true;
} }

View File

@@ -194,8 +194,8 @@ void HwHelperHw<Family>::addEngineToEngineGroup(std::vector<std::vector<EngineCo
} }
template <> template <>
bool HwHelperHw<Family>::forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo) const { bool HwHelperHw<Family>::forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation) const {
return Gen12LPHelpers::forceBlitterUseForGlobalBuffers(hwInfo); return Gen12LPHelpers::forceBlitterUseForGlobalBuffers(hwInfo, allocation);
} }
template <> template <>

View File

@@ -70,7 +70,7 @@ class HwHelper {
virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0; virtual bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) = 0;
virtual bool allowRenderCompression(const HardwareInfo &hwInfo) const = 0; virtual bool allowRenderCompression(const HardwareInfo &hwInfo) const = 0;
virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo) const = 0; virtual bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo) const = 0;
virtual bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo) const = 0; virtual bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation) const = 0;
virtual LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0; virtual LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo); static bool renderCompressedBuffersSupported(const HardwareInfo &hwInfo);
static bool renderCompressedImagesSupported(const HardwareInfo &hwInfo); static bool renderCompressedImagesSupported(const HardwareInfo &hwInfo);
@@ -306,7 +306,7 @@ class HwHelperHw : public HwHelper {
bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo) const override; bool isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo) const override;
bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo) const override; bool forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation) const override;
LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override; LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;

View File

@@ -413,7 +413,7 @@ inline bool HwHelperHw<GfxFamily>::isBlitCopyRequiredForLocalMemory(const Hardwa
} }
template <typename GfxFamily> template <typename GfxFamily>
inline bool HwHelperHw<GfxFamily>::forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo) const { inline bool HwHelperHw<GfxFamily>::forceBlitterUseForGlobalBuffers(const HardwareInfo &hwInfo, GraphicsAllocation *allocation) const {
return false; return false;
} }