Fix using offsetted host memory for multiple mem copy calls

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2022-02-11 17:24:00 +00:00
committed by Compute-Runtime-Automation
parent e99c224c0a
commit e51f8ceb0d
2 changed files with 7 additions and 1 deletions

View File

@@ -1757,6 +1757,10 @@ inline AlignedAllocationData CommandListCoreFamily<gfxCoreFamily>::getAlignedAll
} else {
alloc = getHostPtrAlloc(buffer, bufferSize, hostCopyAllowed);
alignedPtr = static_cast<uintptr_t>(alignDown(alloc->getGpuAddress(), NEO::EncodeSurfaceState<GfxFamily>::getSurfaceBaseAddressAlignment()));
auto hostAllocCpuPtr = reinterpret_cast<uintptr_t>(alloc->getUnderlyingBuffer());
hostAllocCpuPtr = alignDown(hostAllocCpuPtr, NEO::EncodeSurfaceState<GfxFamily>::getSurfaceBaseAddressAlignment());
auto allignedPtrOffset = sourcePtr - hostAllocCpuPtr;
alignedPtr = ptrOffset(alignedPtr, allignedPtrOffset);
}
hostPointerNeedsFlush = true;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -230,6 +230,8 @@ HWTEST2_F(CommandListCreate,
size_t offset = 0x21u;
void *offsetMemory = ptrOffset(startMemory, offset);
expectedOffset = ptrDiff(offsetMemory, baseAddress);
size_t alignedOffset = offset & EncodeSurfaceState<FamilyType>::getSurfaceBaseAddressAlignmentMask();
expectedGpuAddress = ptrOffset(expectedGpuAddress, alignedOffset);
EXPECT_EQ(outData.offset + offset, expectedOffset);
outData = commandList->getAlignedAllocation(device, offsetMemory, 4u, false);