Skip to content

Commit b48192b

Browse files
Jaime ArteagaCompute-Runtime-Automation
authored andcommitted
Use uint64_t for sizes to support large sizes
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
1 parent 392b1c8 commit b48192b

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

level_zero/core/source/cmdlist/cmdlist_hw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,16 +152,16 @@ struct CommandListCoreFamily : CommandListImp {
152152
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyKernelWithGA(void *dstPtr, NEO::GraphicsAllocation *dstPtrAlloc,
153153
uint64_t dstOffset, void *srcPtr,
154154
NEO::GraphicsAllocation *srcPtrAlloc,
155-
uint64_t srcOffset, uint32_t size,
156-
uint32_t elementSize, Builtin builtin,
155+
uint64_t srcOffset, uint64_t size,
156+
uint64_t elementSize, Builtin builtin,
157157
ze_event_handle_t hSignalEvent);
158158

159159
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlit(uintptr_t dstPtr,
160160
NEO::GraphicsAllocation *dstPtrAlloc,
161161
uint64_t dstOffset, uintptr_t srcPtr,
162162
NEO::GraphicsAllocation *srcPtrAlloc,
163163
uint64_t srcOffset,
164-
uint32_t size);
164+
uint64_t size);
165165

166166
MOCKABLE_VIRTUAL ze_result_t appendMemoryCopyBlitRegion(NEO::GraphicsAllocation *srcAlloc,
167167
NEO::GraphicsAllocation *dstAlloc,

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernelWithGA(v
704704
void *srcPtr,
705705
NEO::GraphicsAllocation *srcPtrAlloc,
706706
uint64_t srcOffset,
707-
uint32_t size,
708-
uint32_t elementSize,
707+
uint64_t size,
708+
uint64_t elementSize,
709709
Builtin builtin,
710710
ze_event_handle_t hSignalEvent) {
711711

@@ -727,12 +727,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyKernelWithGA(v
727727
builtinFunction->setArgBufferWithAlloc(0u, *reinterpret_cast<uintptr_t *>(dstPtr), dstPtrAlloc);
728728
builtinFunction->setArgBufferWithAlloc(1u, *reinterpret_cast<uintptr_t *>(srcPtr), srcPtrAlloc);
729729

730-
uint32_t elems = size / elementSize;
730+
uint64_t elems = size / elementSize;
731731
builtinFunction->setArgumentValue(2, sizeof(elems), &elems);
732732
builtinFunction->setArgumentValue(3, sizeof(dstOffset), &dstOffset);
733733
builtinFunction->setArgumentValue(4, sizeof(srcOffset), &srcOffset);
734734

735-
uint32_t groups = (size + ((groupSizeX * elementSize) - 1)) / (groupSizeX * elementSize);
735+
uint32_t groups = static_cast<uint32_t>((size + ((static_cast<uint64_t>(groupSizeX) * elementSize) - 1)) / (static_cast<uint64_t>(groupSizeX) * elementSize));
736736
ze_group_count_t dispatchFuncArgs{groups, 1u, 1u};
737737

738738
return CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernelSplit(builtinFunction->toHandle(), &dispatchFuncArgs, hSignalEvent);
@@ -744,7 +744,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyBlit(uintptr_t
744744
uint64_t dstOffset, uintptr_t srcPtr,
745745
NEO::GraphicsAllocation *srcPtrAlloc,
746746
uint64_t srcOffset,
747-
uint32_t size) {
747+
uint64_t size) {
748748
dstOffset += ptrDiff<uintptr_t>(dstPtr, dstPtrAlloc->getGpuAddress());
749749
srcOffset += ptrDiff<uintptr_t>(srcPtr, srcPtrAlloc->getGpuAddress());
750750

@@ -925,12 +925,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
925925
ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
926926
dstAllocationStruct.alloc, dstAllocationStruct.offset,
927927
srcAllocationStruct.alignedAllocationPtr,
928-
srcAllocationStruct.alloc, srcAllocationStruct.offset, static_cast<uint32_t>(leftSize))
928+
srcAllocationStruct.alloc, srcAllocationStruct.offset, leftSize)
929929
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
930930
dstAllocationStruct.alloc, dstAllocationStruct.offset,
931931
reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr),
932932
srcAllocationStruct.alloc, srcAllocationStruct.offset,
933-
static_cast<uint32_t>(leftSize), 1,
933+
leftSize, 1UL,
934934
Builtin::CopyBufferToBufferSide,
935935
hSignalEvent);
936936
}
@@ -939,13 +939,13 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
939939
ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
940940
dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset,
941941
srcAllocationStruct.alignedAllocationPtr,
942-
srcAllocationStruct.alloc, leftSize + srcAllocationStruct.offset, static_cast<uint32_t>(middleSizeBytes))
942+
srcAllocationStruct.alloc, leftSize + srcAllocationStruct.offset, middleSizeBytes)
943943
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
944944
dstAllocationStruct.alloc, leftSize + dstAllocationStruct.offset,
945945
reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr),
946946
srcAllocationStruct.alloc, leftSize + srcAllocationStruct.offset,
947-
static_cast<uint32_t>(middleSizeBytes),
948-
static_cast<uint32_t>(middleElSize),
947+
middleSizeBytes,
948+
middleElSize,
949949
Builtin::CopyBufferToBufferMiddle,
950950
hSignalEvent);
951951
}
@@ -954,12 +954,12 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
954954
ret = isCopyOnly() ? appendMemoryCopyBlit(dstAllocationStruct.alignedAllocationPtr,
955955
dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset,
956956
srcAllocationStruct.alignedAllocationPtr,
957-
srcAllocationStruct.alloc, leftSize + middleSizeBytes + srcAllocationStruct.offset, static_cast<uint32_t>(rightSize))
957+
srcAllocationStruct.alloc, leftSize + middleSizeBytes + srcAllocationStruct.offset, rightSize)
958958
: appendMemoryCopyKernelWithGA(reinterpret_cast<void *>(&dstAllocationStruct.alignedAllocationPtr),
959959
dstAllocationStruct.alloc, leftSize + middleSizeBytes + dstAllocationStruct.offset,
960960
reinterpret_cast<void *>(&srcAllocationStruct.alignedAllocationPtr),
961961
srcAllocationStruct.alloc, leftSize + middleSizeBytes + srcAllocationStruct.offset,
962-
static_cast<uint32_t>(rightSize), 1u,
962+
rightSize, 1UL,
963963
Builtin::CopyBufferToBufferSide,
964964
hSignalEvent);
965965
}

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
4040
void *srcPtr,
4141
NEO::GraphicsAllocation *srcPtrAlloc,
4242
uint64_t srcOffset,
43-
uint32_t size,
44-
uint32_t elementSize,
43+
uint64_t size,
44+
uint64_t elementSize,
4545
Builtin builtin,
4646
ze_event_handle_t hSignalEvent) override {
4747
appendMemoryCopyKernelWithGACalledTimes++;
@@ -52,7 +52,7 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
5252
uint64_t dstOffset, uintptr_t srcPtr,
5353
NEO::GraphicsAllocation *srcPtrAlloc,
5454
uint64_t srcOffset,
55-
uint32_t size) override {
55+
uint64_t size) override {
5656
appendMemoryCopyBlitCalledTimes++;
5757
return ZE_RESULT_SUCCESS;
5858
}
@@ -1062,7 +1062,7 @@ class MockCommandListForMemFill : public WhiteBox<::L0::CommandListCoreFamily<gf
10621062
ze_result_t appendMemoryCopyBlit(NEO::GraphicsAllocation *dstPtrAlloc,
10631063
uint64_t dstOffset,
10641064
NEO::GraphicsAllocation *srcPtrAlloc,
1065-
uint64_t srcOffset, uint32_t size) override {
1065+
uint64_t srcOffset, uint64_t size) override {
10661066
appendMemoryCopyBlitCalledTimes++;
10671067
return ZE_RESULT_SUCCESS;
10681068
}

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_blit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class MockCommandListForMemFill : public WhiteBox<::L0::CommandListCoreFamily<gf
3333
uint64_t dstOffset, uintptr_t srcPtr,
3434
NEO::GraphicsAllocation *srcPtrAlloc,
3535
uint64_t srcOffset,
36-
uint32_t size) override {
36+
uint64_t size) override {
3737
appendMemoryCopyBlitCalledTimes++;
3838
return ZE_RESULT_SUCCESS;
3939
}
@@ -161,7 +161,7 @@ HWTEST2_F(AppendMemoryCopy, givenCopyOnlyCommandListThenDcFlushIsNotAddedAfterBl
161161
uintptr_t dstPtr = 0x7001;
162162
uint64_t srcOffset = 0x101;
163163
uint64_t dstOffset = 0x201;
164-
uint32_t copySize = 0x301;
164+
uint64_t copySize = 0x301;
165165
NEO::MockGraphicsAllocation mockAllocationSrc(0, NEO::GraphicsAllocation::AllocationType::INTERNAL_HOST_MEMORY,
166166
reinterpret_cast<void *>(srcPtr), 0x1000, 0, sizeof(uint32_t),
167167
MemoryPool::System4KBPages);

0 commit comments

Comments
 (0)