feature: copy offload support for images

Related-To: NEO-7067

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2025-05-14 16:05:56 +00:00
committed by Compute-Runtime-Automation
parent 679b9949ba
commit ef0c525847
18 changed files with 397 additions and 192 deletions

View File

@@ -60,7 +60,9 @@ ze_result_t zeCommandListAppendImageCopy(
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
return L0::CommandList::fromHandle(hCommandList)->appendImageCopy(hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents, false);
CmdListMemoryCopyParams memoryCopyParams = {};
return L0::CommandList::fromHandle(hCommandList)->appendImageCopy(hDstImage, hSrcImage, hSignalEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
}
ze_result_t zeCommandListAppendImageCopyRegion(
@@ -72,7 +74,8 @@ ze_result_t zeCommandListAppendImageCopyRegion(
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyRegion(hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents, false);
CmdListMemoryCopyParams memoryCopyParams = {};
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyRegion(hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
}
ze_result_t zeCommandListAppendImageCopyToMemory(
@@ -83,7 +86,8 @@ ze_result_t zeCommandListAppendImageCopyToMemory(
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyToMemory(dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents, false);
CmdListMemoryCopyParams memoryCopyParams = {};
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyToMemory(dstptr, hSrcImage, pSrcRegion, hSignalEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
}
ze_result_t zeCommandListAppendImageCopyFromMemory(
@@ -94,7 +98,8 @@ ze_result_t zeCommandListAppendImageCopyFromMemory(
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyFromMemory(hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents, false);
CmdListMemoryCopyParams memoryCopyParams = {};
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyFromMemory(hDstImage, srcptr, pDstRegion, hSignalEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
}
ze_result_t zeCommandListAppendImageCopyToMemoryExt(
@@ -107,7 +112,8 @@ ze_result_t zeCommandListAppendImageCopyToMemoryExt(
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyToMemoryExt(dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents, false);
CmdListMemoryCopyParams memoryCopyParams = {};
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyToMemoryExt(dstptr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
}
ze_result_t zeCommandListAppendImageCopyFromMemoryExt(
@@ -120,7 +126,8 @@ ze_result_t zeCommandListAppendImageCopyFromMemoryExt(
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents) {
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyFromMemoryExt(hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents, false);
CmdListMemoryCopyParams memoryCopyParams = {};
return L0::CommandList::fromHandle(hCommandList)->appendImageCopyFromMemoryExt(hDstImage, srcptr, pDstRegion, srcRowPitch, srcSlicePitch, hSignalEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
}
ze_result_t zeCommandListAppendMemoryPrefetch(

View File

@@ -88,28 +88,28 @@ struct CommandList : _ze_command_list_handle_t {
virtual ze_result_t appendImageCopyFromMemory(ze_image_handle_t hDstImage, const void *srcptr,
const ze_image_region_t *pDstRegion,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) = 0;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) = 0;
virtual ze_result_t appendImageCopyToMemory(void *dstptr, ze_image_handle_t hSrcImage,
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) = 0;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) = 0;
virtual ze_result_t appendImageCopyFromMemoryExt(ze_image_handle_t hDstImage, const void *srcptr,
const ze_image_region_t *pDstRegion,
uint32_t srcRowPitch, uint32_t srcSlicePitch,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) = 0;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) = 0;
virtual ze_result_t appendImageCopyToMemoryExt(void *dstptr, ze_image_handle_t hSrcImage,
const ze_image_region_t *pSrcRegion,
uint32_t destRowPitch, uint32_t destSlicePitch,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) = 0;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) = 0;
virtual ze_result_t appendImageCopyRegion(ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage,
const ze_image_region_t *pDstRegion, const ze_image_region_t *pSrcRegion,
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) = 0;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) = 0;
virtual ze_result_t appendImageCopy(ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) = 0;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) = 0;
virtual ze_result_t appendLaunchKernel(ze_kernel_handle_t kernelHandle, const ze_group_count_t &threadGroupDimensions,
ze_event_handle_t hEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents,
CmdListKernelLaunchParams &launchParams) = 0;

View File

@@ -94,29 +94,29 @@ struct CommandListCoreFamily : public CommandListImp {
const ze_image_region_t *pDstRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopyToMemory(void *dstptr, ze_image_handle_t hSrcImage,
const ze_image_region_t *pSrcRegion, ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopyFromMemoryExt(ze_image_handle_t hDstImage, const void *srcptr,
const ze_image_region_t *pDstRegion,
uint32_t srcRowPitch, uint32_t srcSlicePitch,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopyToMemoryExt(void *dstptr, ze_image_handle_t hSrcImage,
const ze_image_region_t *pSrcRegion,
uint32_t destRowPitch, uint32_t destSlicePitch,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopyRegion(ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage,
const ze_image_region_t *pDstRegion, const ze_image_region_t *pSrcRegion,
ze_event_handle_t hSignalEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopy(ze_image_handle_t hDstImage, ze_image_handle_t hSrcImage,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendLaunchKernel(ze_kernel_handle_t kernelHandle,
const ze_group_count_t &threadGroupDimensions,
ze_event_handle_t hEvent, uint32_t numWaitEvents,
@@ -290,7 +290,8 @@ struct CommandListCoreFamily : public CommandListImp {
size_t dstRowPitch, size_t dstSlicePitch,
size_t bytesPerPixel, const Vec3<size_t> &copySize,
const Vec3<size_t> &srcSize, const Vec3<size_t> &dstSize,
Event *signalEvent);
Event *signalEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams);
virtual ze_result_t appendLaunchKernelWithParams(Kernel *kernel,
const ze_group_count_t &threadGroupDimensions,

View File

@@ -721,14 +721,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryRangesBarrier(uint
}
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemory(ze_image_handle_t hDstImage,
const void *srcPtr,
const ze_image_region_t *pDstRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemory(ze_image_handle_t hDstImage, const void *srcPtr, const ze_image_region_t *pDstRegion, ze_event_handle_t hEvent,
uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
return appendImageCopyFromMemoryExt(hDstImage, srcPtr, pDstRegion, 0, 0,
hEvent, numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
hEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
}
static ze_image_region_t getRegionFromImageDesc(ze_image_desc_t imgDesc) {
@@ -754,14 +750,8 @@ static ze_image_region_t getRegionFromImageDesc(ze_image_desc_t imgDesc) {
}
template <GFXCORE_FAMILY gfxCoreFamily>
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(ze_image_handle_t hDstImage,
const void *srcPtr,
const ze_image_region_t *pDstRegion,
uint32_t srcRowPitch,
uint32_t srcSlicePitch,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(ze_image_handle_t hDstImage, const void *srcPtr, const ze_image_region_t *pDstRegion, uint32_t srcRowPitch, uint32_t srcSlicePitch,
ze_event_handle_t hEvent, uint32_t numWaitEvents, ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
if (!hDstImage) {
return ZE_RESULT_ERROR_INVALID_NULL_HANDLE;
}
@@ -828,7 +818,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
image = peerImage;
}
if (isCopyOnly(false)) {
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(*allocationStruct.alloc, *image->getAllocation());
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
if ((bytesPerPixel == 3) || (bytesPerPixel == 6) || image->isMimickedImage()) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
@@ -836,7 +828,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
size_t imgSlicePitch = image->getImageInfo().slicePitch;
auto status = appendCopyImageBlit(allocationStruct.alloc, 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);
imgRowPitch, imgSlicePitch, bytesPerPixel, {pDstRegion->width, pDstRegion->height, pDstRegion->depth}, {pDstRegion->width, pDstRegion->height, pDstRegion->depth}, imgSize,
event, numWaitEvents, phWaitEvents, memoryCopyParams);
addToMappedEventList(Event::fromHandle(hEvent));
return status;
}
@@ -927,7 +920,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
CmdListKernelLaunchParams launchParams = {};
launchParams.isBuiltInKernel = true;
launchParams.relaxedOrderingDispatch = relaxedOrderingDispatch;
launchParams.relaxedOrderingDispatch = memoryCopyParams.relaxedOrderingDispatch;
auto status = CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinKernel->toHandle(), kernelArgs,
event, numWaitEvents, phWaitEvents,
@@ -943,9 +936,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemory(void *
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
return appendImageCopyToMemoryExt(dstPtr, hSrcImage, pSrcRegion, 0, 0,
hEvent, numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
hEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -956,7 +949,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
uint32_t destSlicePitch,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
if (!dstPtr) {
return ZE_RESULT_ERROR_INVALID_NULL_POINTER;
}
@@ -1023,7 +1016,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
image = peerImage;
}
if (isCopyOnly(false)) {
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(*image->getAllocation(), *allocationStruct.alloc);
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
if ((bytesPerPixel == 3) || (bytesPerPixel == 6) || image->isMimickedImage()) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
@@ -1032,7 +1027,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
auto status = appendCopyImageBlit(image->getAllocation(), allocationStruct.alloc,
{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);
imgSize, {pSrcRegion->width, pSrcRegion->height, pSrcRegion->depth}, event, numWaitEvents, phWaitEvents, memoryCopyParams);
addToMappedEventList(event);
return status;
}
@@ -1146,7 +1141,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
if constexpr (checkIfAllocationImportedRequired()) {
launchParams.isDestinationAllocationImported = this->isAllocationImported(allocationStruct.alloc, device->getDriverHandle()->getSvmAllocsManager());
}
launchParams.relaxedOrderingDispatch = relaxedOrderingDispatch;
launchParams.relaxedOrderingDispatch = memoryCopyParams.relaxedOrderingDispatch;
ret = CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinKernel->toHandle(), kernelArgs,
event, numWaitEvents, phWaitEvents, launchParams);
addToMappedEventList(event);
@@ -1163,7 +1158,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
auto dstImage = L0::Image::fromHandle(hDstImage);
auto srcImage = L0::Image::fromHandle(hSrcImage);
cl_int4 srcOffset, dstOffset;
@@ -1230,7 +1225,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
srcImage = peerImage;
}
if (isCopyOnly(false)) {
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(*srcImage->getAllocation(), *dstImage->getAllocation());
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
auto bytesPerPixel = static_cast<uint32_t>(srcImage->getImageInfo().surfaceFormat->imageElementSizeInBytes);
ze_image_region_t region = getRegionFromImageDesc(srcImage->getImageDesc());
@@ -1249,7 +1246,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
auto status = appendCopyImageBlit(srcImage->getAllocation(), dstImage->getAllocation(),
{srcRegion.originX, srcRegion.originY, srcRegion.originZ}, {dstRegion.originX, dstRegion.originY, dstRegion.originZ}, srcRowPitch, srcSlicePitch,
dstRowPitch, dstSlicePitch, bytesPerPixel, {srcRegion.width, srcRegion.height, srcRegion.depth}, srcImgSize, dstImgSize, event);
dstRowPitch, dstSlicePitch, bytesPerPixel, {srcRegion.width, srcRegion.height, srcRegion.depth}, srcImgSize, dstImgSize,
event, numWaitEvents, phWaitEvents, memoryCopyParams);
addToMappedEventList(event);
return status;
}
@@ -1291,7 +1289,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
CmdListKernelLaunchParams launchParams = {};
launchParams.isBuiltInKernel = true;
launchParams.relaxedOrderingDispatch = relaxedOrderingDispatch;
launchParams.relaxedOrderingDispatch = memoryCopyParams.relaxedOrderingDispatch;
auto status = CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(kernel->toHandle(), kernelArgs,
event, numWaitEvents, phWaitEvents,
launchParams);
@@ -1305,10 +1303,10 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopy(ze_image_handl
ze_image_handle_t hSrcImage,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
return this->appendImageCopyRegion(hDstImage, hSrcImage, nullptr, nullptr, hEvent,
numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
numWaitEvents, phWaitEvents, memoryCopyParams);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -1606,7 +1604,16 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(NEO::Graph
size_t dstRowPitch, size_t dstSlicePitch,
size_t bytesPerPixel, const Vec3<size_t> &copySize,
const Vec3<size_t> &srcSize, const Vec3<size_t> &dstSize,
Event *signalEvent) {
Event *signalEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
const bool dualStreamCopyOffloadOperation = isDualStreamCopyOffloadOperation(memoryCopyParams.copyOffloadAllowed);
const bool isCopyOnlySignaling = isCopyOnly(dualStreamCopyOffloadOperation) && !useAdditionalBlitProperties;
auto ret = addEventsToCmdList(numWaitEvents, phWaitEvents, nullptr, memoryCopyParams.relaxedOrderingDispatch, false, true, false, dualStreamCopyOffloadOperation);
if (ret != ZE_RESULT_SUCCESS) {
return ret;
}
if (!handleCounterBasedEventOperations(signalEvent)) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
@@ -1629,7 +1636,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(NEO::Graph
bool useAdditionalTimestamp = blitProperties.copySize.z > 1;
if (useAdditionalBlitProperties) {
setAdditionalBlitProperties(blitProperties, signalEvent, useAdditionalTimestamp);
} else {
}
if (isCopyOnlySignaling) {
appendEventForProfiling(signalEvent, nullptr, true, false, false, true);
}
blitProperties.transform1DArrayTo2DArrayIfNeeded();
@@ -1641,7 +1650,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(NEO::Graph
}
dummyBlitWa.isWaRequired = true;
if (!useAdditionalBlitProperties) {
if (isCopyOnlySignaling) {
appendSignalEventPostWalker(signalEvent, nullptr, nullptr, false, false, true);
if (this->isInOrderExecutionEnabled()) {
appendSignalInOrderDependencyCounter(signalEvent, false, false, false);

View File

@@ -125,14 +125,14 @@ struct CommandListCoreFamilyImmediate : public CommandListCoreFamily<gfxCoreFami
const ze_image_region_t *pDstRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopyToMemory(void *dstPtr,
ze_image_handle_t hSrcImage,
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopyFromMemoryExt(ze_image_handle_t hDstImage,
const void *srcPtr,
@@ -141,7 +141,7 @@ struct CommandListCoreFamilyImmediate : public CommandListCoreFamily<gfxCoreFami
uint32_t srcSlicePitch,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopyToMemoryExt(void *dstPtr,
ze_image_handle_t hSrcImage,
@@ -150,13 +150,12 @@ struct CommandListCoreFamilyImmediate : public CommandListCoreFamily<gfxCoreFami
uint32_t destSlicePitch,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopy(
ze_image_handle_t dst, ze_image_handle_t src,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_result_t appendImageCopy(ze_image_handle_t dst, ze_image_handle_t src,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendImageCopyRegion(ze_image_handle_t hDstImage,
ze_image_handle_t hSrcImage,
@@ -164,7 +163,7 @@ struct CommandListCoreFamilyImmediate : public CommandListCoreFamily<gfxCoreFami
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) override;
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override;
ze_result_t appendMemoryRangesBarrier(uint32_t numRanges,
const size_t *pRangeSizes,

View File

@@ -872,10 +872,10 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopy(
ze_image_handle_t dst, ze_image_handle_t src,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
return CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyRegion(dst, src, nullptr, nullptr, hSignalEvent,
numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
numWaitEvents, phWaitEvents, memoryCopyParams);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -885,8 +885,8 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyRegion
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
memoryCopyParams.relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
auto estimatedSize = commonImmediateCommandSize;
if (isCopyOnly(false)) {
@@ -895,12 +895,13 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyRegion
auto sizePerBlit = sizeof(typename GfxFamily::XY_BLOCK_COPY_BLT) + NEO::BlitCommandsHelper<GfxFamily>::estimatePostBlitCommandSize();
estimatedSize += nBlits * sizePerBlit;
}
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch, estimatedSize, false);
checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, estimatedSize, false);
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(hDstImage, hSrcImage, pDstRegion, pSrcRegion, hSignalEvent,
numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
numWaitEvents, phWaitEvents, memoryCopyParams);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, relaxedOrderingDispatch), relaxedOrderingDispatch, NEO::AppendOperations::kernel, false, hSignalEvent, false, nullptr, nullptr);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch), memoryCopyParams.relaxedOrderingDispatch, NEO::AppendOperations::kernel,
memoryCopyParams.copyOffloadAllowed, hSignalEvent, false, nullptr, nullptr);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -910,15 +911,16 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyFromMe
const ze_image_region_t *pDstRegion,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
memoryCopyParams.relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch, commonImmediateCommandSize, false);
checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, commonImmediateCommandSize, false);
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemory(hDstImage, srcPtr, pDstRegion, hSignalEvent,
numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
numWaitEvents, phWaitEvents, memoryCopyParams);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, relaxedOrderingDispatch), relaxedOrderingDispatch, NEO::AppendOperations::kernel, false, hSignalEvent, false, nullptr, nullptr);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch), memoryCopyParams.relaxedOrderingDispatch, NEO::AppendOperations::kernel,
memoryCopyParams.copyOffloadAllowed, hSignalEvent, false, nullptr, nullptr);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -928,15 +930,16 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyToMemo
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
memoryCopyParams.relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch, commonImmediateCommandSize, false);
checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, commonImmediateCommandSize, false);
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemory(dstPtr, hSrcImage, pSrcRegion, hSignalEvent,
numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
numWaitEvents, phWaitEvents, memoryCopyParams);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, relaxedOrderingDispatch), relaxedOrderingDispatch, NEO::AppendOperations::kernel, false, hSignalEvent, false, nullptr, nullptr);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch), memoryCopyParams.relaxedOrderingDispatch, NEO::AppendOperations::kernel,
memoryCopyParams.copyOffloadAllowed, hSignalEvent, false, nullptr, nullptr);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -948,15 +951,16 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyFromMe
uint32_t srcSlicePitch,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
memoryCopyParams.relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch, commonImmediateCommandSize, false);
checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, commonImmediateCommandSize, false);
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(hDstImage, srcPtr, pDstRegion, srcRowPitch, srcSlicePitch,
hSignalEvent, numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
hSignalEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, relaxedOrderingDispatch), relaxedOrderingDispatch, NEO::AppendOperations::kernel, false, hSignalEvent, false, nullptr, nullptr);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch), memoryCopyParams.relaxedOrderingDispatch, NEO::AppendOperations::kernel,
memoryCopyParams.copyOffloadAllowed, hSignalEvent, false, nullptr, nullptr);
}
template <GFXCORE_FAMILY gfxCoreFamily>
@@ -968,15 +972,16 @@ ze_result_t CommandListCoreFamilyImmediate<gfxCoreFamily>::appendImageCopyToMemo
uint32_t destSlicePitch,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch) {
relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) {
memoryCopyParams.relaxedOrderingDispatch = isRelaxedOrderingDispatchAllowed(numWaitEvents, false);
checkAvailableSpace(numWaitEvents, relaxedOrderingDispatch, commonImmediateCommandSize, false);
checkAvailableSpace(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch, commonImmediateCommandSize, false);
auto ret = CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(dstPtr, hSrcImage, pSrcRegion, destRowPitch, destSlicePitch,
hSignalEvent, numWaitEvents, phWaitEvents, relaxedOrderingDispatch);
hSignalEvent, numWaitEvents, phWaitEvents, memoryCopyParams);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, relaxedOrderingDispatch), relaxedOrderingDispatch, NEO::AppendOperations::kernel, false, hSignalEvent, false, nullptr, nullptr);
return flushImmediate(ret, true, hasStallingCmdsForRelaxedOrdering(numWaitEvents, memoryCopyParams.relaxedOrderingDispatch), memoryCopyParams.relaxedOrderingDispatch, NEO::AppendOperations::kernel,
memoryCopyParams.copyOffloadAllowed, hSignalEvent, false, nullptr, nullptr);
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@@ -409,7 +409,7 @@ struct MockCommandList : public CommandList {
const ze_image_region_t *pDstRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch));
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams));
ADDMETHOD_NOBASE(appendImageCopyToMemory, ze_result_t, ZE_RESULT_SUCCESS,
(void *dstptr,
@@ -417,7 +417,7 @@ struct MockCommandList : public CommandList {
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch));
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams));
ADDMETHOD_NOBASE(appendImageCopyFromMemoryExt, ze_result_t, ZE_RESULT_SUCCESS,
(ze_image_handle_t hDstImage,
@@ -426,7 +426,7 @@ struct MockCommandList : public CommandList {
uint32_t srcRowPitch, uint32_t srcSlicePitch,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch));
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams));
ADDMETHOD_NOBASE(appendImageCopyToMemoryExt, ze_result_t, ZE_RESULT_SUCCESS,
(void *dstptr,
@@ -435,7 +435,7 @@ struct MockCommandList : public CommandList {
uint32_t destRowPitch, uint32_t destSlicePitch,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch));
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams));
ADDMETHOD_NOBASE(appendImageCopyRegion, ze_result_t, ZE_RESULT_SUCCESS,
(ze_image_handle_t hDstImage,
@@ -444,14 +444,14 @@ struct MockCommandList : public CommandList {
const ze_image_region_t *pSrcRegion,
ze_event_handle_t hSignalEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch));
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams));
ADDMETHOD_NOBASE(appendImageCopy, ze_result_t, ZE_RESULT_SUCCESS,
(ze_image_handle_t hDstImage,
ze_image_handle_t hSrcImage,
ze_event_handle_t hEvent,
uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, bool relaxedOrderingDispatch));
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams));
ADDMETHOD_NOBASE(appendMemAdvise, ze_result_t, ZE_RESULT_SUCCESS,
(ze_device_handle_t hDevice,

View File

@@ -1425,15 +1425,17 @@ HWTEST2_F(CommandListCreateTests, givenDirectSubmissionAndImmCmdListWhenDispatch
image->initialize(device, &zeDesc);
auto bytesPerPixel = static_cast<uint32_t>(image->getImageInfo().surfaceFormat->imageElementSizeInBytes);
verifyFlags(commandList->appendImageCopyRegion(image->toHandle(), image->toHandle(), &imgRegion, &imgRegion, nullptr, 0, nullptr, false), false, false);
CmdListMemoryCopyParams copyParams = {};
verifyFlags(commandList->appendImageCopyFromMemory(image->toHandle(), dstPtr, &imgRegion, nullptr, 0, nullptr, false), false, false);
verifyFlags(commandList->appendImageCopyRegion(image->toHandle(), image->toHandle(), &imgRegion, &imgRegion, nullptr, 0, nullptr, copyParams), false, false);
verifyFlags(commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &imgRegion, nullptr, 0, nullptr, false), false, false);
verifyFlags(commandList->appendImageCopyFromMemory(image->toHandle(), dstPtr, &imgRegion, nullptr, 0, nullptr, copyParams), false, false);
verifyFlags(commandList->appendImageCopyFromMemoryExt(image->toHandle(), dstPtr, &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, 0, nullptr, false), false, false);
verifyFlags(commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &imgRegion, nullptr, 0, nullptr, copyParams), false, false);
verifyFlags(commandList->appendImageCopyToMemoryExt(dstPtr, image->toHandle(), &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, 0, nullptr, false), false, false);
verifyFlags(commandList->appendImageCopyFromMemoryExt(image->toHandle(), dstPtr, &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, 0, nullptr, copyParams), false, false);
verifyFlags(commandList->appendImageCopyToMemoryExt(dstPtr, image->toHandle(), &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, 0, nullptr, copyParams), false, false);
}
size_t rangeSizes = 1;
@@ -1567,21 +1569,21 @@ HWTEST2_F(CommandListCreateTests, givenDirectSubmissionAndImmCmdListWhenDispatch
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
image->initialize(device, &zeDesc);
auto bytesPerPixel = static_cast<uint32_t>(image->getImageInfo().surfaceFormat->imageElementSizeInBytes);
CmdListMemoryCopyParams copyParams = {};
resetFlags();
verifyFlags(commandList->appendImageCopyRegion(image->toHandle(), image->toHandle(), &imgRegion, &imgRegion, nullptr, numWaitEvents, waitlist, copyParams));
resetFlags();
verifyFlags(commandList->appendImageCopyRegion(image->toHandle(), image->toHandle(), &imgRegion, &imgRegion, nullptr, numWaitEvents, waitlist, false));
verifyFlags(commandList->appendImageCopyFromMemory(image->toHandle(), dstPtr, &imgRegion, nullptr, numWaitEvents, waitlist, copyParams));
resetFlags();
verifyFlags(commandList->appendImageCopyFromMemory(image->toHandle(), dstPtr, &imgRegion, nullptr, numWaitEvents, waitlist, false));
verifyFlags(commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &imgRegion, nullptr, numWaitEvents, waitlist, copyParams));
resetFlags();
verifyFlags(commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &imgRegion, nullptr, numWaitEvents, waitlist, false));
verifyFlags(commandList->appendImageCopyFromMemoryExt(image->toHandle(), dstPtr, &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, numWaitEvents, waitlist, copyParams));
resetFlags();
verifyFlags(commandList->appendImageCopyFromMemoryExt(image->toHandle(), dstPtr, &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, numWaitEvents, waitlist, false));
resetFlags();
verifyFlags(commandList->appendImageCopyToMemoryExt(dstPtr, image->toHandle(), &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, numWaitEvents, waitlist, false));
verifyFlags(commandList->appendImageCopyToMemoryExt(dstPtr, image->toHandle(), &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, numWaitEvents, waitlist, copyParams));
}
resetFlags();
@@ -1835,19 +1837,21 @@ HWTEST2_F(CommandListCreateTests, givenDirectSubmissionAndImmCmdListWhenDispatch
image->initialize(device, &zeDesc);
auto bytesPerPixel = static_cast<uint32_t>(image->getImageInfo().surfaceFormat->imageElementSizeInBytes);
verifyFlags(commandList->appendImageCopyRegion(image->toHandle(), image->toHandle(), &imgRegion, &imgRegion, nullptr, numWaitlistEvents, waitlist, false),
CmdListMemoryCopyParams copyParams = {};
verifyFlags(commandList->appendImageCopyRegion(image->toHandle(), image->toHandle(), &imgRegion, &imgRegion, nullptr, numWaitlistEvents, waitlist, copyParams),
hasEventDependencies, hasEventDependencies);
verifyFlags(commandList->appendImageCopyFromMemory(image->toHandle(), dstPtr, &imgRegion, nullptr, numWaitlistEvents, waitlist, false),
verifyFlags(commandList->appendImageCopyFromMemory(image->toHandle(), dstPtr, &imgRegion, nullptr, numWaitlistEvents, waitlist, copyParams),
hasEventDependencies, hasEventDependencies);
verifyFlags(commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &imgRegion, nullptr, numWaitlistEvents, waitlist, false),
verifyFlags(commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &imgRegion, nullptr, numWaitlistEvents, waitlist, copyParams),
hasEventDependencies, hasEventDependencies);
verifyFlags(commandList->appendImageCopyFromMemoryExt(image->toHandle(), dstPtr, &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, numWaitlistEvents, waitlist, false),
verifyFlags(commandList->appendImageCopyFromMemoryExt(image->toHandle(), dstPtr, &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, numWaitlistEvents, waitlist, copyParams),
hasEventDependencies, hasEventDependencies);
verifyFlags(commandList->appendImageCopyToMemoryExt(dstPtr, image->toHandle(), &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, numWaitlistEvents, waitlist, false),
verifyFlags(commandList->appendImageCopyToMemoryExt(dstPtr, image->toHandle(), &imgRegion, bytesPerPixel, bytesPerPixel, nullptr, numWaitlistEvents, waitlist, copyParams),
hasEventDependencies, hasEventDependencies);
}

View File

@@ -148,7 +148,8 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
size_t dstRowPitch, size_t dstSlicePitch,
size_t bytesPerPixel, const Vec3<size_t> &copySize,
const Vec3<size_t> &srcSize, const Vec3<size_t> &dstSize,
L0::Event *signalEvent) override {
L0::Event *signalEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override {
appendCopyImageBlitCalledTimes++;
appendCopyImageSrcRowPitch = srcRowPitch;
appendCopyImageSrcSlicePitch = srcSlicePitch;
@@ -795,7 +796,8 @@ HWTEST2_F(CommandListAppend, givenCommandListWhenAppendImageCopyFromMemoryCalled
auto imageHW = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHW->initialize(device, &zeDesc);
ze_image_region_t dstRegion = {4, 4, 4, 2, 2, 2};
ze_result_t ret = cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, &dstRegion, nullptr, 0, nullptr, false);
ze_result_t ret = cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, &dstRegion, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.getAlignedAllocationCalledTimes, 0u);
EXPECT_EQ(ret, ZE_RESULT_ERROR_INVALID_NULL_POINTER);
}
@@ -809,7 +811,7 @@ HWTEST2_F(CommandListAppend, givenCommandListWhenAppendImageCopyToMemoryCalledWi
auto imageHW = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHW->initialize(device, &zeDesc);
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
ze_result_t ret = cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), &srcRegion, nullptr, 0, nullptr, false);
ze_result_t ret = cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.getAlignedAllocationCalledTimes, 0u);
EXPECT_EQ(ret, ZE_RESULT_ERROR_INVALID_NULL_POINTER);
}
@@ -825,7 +827,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListWhenCopyFromMemoryToImageThenBl
imageHW->initialize(device, &zeDesc);
ze_image_region_t dstRegion = {4, 4, 4, 2, 2, 2};
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, &dstRegion, nullptr, 0, nullptr, false);
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, &dstRegion, nullptr, 0, nullptr, copyParams);
EXPECT_GT(cmdList.appendCopyImageBlitCalledTimes, 0u);
EXPECT_FALSE(cmdList.useEvents);
}
@@ -845,7 +847,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhenIma
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, event->toHandle(), 0, nullptr, false);
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, event->toHandle(), 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionDstOrigin, expectedRegionOrigin);
EXPECT_TRUE(cmdList.useEvents);
@@ -866,7 +868,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhenIma
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionSrcOrigin, expectedRegionOrigin);
EXPECT_FALSE(cmdList.useEvents);
@@ -890,7 +892,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen1DI
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionDstOrigin, expectedRegionOrigin);
}
@@ -913,7 +915,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen1DI
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, event->toHandle(), 0, nullptr, false);
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, event->toHandle(), 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionSrcOrigin, expectedRegionOrigin);
EXPECT_TRUE(cmdList.useEvents);
@@ -937,7 +939,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen1DA
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.arraylevels, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionDstOrigin, expectedRegionOrigin);
}
@@ -960,7 +962,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen1DA
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.arraylevels, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionSrcOrigin, expectedRegionOrigin);
}
@@ -982,7 +984,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen2DI
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionSrcOrigin, expectedRegionOrigin);
}
@@ -1003,7 +1005,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen2DI
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionDstOrigin, expectedRegionOrigin);
}
@@ -1026,7 +1028,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen2DI
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionSrcOrigin, expectedRegionOrigin);
}
@@ -1049,7 +1051,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen2DI
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionDstOrigin, expectedRegionOrigin);
}
@@ -1072,7 +1074,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen2DA
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.arraylevels};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionDstOrigin, expectedRegionOrigin);
}
@@ -1095,7 +1097,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen2DA
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.arraylevels};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionSrcOrigin, expectedRegionOrigin);
}
@@ -1115,7 +1117,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen3DI
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionSrcOrigin, expectedRegionOrigin);
}
@@ -1135,7 +1137,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListAndNullDestinationRegionWhen3DI
Vec3<size_t> expectedRegionCopySize = {zeDesc.width, zeDesc.height, zeDesc.depth};
Vec3<size_t> expectedRegionOrigin = {0, 0, 0};
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
cmdList.appendImageCopyFromMemory(imageHW->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendImageRegionCopySize, expectedRegionCopySize);
EXPECT_EQ(cmdList.appendImageRegionDstOrigin, expectedRegionOrigin);
}
@@ -1163,7 +1165,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListWhen1DArrayImageCopyRegionThenA
ze_image_region_t srcRegion = {4, 0, 0, 4, 1, 1};
ze_image_region_t dstRegion = srcRegion;
srcRegion.originX = 8;
cmdList.appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, false);
cmdList.appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendCopyImageSrcRowPitch, imageHWSrc->getImageInfo().rowPitch);
EXPECT_EQ(cmdList.appendCopyImageSrcSlicePitch, srcRegion.height * imageHWSrc->getImageInfo().rowPitch);
@@ -1205,7 +1207,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListWhen2DArrayImageCopyRegionThenA
ze_image_region_t dstRegion = srcRegion;
srcRegion.originX = 8;
srcRegion.originY = 8;
cmdList.appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, false);
cmdList.appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendCopyImageSrcRowPitch, imageHWSrc->getImageInfo().rowPitch);
EXPECT_EQ(cmdList.appendCopyImageSrcSlicePitch, srcRegion.height * imageHWSrc->getImageInfo().rowPitch);
@@ -1234,7 +1236,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListWhenCopyFromImageToMemoryThenBl
imageHW->initialize(device, &zeDesc);
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), &srcRegion, nullptr, 0, nullptr, false);
cmdList.appendImageCopyToMemory(dstPtr, imageHW->toHandle(), &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_GT(cmdList.appendCopyImageBlitCalledTimes, 0u);
}
@@ -1250,7 +1252,7 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListWhenCopyFromImageToImageThenBli
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
ze_image_region_t dstRegion = {4, 4, 4, 2, 2, 2};
cmdList.appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, false);
cmdList.appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_GT(cmdList.appendCopyImageBlitCalledTimes, 0u);
EXPECT_FALSE(cmdList.useEvents);
}
@@ -1279,14 +1281,14 @@ HWTEST2_F(CommandListAppend, givenCopyCommandListWhenImageCopyFromToMemoryExtWit
uint32_t slicePitch = rowPitch;
uint32_t data[4];
auto res = commandList->appendImageCopyFromMemoryExt(nullptr, &data[0], &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, false);
auto res = commandList->appendImageCopyFromMemoryExt(nullptr, &data[0], &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_NULL_HANDLE);
res = commandList->appendImageCopyFromMemoryExt(image->toHandle(), nullptr, &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, false);
res = commandList->appendImageCopyFromMemoryExt(image->toHandle(), nullptr, &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_NULL_POINTER);
res = commandList->appendImageCopyToMemoryExt(&data[0], nullptr, &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, false);
res = commandList->appendImageCopyToMemoryExt(&data[0], nullptr, &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_NULL_HANDLE);
res = commandList->appendImageCopyToMemoryExt(nullptr, image->toHandle(), &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, false);
res = commandList->appendImageCopyToMemoryExt(nullptr, image->toHandle(), &imgRegion, rowPitch, slicePitch, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(res, ZE_RESULT_ERROR_INVALID_NULL_POINTER);
}
@@ -1305,7 +1307,7 @@ HWTEST2_F(CommandListAppend, givenComputeCommandListAndEventIsUsedWhenCopyFromIm
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
ze_image_region_t dstRegion = {4, 4, 4, 2, 2, 2};
cmdList.appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, event->toHandle(), 0, nullptr, false);
cmdList.appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, event->toHandle(), 0, nullptr, copyParams);
EXPECT_EQ(cmdList.appendCopyImageBlitCalledTimes, 0u);
EXPECT_EQ(event.get(), cmdList.appendKernelEventValue);
}
@@ -1349,8 +1351,8 @@ HWTEST2_F(DirectSubmissionCommandListTest, givenComputeCommandListWhenCopyImageT
ze_image_region_t srcRegion = {0, 0, 0, 1, 1, 1};
uint32_t data[16];
cmdList.appendImageCopyToMemory(&data[0], imageHWSrc->toHandle(), &srcRegion, nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
cmdList.appendImageCopyToMemory(&data[0], imageHWSrc->toHandle(), &srcRegion, nullptr, 0, nullptr, copyParams);
GenCmdList genCmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(

View File

@@ -1050,7 +1050,8 @@ HWTEST2_F(CommandListCreateWithBcs, givenImmediateCommandListWhenCopyRegionFromI
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
ze_image_region_t dstRegion = {4, 4, 4, 2, 2, 2};
returnValue = commandList0->appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
returnValue = commandList0->appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
}
@@ -1097,7 +1098,8 @@ HWTEST2_F(CommandListCreateWithBcs, givenImmediateCommandListWhenCopyRegionFromI
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
ze_image_region_t dstRegion = {2, 2, 2, 4, 4, 4};
returnValue = commandList0->appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
returnValue = commandList0->appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, returnValue);
}
@@ -1141,8 +1143,8 @@ HWTEST2_F(CommandListCreateWithBcs, givenImmediateCommandListWhenCopyFromImageTo
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHWSrc->initialize(device, &desc);
imageHWDst->initialize(device, &desc);
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
}

View File

@@ -221,12 +221,12 @@ HWTEST2_F(CommandListCreateTests, givenUseCsrImmediateSubmissionEnabledForCopyIm
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHWSrc->initialize(device, &desc);
imageHWDst->initialize(device, &desc);
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr, false);
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
}
@@ -266,12 +266,12 @@ HWTEST2_F(CommandListCreateTests, givenUseCsrImmediateSubmissionDisabledForCopyI
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHWSrc->initialize(device, &desc);
imageHWDst->initialize(device, &desc);
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr, false);
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
}

View File

@@ -803,7 +803,8 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenCopyFromImageToImageTheBui
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
ze_image_region_t dstRegion = {4, 4, 4, 2, 2, 2};
commandList->appendImageCopyRegion(imageHwDst->toHandle(), imageHwSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
commandList->appendImageCopyRegion(imageHwDst->toHandle(), imageHwSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
}
@@ -821,9 +822,9 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenCopyFromImageToExternalHos
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
auto imageHw = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHw->initialize(device, &zeDesc);
CmdListMemoryCopyParams copyParams = {};
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
commandList->appendImageCopyToMemory(dstPtr, imageHw->toHandle(), &srcRegion, nullptr, 0, nullptr, false);
commandList->appendImageCopyToMemory(dstPtr, imageHw->toHandle(), &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isDestinationAllocationInSystemMemory);
}
@@ -846,9 +847,9 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenCopyFromImageToUsmHostMemo
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
auto imageHw = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHw->initialize(device, &zeDesc);
CmdListMemoryCopyParams copyParams = {};
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
commandList->appendImageCopyToMemory(dstBuffer, imageHw->toHandle(), &srcRegion, nullptr, 0, nullptr, false);
commandList->appendImageCopyToMemory(dstBuffer, imageHw->toHandle(), &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isDestinationAllocationInSystemMemory);
@@ -878,8 +879,9 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenCopyFromImageToUsmDeviceMe
auto imageHw = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHw->initialize(device, &zeDesc);
CmdListMemoryCopyParams copyParams = {};
ze_image_region_t srcRegion = {4, 4, 4, 2, 2, 2};
commandList->appendImageCopyToMemory(dstBuffer, imageHw->toHandle(), &srcRegion, nullptr, 0, nullptr, false);
commandList->appendImageCopyToMemory(dstBuffer, imageHw->toHandle(), &srcRegion, nullptr, 0, nullptr, copyParams);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
EXPECT_FALSE(commandList->usedKernelLaunchParams.isDestinationAllocationInSystemMemory);
@@ -904,7 +906,7 @@ HWTEST2_F(CommandListTest, givenComputeCommandListWhenImageCopyFromMemoryThenBui
auto imageHw = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHw->initialize(device, &zeDesc);
commandList->appendImageCopyFromMemory(imageHw->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
commandList->appendImageCopyFromMemory(imageHw->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
}
@@ -947,7 +949,7 @@ HWTEST2_F(CommandListTest, givenHeaplessWhenAppendImageCopyFromMemoryThenCorrect
imageHw->initialize(device, &zeDesc);
auto bytesPerPixel = static_cast<uint32_t>(imageHw->getImageInfo().surfaceFormat->imageElementSizeInBytes);
commandList->appendImageCopyFromMemory(imageHw->toHandle(), srcPtr, &dstImgRegion, nullptr, 0, nullptr, false);
commandList->appendImageCopyFromMemory(imageHw->toHandle(), srcPtr, &dstImgRegion, nullptr, 0, nullptr, copyParams);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
auto passedArgSizeRowSlicePitch = mockBuiltinKernel->passedArgumentValues[4u].size();
@@ -998,8 +1000,8 @@ HWTEST2_F(CommandListTest, givenHeaplessWhenAppendImageCopyToMemoryThenCorrectRo
auto imageHw = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHw->initialize(device, &zeDesc);
auto bytesPerPixel = static_cast<uint32_t>(imageHw->getImageInfo().surfaceFormat->imageElementSizeInBytes);
commandList->appendImageCopyToMemory(dstPtr, imageHw->toHandle(), &srcImgRegion, nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
commandList->appendImageCopyToMemory(dstPtr, imageHw->toHandle(), &srcImgRegion, nullptr, 0, nullptr, copyParams);
EXPECT_TRUE(commandList->usedKernelLaunchParams.isBuiltInKernel);
auto passedArgSizeRowSlicePitch = mockBuiltinKernel->passedArgumentValues[4u].size();

View File

@@ -1029,7 +1029,8 @@ HWTEST_TEMPLATED_F(TbxImmediateCommandListTest, givenTbxModeOnFlushTaskImmediate
ze_image_region_t dstRegion = {4, 4, 4, 2, 2, 2};
auto eventHandle = event->toHandle();
commandListImmediate->appendImageCopyRegion(imageDst->toHandle(), imageSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 1, &eventHandle, false);
CmdListMemoryCopyParams copyParams = {};
commandListImmediate->appendImageCopyRegion(imageDst->toHandle(), imageSrc->toHandle(), &dstRegion, &srcRegion, nullptr, 1, &eventHandle, copyParams);
EXPECT_EQ(0u, ultCsr.downloadAllocationsCalledCount);
}
@@ -1052,9 +1053,9 @@ HWTEST_TEMPLATED_F(TbxImmediateCommandListTest, givenTbxModeOnFlushTaskImmediate
auto result = Image::create(neoDevice->getHardwareInfo().platform.eProductFamily, device, &desc, &imagePtr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
std::unique_ptr<L0::Image> image(imagePtr);
CmdListMemoryCopyParams copyParams = {};
auto eventHandle = event->toHandle();
commandListImmediate->appendImageCopyFromMemory(imagePtr->toHandle(), ptr, nullptr, nullptr, 1, &eventHandle, false);
commandListImmediate->appendImageCopyFromMemory(imagePtr->toHandle(), ptr, nullptr, nullptr, 1, &eventHandle, copyParams);
EXPECT_EQ(0u, ultCsr.downloadAllocationsCalledCount);
ultCsr.getInternalAllocationStorage()->getTemporaryAllocations().freeAllGraphicsAllocations(neoDevice);
@@ -1078,9 +1079,10 @@ HWTEST_TEMPLATED_F(TbxImmediateCommandListTest, givenTbxModeOnFlushTaskImmediate
auto result = Image::create(neoDevice->getHardwareInfo().platform.eProductFamily, device, &desc, &imagePtr);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
std::unique_ptr<L0::Image> image(imagePtr);
CmdListMemoryCopyParams copyParams = {};
auto eventHandle = event->toHandle();
commandListImmediate->appendImageCopyToMemory(ptr, imagePtr->toHandle(), nullptr, nullptr, 1, &eventHandle, false);
commandListImmediate->appendImageCopyToMemory(ptr, imagePtr->toHandle(), nullptr, nullptr, 1, &eventHandle, copyParams);
EXPECT_EQ(0u, ultCsr.downloadAllocationsCalledCount);
ultCsr.getInternalAllocationStorage()->getTemporaryAllocations().freeAllGraphicsAllocations(neoDevice);

View File

@@ -312,7 +312,8 @@ HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenTimestampPassedToImageC
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, event.get());
CmdListMemoryCopyParams copyParams = {};
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, event.get(), 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed()));
@@ -322,6 +323,54 @@ HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenTimestampPassedToImageC
EXPECT_EQ(cmd->getRegisterAddress(), RegisterOffsets::bcs0Base + RegisterOffsets::globalTimestampLdw);
}
HWTEST2_F(AppendMemoryCopyTests, givenWaitWhenWhenAppendBlitCalledThenProgramSemaphore, MatchAny) {
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
commandList->initialize(device, NEO::EngineGroupType::copy, 0u);
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;
eventPoolDesc.flags = ZE_EVENT_POOL_FLAG_KERNEL_TIMESTAMP;
ze_event_desc_t eventDesc = {};
eventDesc.index = 0;
ze_result_t result = ZE_RESULT_SUCCESS;
auto eventPool = std::unique_ptr<L0::EventPool>(L0::EventPool::create(driverHandle.get(), context, 0, nullptr, &eventPoolDesc, result));
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
auto event = std::unique_ptr<L0::Event>(L0::Event::create<typename FamilyType::TimestampPacketType>(eventPool.get(), &eventDesc, device));
NEO::MockGraphicsAllocation mockAllocationSrc(0, 1, NEO::AllocationType::internalHostMemory,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
NEO::MockGraphicsAllocation mockAllocationDst(0, 1, NEO::AllocationType::internalHostMemory,
reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t),
MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
auto cmdStream = commandList->getCmdContainer().getCommandStream();
auto offset = cmdStream->getUsed();
CmdListMemoryCopyParams copyParams = {};
{
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, event.get(), 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, ptrOffset(cmdStream->getCpuBase(), offset), cmdStream->getUsed() - offset));
auto itor = find<MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
EXPECT_EQ(cmdList.end(), itor);
}
{
offset = cmdStream->getUsed();
auto eventHandle = event->toHandle();
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 1, &eventHandle, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, ptrOffset(cmdStream->getCpuBase(), offset), cmdStream->getUsed() - offset));
auto itor = find<MI_SEMAPHORE_WAIT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
}
}
using ImageSupport = IsGen12LP;
HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenCopyFromImagBlitThenCommandAddedToStream, ImageSupport) {
using GfxFamily = typename NEO::GfxFamilyMapper<FamilyType::gfxCoreFamily>::GfxFamily;
@@ -334,8 +383,8 @@ HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenCopyFromImagBlitThenCom
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
imageHWSrc->initialize(device, &zeDesc);
imageHWDst->initialize(device, &zeDesc);
commandList->appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, nullptr, nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
commandList->appendImageCopyRegion(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, nullptr, nullptr, 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed()));
@@ -384,7 +433,8 @@ HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenTiled1DArrayImagePassed
size_t arrayLevels = 8;
size_t depth = 1;
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 4, 4, 4, 4, 1, {1, arrayLevels, depth}, {1, arrayLevels, depth}, {1, arrayLevels, depth}, nullptr);
CmdListMemoryCopyParams copyParams = {};
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 4, 4, 4, 4, 1, {1, arrayLevels, depth}, {1, arrayLevels, depth}, {1, arrayLevels, depth}, nullptr, 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed()));
@@ -418,7 +468,8 @@ HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenNotTiled1DArrayImagePas
size_t arrayLevels = 8;
size_t depth = 1;
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, arrayLevels, depth}, {1, arrayLevels, depth}, {1, arrayLevels, depth}, nullptr);
CmdListMemoryCopyParams copyParams = {};
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, arrayLevels, depth}, {1, arrayLevels, depth}, {1, arrayLevels, depth}, nullptr, 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(
cmdList, ptrOffset(commandList->getCmdContainer().getCommandStream()->getCpuBase(), 0), commandList->getCmdContainer().getCommandStream()->getUsed()));
@@ -555,17 +606,19 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro
commandList->useAdditionalBlitProperties = false;
EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled);
EXPECT_EQ(0u, commandList->inOrderPatchCmds.size());
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr);
CmdListMemoryCopyParams copyParams = {};
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled);
EXPECT_EQ(1u, commandList->appendSignalInOrderDependencyCounterCalled);
EXPECT_EQ(1u, commandList->inOrderPatchCmds.size());
commandList->useAdditionalBlitProperties = true;
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr);
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(1u, commandList->additionalBlitPropertiesCalled);
EXPECT_EQ(1u, commandList->appendSignalInOrderDependencyCounterCalled);
EXPECT_EQ(2u, commandList->inOrderPatchCmds.size());
EXPECT_EQ(InOrderPatchCommandHelpers::PatchCmdType::xyBlockCopyBlt, commandList->inOrderPatchCmds[1].patchCmdType);
EXPECT_EQ(3u, commandList->inOrderPatchCmds.size());
EXPECT_EQ(InOrderPatchCommandHelpers::PatchCmdType::xyBlockCopyBlt, commandList->inOrderPatchCmds.back().patchCmdType);
}
HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPropertiesWhenCallingAppendMemoryCopyImageBlitThenInOrderPatchCmdsRemainsTheSame) {
@@ -581,7 +634,8 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro
commandList->useAdditionalBlitProperties = true;
EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled);
EXPECT_EQ(0u, commandList->inOrderPatchCmds.size());
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr);
CmdListMemoryCopyParams copyParams = {};
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(1u, commandList->additionalBlitPropertiesCalled);
EXPECT_EQ(0u, commandList->inOrderPatchCmds.size());
}
@@ -763,7 +817,8 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro
commandList->useAdditionalBlitProperties = true;
EXPECT_EQ(0u, commandList->appendSignalInOrderDependencyCounterCalled);
EXPECT_EQ(0u, commandList->inOrderPatchCmds.size());
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr);
CmdListMemoryCopyParams copyParams = {};
commandList->appendCopyImageBlit(&mockAllocationDst, &mockAllocationSrc, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(1u, commandList->additionalBlitPropertiesCalled);
EXPECT_EQ(0u, commandList->appendSignalInOrderDependencyCounterCalled);
EXPECT_EQ(1u, commandList->inOrderPatchCmds.size());

View File

@@ -187,7 +187,8 @@ class MockCommandListExtensionHw : public WhiteBox<::L0::CommandListCoreFamily<g
size_t dstRowPitch, size_t dstSlicePitch,
size_t bytesPerPixel, const Vec3<size_t> &copySize,
const Vec3<size_t> &srcSize, const Vec3<size_t> &dstSize,
Event *signalEvent) override {
Event *signalEvent, uint32_t numWaitEvents,
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams) override {
appendCopyImageBlitCalledTimes++;
appendImageRegionCopySize = copySize;
appendImageRegionSrcOrigin = srcOffsets;

View File

@@ -1947,7 +1947,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenNonInOrderCmdListWhenPass
zeDesc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
zeDesc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
image->initialize(device, &zeDesc);
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, copyOnlyCmdList->appendImageCopyFromMemoryExt(image->toHandle(), &copyData, &imgRegion, 0, 0, eventHandle, 0, nullptr, false));
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, copyOnlyCmdList->appendImageCopyFromMemoryExt(image->toHandle(), &copyData, &imgRegion, 0, 0, eventHandle, 0, nullptr, copyParams));
}
context->freeMem(alloc);
@@ -4352,9 +4352,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, InOrderCmdListTests, givenCopyOnlyInOrderModeWhenPr
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
image->initialize(device, &desc);
immCmdList->appendImageCopyFromMemoryExt(image->toHandle(), srcPtr, nullptr, 0, 0, nullptr, 0, nullptr, false);
immCmdList->appendImageCopyFromMemoryExt(image->toHandle(), srcPtr, nullptr, 0, 0, nullptr, 0, nullptr, copyParams);
auto offset = cmdStream->getUsed();
immCmdList->appendImageCopyFromMemoryExt(image->toHandle(), srcPtr, nullptr, 0, 0, nullptr, 0, nullptr, false);
immCmdList->appendImageCopyFromMemoryExt(image->toHandle(), srcPtr, nullptr, 0, 0, nullptr, 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList,

View File

@@ -15,6 +15,7 @@
#include "shared/test/common/test_macros/hw_test.h"
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
#include "level_zero/core/source/image/image_hw.h"
#include "level_zero/core/test/unit_tests/fixtures/in_order_cmd_list_fixture.h"
#include "level_zero/driver_experimental/zex_api.h"
@@ -380,6 +381,7 @@ HWTEST_F(CopyOffloadInOrderTests, givenNonDualStreamOffloadWhenCreatingCmdListTh
HWTEST2_F(CopyOffloadInOrderTests, givenCopyOffloadEnabledWhenProgrammingHwCmdsThenUseCopyCommands, IsAtLeastXeHpCore) {
using XY_COPY_BLT = typename std::remove_const<decltype(FamilyType::cmdInitXyCopyBlt)>::type;
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
auto immCmdList = createImmCmdListWithOffload<FamilyType::gfxCoreFamily>();
EXPECT_FALSE(immCmdList->isCopyOnly(false));
@@ -445,6 +447,120 @@ HWTEST2_F(CopyOffloadInOrderTests, givenCopyOffloadEnabledWhenProgrammingHwCmdsT
EXPECT_EQ(initialMainTaskCount, mainQueueCsr->taskCount);
EXPECT_EQ(initialCopyTaskCount + 3, copyQueueCsr->taskCount);
}
auto image = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
ze_image_desc_t zeDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC};
zeDesc.type = ZE_IMAGE_TYPE_2D;
zeDesc.width = 10;
zeDesc.height = 10;
zeDesc.depth = 1;
image->initialize(device, &zeDesc);
static_cast<MemoryAllocation *>(image->getAllocation())->overrideMemoryPool(NEO::MemoryPool::system64KBPages);
ze_image_region_t imgRegion = {0, 0, 0, 1, 1, 1};
{
auto offset = cmdStream->getUsed();
immCmdList->appendImageCopyFromMemoryExt(image->toHandle(), data, &imgRegion, 0, 0, nullptr, 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList,
ptrOffset(cmdStream->getCpuBase(), offset),
(cmdStream->getUsed() - offset)));
auto itor = find<XY_BLOCK_COPY_BLT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
EXPECT_EQ(initialMainTaskCount, mainQueueCsr->taskCount);
EXPECT_EQ(initialCopyTaskCount + 4, copyQueueCsr->taskCount);
}
{
auto offset = cmdStream->getUsed();
immCmdList->appendImageCopyToMemoryExt(data, image->toHandle(), &imgRegion, 0, 0, nullptr, 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList,
ptrOffset(cmdStream->getCpuBase(), offset),
(cmdStream->getUsed() - offset)));
auto itor = find<XY_BLOCK_COPY_BLT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
EXPECT_EQ(initialMainTaskCount, mainQueueCsr->taskCount);
EXPECT_EQ(initialCopyTaskCount + 5, copyQueueCsr->taskCount);
}
{
auto offset = cmdStream->getUsed();
immCmdList->appendImageCopy(image->toHandle(), image->toHandle(), nullptr, 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList,
ptrOffset(cmdStream->getCpuBase(), offset),
(cmdStream->getUsed() - offset)));
auto itor = find<XY_BLOCK_COPY_BLT *>(cmdList.begin(), cmdList.end());
EXPECT_NE(cmdList.end(), itor);
EXPECT_EQ(initialMainTaskCount, mainQueueCsr->taskCount);
EXPECT_EQ(initialCopyTaskCount + 6, copyQueueCsr->taskCount);
}
context->freeMem(data);
}
HWTEST2_F(CopyOffloadInOrderTests, givenNonDualStreamOffloadWhenImageCopyCalledThenSkipSycCommands, IsAtLeastXeHpcCore) {
using MI_LOAD_REGISTER_REG = typename FamilyType::MI_LOAD_REGISTER_REG;
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
using MI_STORE_REGISTER_MEM = typename FamilyType::MI_STORE_REGISTER_MEM;
debugManager.flags.OverrideCopyOffloadMode.set(nonDualStreamMode);
auto immCmdList = createImmCmdListWithOffload<FamilyType::gfxCoreFamily>();
auto eventPool = createEvents<FamilyType>(1, true);
auto cmdStream = immCmdList->getCmdContainer().getCommandStream();
auto data = allocHostMem(1);
auto image = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
ze_image_desc_t zeDesc = {ZE_STRUCTURE_TYPE_IMAGE_DESC};
zeDesc.type = ZE_IMAGE_TYPE_2D;
zeDesc.width = 10;
zeDesc.height = 10;
zeDesc.depth = 1;
image->initialize(device, &zeDesc);
static_cast<MemoryAllocation *>(image->getAllocation())->overrideMemoryPool(NEO::MemoryPool::system64KBPages);
ze_image_region_t imgRegion = {0, 0, 0, 1, 1, 1};
immCmdList->appendImageCopyToMemoryExt(data, image->toHandle(), &imgRegion, 0, 0, nullptr, 0, nullptr, copyParams);
GenCmdList cmdList;
ASSERT_TRUE(FamilyType::Parse::parseCommandBuffer(cmdList, cmdStream->getCpuBase(), cmdStream->getUsed()));
auto lrrCmds = findAll<MI_LOAD_REGISTER_REG *>(cmdList.begin(), cmdList.end());
auto lriCmds = findAll<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
auto lrmCmds = findAll<MI_STORE_REGISTER_MEM *>(cmdList.begin(), cmdList.end());
for (auto &lrr : lrrCmds) {
auto lrrCmd = genCmdCast<MI_LOAD_REGISTER_REG *>(*lrr);
EXPECT_TRUE(lrrCmd->getSourceRegisterAddress() < RegisterOffsets::bcs0Base);
EXPECT_TRUE(lrrCmd->getDestinationRegisterAddress() < RegisterOffsets::bcs0Base);
}
for (auto &lri : lriCmds) {
auto lriCmd = genCmdCast<MI_LOAD_REGISTER_IMM *>(*lri);
EXPECT_TRUE(lriCmd->getRegisterOffset() < RegisterOffsets::bcs0Base);
}
for (auto &lrm : lrmCmds) {
auto lrmCmd = genCmdCast<MI_STORE_REGISTER_MEM *>(*lrm);
EXPECT_TRUE(lrmCmd->getRegisterAddress() < RegisterOffsets::bcs0Base);
}
context->freeMem(data);
}

View File

@@ -5929,14 +5929,14 @@ HWTEST2_F(MultipleDevicePeerImageTest,
NEO::EngineGroupType::copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
result = commandList0->appendImageCopy(image0Dst->toHandle(), image1Src->toHandle(), nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
result = commandList0->appendImageCopy(image0Dst->toHandle(), image1Src->toHandle(), nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
result = commandList0->appendImageCopy(image1Dst->toHandle(), image0Src->toHandle(), nullptr, 0, nullptr, false);
result = commandList0->appendImageCopy(image1Dst->toHandle(), image0Src->toHandle(), nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
result = commandList0->appendImageCopyFromMemory(image1Dst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
result = commandList0->appendImageCopyFromMemory(image1Dst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
result = commandList0->appendImageCopyToMemory(dstPtr, image1Src->toHandle(), nullptr, nullptr, 0, nullptr, false);
result = commandList0->appendImageCopyToMemory(dstPtr, image1Src->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
result = image0Src->destroy();
@@ -5999,14 +5999,14 @@ HWTEST2_F(MultipleDevicePeerImageTest,
NEO::EngineGroupType::copy,
returnValue));
ASSERT_NE(nullptr, commandList0);
result = commandList0->appendImageCopy(image0Dst->toHandle(), image1Src->toHandle(), nullptr, 0, nullptr, false);
CmdListMemoryCopyParams copyParams = {};
result = commandList0->appendImageCopy(image0Dst->toHandle(), image1Src->toHandle(), nullptr, 0, nullptr, copyParams);
EXPECT_NE(ZE_RESULT_SUCCESS, result);
result = commandList0->appendImageCopy(image1Dst->toHandle(), image0Src->toHandle(), nullptr, 0, nullptr, false);
result = commandList0->appendImageCopy(image1Dst->toHandle(), image0Src->toHandle(), nullptr, 0, nullptr, copyParams);
EXPECT_NE(ZE_RESULT_SUCCESS, result);
result = commandList0->appendImageCopyFromMemory(image1Dst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, false);
result = commandList0->appendImageCopyFromMemory(image1Dst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_NE(ZE_RESULT_SUCCESS, result);
result = commandList0->appendImageCopyToMemory(dstPtr, image1Src->toHandle(), nullptr, nullptr, 0, nullptr, false);
result = commandList0->appendImageCopyToMemory(dstPtr, image1Src->toHandle(), nullptr, nullptr, 0, nullptr, copyParams);
EXPECT_NE(ZE_RESULT_SUCCESS, result);
result = image0Src->destroy();