Use uint64_t for sizes to support large sizes

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga 2021-04-24 21:05:26 +00:00 committed by Compute-Runtime-Automation
parent 392b1c8b4d
commit b48192bcfe
4 changed files with 21 additions and 21 deletions

View File

@ -152,8 +152,8 @@ struct CommandListCoreFamily : CommandListImp {
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernelWithGA(void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc, MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernelWithGA(void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset, void *srcPtr, uint64_t dstOffset, void *srcPtr,
NEO::GraphicsAllocation *srcPtrAlloc, NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset, uint32_t size, uint64_t srcOffset, uint64_t size,
uint32_t elementSize, Builtin builtin, uint64_t elementSize, Builtin builtin,
ze_event_handle_t hSignalEvent); ze_event_handle_t hSignalEvent);
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlit(uintptr_t dstPtr, MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlit(uintptr_t dstPtr,
@ -161,7 +161,7 @@ struct CommandListCoreFamily : CommandListImp {
uint64_t dstOffset, uintptr_t srcPtr, uint64_t dstOffset, uintptr_t srcPtr,
NEO::GraphicsAllocation *srcPtrAlloc, NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset, uint64_t srcOffset,
uint32_t size); uint64_t size);
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlitRegion(NEO::GraphicsAllocation *srcAlloc, MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlitRegion(NEO::GraphicsAllocation *srcAlloc,
NEO::GraphicsAllocation *dstAlloc, NEO::GraphicsAllocation *dstAlloc,

View File

@ -704,8 +704,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernelWithGA(v
void *srcPtr, void *srcPtr,
NEO::GraphicsAllocation *srcPtrAlloc, NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset, uint64_t srcOffset,
uint32_t size, uint64_t size,
uint32_t elementSize, uint64_t elementSize,
Builtin builtin, Builtin builtin,
ze_event_handle_t hSignalEvent) { ze_event_handle_t hSignalEvent) {
@ -727,12 +727,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernelWithGA(v
builtinFunction->setArgBufferWithAlloc(0u, *reinterpret_cast<uintptr_t *>(dstPtr), dstPtrAlloc); builtinFunction->setArgBufferWithAlloc(0u, *reinterpret_cast<uintptr_t *>(dstPtr), dstPtrAlloc);
builtinFunction->setArgBufferWithAlloc(1u, *reinterpret_cast<uintptr_t *>(srcPtr), srcPtrAlloc); builtinFunction->setArgBufferWithAlloc(1u, *reinterpret_cast<uintptr_t *>(srcPtr), srcPtrAlloc);
uint32_t elems = size / elementSize; uint64_t elems = size / elementSize;
builtinFunction->setArgumentValue(2, sizeof(elems), &elems); builtinFunction->setArgumentValue(2, sizeof(elems), &elems);
builtinFunction->setArgumentValue(3, sizeof(dstOffset), &dstOffset); builtinFunction->setArgumentValue(3, sizeof(dstOffset), &dstOffset);
builtinFunction->setArgumentValue(4, sizeof(srcOffset), &srcOffset); builtinFunction->setArgumentValue(4, sizeof(srcOffset), &srcOffset);
uint32_t groups = (size + ((groupSizeX * elementSize) - 1)) / (groupSizeX * elementSize); uint32_t groups = static_cast<uint32_t>((size + ((static_cast<uint64_t>(groupSizeX) * elementSize) - 1)) / (static_cast<uint64_t>(groupSizeX) * elementSize));
ze_group_count_t dispatchFuncArgs{groups, 1u, 1u}; ze_group_count_t dispatchFuncArgs{groups, 1u, 1u};
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent); return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent);
@ -744,7 +744,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyBlit(uintptr_t
uint64_t dstOffset, uintptr_t srcPtr, uint64_t dstOffset, uintptr_t srcPtr,
NEO::GraphicsAllocation *srcPtrAlloc, NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset, uint64_t srcOffset,
uint32_t size) { uint64_t size) {
dstOffset += ptrDiff<uintptr_t>(dstPtr, dstPtrAlloc->getGpuAddress()); dstOffset += ptrDiff<uintptr_t>(dstPtr, dstPtrAlloc->getGpuAddress());
srcOffset += ptrDiff<uintptr_t>(srcPtr, srcPtrAlloc->getGpuAddress()); srcOffset += ptrDiff<uintptr_t>(srcPtr, srcPtrAlloc->getGpuAddress());
@ -925,12 +925,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr, ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
dstAllocationStruct.alloc, dstAllocationStruct.offset, dstAllocationStruct.alloc, dstAllocationStruct.offset,
srcAllocationStruct.alignedAllocationPtr, srcAllocationStruct.alignedAllocationPtr,
srcAllocationStruct.alloc, srcAllocationStruct.offset, static_cast<uint32_t>(leftSize)) srcAllocationStruct.alloc, srcAllocationStruct.offset, leftSize)
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr), : appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
dstAllocationStruct.alloc, dstAllocationStruct.offset, dstAllocationStruct.alloc, dstAllocationStruct.offset,
reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr), reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr),
srcAllocationStruct.alloc, srcAllocationStruct.offset, srcAllocationStruct.alloc, srcAllocationStruct.offset,
static_cast<uint32_t>(leftSize), 1, leftSize, 1UL,
Builtin::CopyBufferToBufferSide, Builtin::CopyBufferToBufferSide,
hSignalEvent); hSignalEvent);
} }
@ -939,13 +939,13 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr, ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset, dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset,
srcAllocationStruct.alignedAllocationPtr, srcAllocationStruct.alignedAllocationPtr,
srcAllocationStruct.alloc, leftSize + srcAllocationStruct.offset, static_cast<uint32_t>(middleSizeBytes)) srcAllocationStruct.alloc, leftSize + srcAllocationStruct.offset, middleSizeBytes)
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr), : appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset, dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset,
reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr), reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr),
srcAllocationStruct.alloc, leftSize + srcAllocationStruct.offset, srcAllocationStruct.alloc, leftSize + srcAllocationStruct.offset,
static_cast<uint32_t>(middleSizeBytes), middleSizeBytes,
static_cast<uint32_t>(middleElSize), middleElSize,
Builtin::CopyBufferToBufferMiddle, Builtin::CopyBufferToBufferMiddle,
hSignalEvent); hSignalEvent);
} }
@ -954,12 +954,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr, ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset, dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset,
srcAllocationStruct.alignedAllocationPtr, srcAllocationStruct.alignedAllocationPtr,
srcAllocationStruct.alloc, leftSize + middleSizeBytes + srcAllocationStruct.offset, static_cast<uint32_t>(rightSize)) srcAllocationStruct.alloc, leftSize + middleSizeBytes + srcAllocationStruct.offset, rightSize)
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr), : appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset, dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset,
reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr), reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr),
srcAllocationStruct.alloc, leftSize + middleSizeBytes + srcAllocationStruct.offset, srcAllocationStruct.alloc, leftSize + middleSizeBytes + srcAllocationStruct.offset,
static_cast<uint32_t>(rightSize), 1u, rightSize, 1UL,
Builtin::CopyBufferToBufferSide, Builtin::CopyBufferToBufferSide,
hSignalEvent); hSignalEvent);
} }

View File

@ -40,8 +40,8 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
void *srcPtr, void *srcPtr,
NEO::GraphicsAllocation *srcPtrAlloc, NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset, uint64_t srcOffset,
uint32_t size, uint64_t size,
uint32_t elementSize, uint64_t elementSize,
Builtin builtin, Builtin builtin,
ze_event_handle_t hSignalEvent) override { ze_event_handle_t hSignalEvent) override {
appendMemoryCopyKernelWithGACalledTimes++; appendMemoryCopyKernelWithGACalledTimes++;
@ -52,7 +52,7 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
uint64_t dstOffset, uintptr_t srcPtr, uint64_t dstOffset, uintptr_t srcPtr,
NEO::GraphicsAllocation *srcPtrAlloc, NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset, uint64_t srcOffset,
uint32_t size) override { uint64_t size) override {
appendMemoryCopyBlitCalledTimes++; appendMemoryCopyBlitCalledTimes++;
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;
} }
@ -1062,7 +1062,7 @@ class MockCommandListForMemFill : public WhiteBox<::L0::CommandListCoreFamily<gf
ze_result_t appendMemoryCopyBlit(NEO::GraphicsAllocation *dstPtrAlloc, ze_result_t appendMemoryCopyBlit(NEO::GraphicsAllocation *dstPtrAlloc,
uint64_t dstOffset, uint64_t dstOffset,
NEO::GraphicsAllocation *srcPtrAlloc, NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset, uint32_t size) override { uint64_t srcOffset, uint64_t size) override {
appendMemoryCopyBlitCalledTimes++; appendMemoryCopyBlitCalledTimes++;
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;
} }

View File

@ -33,7 +33,7 @@ class MockCommandListForMemFill : public WhiteBox<::L0::CommandListCoreFamily<gf
uint64_t dstOffset, uintptr_t srcPtr, uint64_t dstOffset, uintptr_t srcPtr,
NEO::GraphicsAllocation *srcPtrAlloc, NEO::GraphicsAllocation *srcPtrAlloc,
uint64_t srcOffset, uint64_t srcOffset,
uint32_t size) override { uint64_t size) override {
appendMemoryCopyBlitCalledTimes++; appendMemoryCopyBlitCalledTimes++;
return ZE_RESULT_SUCCESS; return ZE_RESULT_SUCCESS;
} }
@ -161,7 +161,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListThenDcFlushIsNotAddedAfterBl
uintptr_t dstPtr = 0x7001; uintptr_t dstPtr = 0x7001;
uint64_t srcOffset = 0x101; uint64_t srcOffset = 0x101;
uint64_t dstOffset = 0x201; uint64_t dstOffset = 0x201;
uint32_t copySize = 0x301; uint64_t copySize = 0x301;
NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY, NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
reinterpret_cast<void *>(srcPtr), 0x1000, 0, sizeof(uint32_t), reinterpret_cast<void *>(srcPtr), 0x1000, 0, sizeof(uint32_t),
MemoryPool::System4KBPages); MemoryPool::System4KBPages);