Correct isBlitCopyRequiredForLocalMemory

detect not lockable allocation based on gmm flag
Related-To: NEO-5733

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-05-19 11:20:56 +00:00
committed by Compute-Runtime-Automation
parent 1bca3b2ab5
commit b50a6bec82
5 changed files with 17 additions and 2 deletions

View File

@ -58,7 +58,7 @@ bool CommandStreamReceiverSimulatedCommonHw<GfxFamily>::getParametersForWriteMem
if (size == 0)
return false;
if (cpuAddress == nullptr && !gmm->resourceParams.Flags.Info.NotLockable) {
if (cpuAddress == nullptr && graphicsAllocation.isAllocationLockable()) {
cpuAddress = this->getMemoryManager()->lockResource(&graphicsAllocation);
}
return true;

View File

@ -27,6 +27,7 @@
#include "opencl/source/mem_obj/image.h"
#include "opencl/test/unit_test/mocks/mock_buffer.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_gmm.h"
#include "pipe_control_args.h"
@ -986,6 +987,10 @@ HWTEST_F(HwHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequiredFo
EXPECT_FALSE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
graphicsAllocation.overrideMemoryPool(MemoryPool::LocalMemory);
MockGmm mockGmm(pDevice->getGmmClientContext(), nullptr, 100, 100, false, false, false, {});
mockGmm.resourceParams.Flags.Info.NotLockable = true;
graphicsAllocation.setDefaultGmm(&mockGmm);
EXPECT_TRUE(helper.isBlitCopyRequiredForLocalMemory(hwInfo, graphicsAllocation));
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);

View File

@ -454,7 +454,7 @@ inline bool HwHelperHw<GfxFamily>::allowRenderCompression(const HardwareInfo &hw
template <typename GfxFamily>
inline bool HwHelperHw<GfxFamily>::isBlitCopyRequiredForLocalMemory(const HardwareInfo &hwInfo, const GraphicsAllocation &allocation) const {
return allocation.isAllocatedInLocalMemoryPool() &&
(getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed || !GraphicsAllocation::isLockable(allocation.getAllocationType()));
(getLocalMemoryAccessMode(hwInfo) == LocalMemoryAccessMode::CpuAccessDisallowed || !allocation.isAllocationLockable());
}
template <typename GfxFamily>

View File

@ -7,6 +7,7 @@
#include "graphics_allocation.h"
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/memory_manager/memory_manager.h"
@ -71,6 +72,14 @@ uint32_t GraphicsAllocation::getUsedPageSize() const {
}
}
bool GraphicsAllocation::isAllocationLockable() const {
auto gmm = getDefaultGmm();
if (!gmm) {
return true;
}
return 0 == gmm->resourceParams.Flags.Info.NotLockable;
}
constexpr uint32_t GraphicsAllocation::objectNotUsed;
constexpr uint32_t GraphicsAllocation::objectNotResident;
constexpr uint32_t GraphicsAllocation::objectAlwaysResident;

View File

@ -276,6 +276,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
uint32_t getUsedPageSize() const;
bool isAllocatedInLocalMemoryPool() const { return (this->memoryPool == MemoryPool::LocalMemory); }
bool isAllocationLockable() const;
const AubInfo &getAubInfo() const { return aubInfo; }