From 64425ada7a0dd9306141172003146080bfe5eca4 Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Mon, 8 Dec 2025 15:24:22 +0000 Subject: [PATCH] fix: use image offset instead of xOffset when calculating address for blt Signed-off-by: Maciej Plewka --- level_zero/core/source/cmdlist/cmdlist_hw.inl | 4 ++-- .../core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index a7e7881370..aeb8483f03 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -858,7 +858,7 @@ ze_result_t CommandListCoreFamily::appendImageCopyFromMemoryExt(z size_t imgSlicePitch = image->getImageInfo().slicePitch; this->commandContainer.addToResidencyContainer(allocationStruct.alloc); auto ptr = ptrOffset(allocationStruct.alignedAllocationPtr, allocationStruct.offset); - auto status = appendCopyImageBlit(ptr, nullptr, ptrOffset(image->getAllocation()->getGpuAddress(), imgInfo.xOffset), image->getAllocation(), + auto status = appendCopyImageBlit(ptr, nullptr, ptrOffset(image->getAllocation()->getGpuAddress(), imgInfo.offset), image->getAllocation(), {0, 0, 0}, {pDstRegion->originX, pDstRegion->originY, pDstRegion->originZ}, srcRowPitch, srcSlicePitch, imgRowPitch, imgSlicePitch, bytesPerPixel, {pDstRegion->width, pDstRegion->height, pDstRegion->depth}, {pDstRegion->width, pDstRegion->height, pDstRegion->depth}, imgSize, event, numWaitEvents, phWaitEvents, memoryCopyParams); @@ -1071,7 +1071,7 @@ ze_result_t CommandListCoreFamily::appendImageCopyToMemoryExt(voi size_t imgSlicePitch = imgInfo.slicePitch; this->commandContainer.addToResidencyContainer(allocationStruct.alloc); auto ptr = ptrOffset(allocationStruct.alignedAllocationPtr, allocationStruct.offset); - auto status = appendCopyImageBlit(ptrOffset(image->getAllocation()->getGpuAddress(), imgInfo.xOffset), image->getAllocation(), ptr, nullptr, + auto status = appendCopyImageBlit(ptrOffset(image->getAllocation()->getGpuAddress(), imgInfo.offset), image->getAllocation(), ptr, nullptr, {pSrcRegion->originX, pSrcRegion->originY, pSrcRegion->originZ}, {0, 0, 0}, imgRowPitch, imgSlicePitch, destRowPitch, destSlicePitch, bytesPerPixel, {pSrcRegion->width, pSrcRegion->height, pSrcRegion->depth}, imgSize, {pSrcRegion->width, pSrcRegion->height, pSrcRegion->depth}, event, numWaitEvents, phWaitEvents, memoryCopyParams); diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp index ec9d80a670..f64eac30a1 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_2.cpp @@ -2840,6 +2840,7 @@ HWTEST_F(CommandListAppend, givenCopyCommandListWhenImageCopyFromFromMemoryExtTh ze_image_region_t imgRegion = {0, 0, 0, static_cast(zeDesc.width), 1, 1}; uint32_t rowPitch = static_cast(image->getImageInfo().rowPitch); image->imgInfo.xOffset = 0x1000; + image->imgInfo.offset = 0x10000; uint32_t slicePitch = rowPitch; void *data; ze_host_mem_alloc_desc_t hostDesc = {}; @@ -2848,7 +2849,7 @@ HWTEST_F(CommandListAppend, givenCopyCommandListWhenImageCopyFromFromMemoryExtTh cmdList.appendImageCopyFromMemoryExt(image->toHandle(), srcPtr, &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, copyParams); - EXPECT_EQ(cmdList.appendDstPtr, ptrOffset(image->getAllocation()->getGpuAddress(), image->getImageInfo().xOffset)); + EXPECT_EQ(cmdList.appendDstPtr, ptrOffset(image->getAllocation()->getGpuAddress(), image->getImageInfo().offset)); EXPECT_EQ(cmdList.appendDstAlloc, image->getAllocation()); context->freeMem(data); } @@ -2912,6 +2913,7 @@ HWTEST_F(CommandListAppend, givenCopyCommandListWhenImageCopyFromToMemoryExtThen uint32_t rowPitch = static_cast(image->getImageInfo().rowPitch); uint32_t slicePitch = rowPitch; image->imgInfo.xOffset = 0x1000; + image->imgInfo.offset = 0x10000; void *data; ze_host_mem_alloc_desc_t hostDesc = {}; context->allocHostMem(&hostDesc, 64u, 64u, &data); @@ -2919,7 +2921,7 @@ HWTEST_F(CommandListAppend, givenCopyCommandListWhenImageCopyFromToMemoryExtThen cmdList.appendImageCopyToMemoryExt(dstPtr, image->toHandle(), &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, copyParams); - EXPECT_EQ(cmdList.appendSrcPtr, ptrOffset(image->getAllocation()->getGpuAddress(), image->getImageInfo().xOffset)); + EXPECT_EQ(cmdList.appendSrcPtr, ptrOffset(image->getAllocation()->getGpuAddress(), image->getImageInfo().offset)); EXPECT_EQ(cmdList.appendSrcAlloc, image->getAllocation()); context->freeMem(data); }