fix: use image offset instead of xOffset when calculating address for blt

Signed-off-by: Maciej Plewka <maciej.plewka@intel.com>
This commit is contained in:
Maciej Plewka
2025-12-08 15:24:22 +00:00
committed by Compute-Runtime-Automation
parent f93ed96257
commit 64425ada7a
2 changed files with 6 additions and 4 deletions

View File

@@ -858,7 +858,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::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<gfxCoreFamily>::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);

View File

@@ -2840,6 +2840,7 @@ HWTEST_F(CommandListAppend, givenCopyCommandListWhenImageCopyFromFromMemoryExtTh
ze_image_region_t imgRegion = {0, 0, 0, static_cast<uint32_t>(zeDesc.width), 1, 1};
uint32_t rowPitch = static_cast<uint32_t>(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<uint32_t>(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);
}