mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-26 23:33:20 +08:00
Revert "feature: system allocator support for image APIs"
This reverts commit 001f3a3816.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e320aa4fca
commit
82a1d0c81c
@@ -286,8 +286,8 @@ struct CommandListCoreFamily : public CommandListImp {
|
||||
uint32_t numWaitEvents,
|
||||
ze_event_handle_t *phWaitEvents, CmdListMemoryCopyParams &memoryCopyParams);
|
||||
|
||||
MOCKABLE_VIRTUAL ze_result_t appendCopyImageBlit(uintptr_t srcPtr, NEO::GraphicsAllocation *src,
|
||||
uintptr_t dstPtr, NEO::GraphicsAllocation *dst,
|
||||
MOCKABLE_VIRTUAL ze_result_t appendCopyImageBlit(NEO::GraphicsAllocation *src,
|
||||
NEO::GraphicsAllocation *dst,
|
||||
const Vec3<size_t> &srcOffsets, const Vec3<size_t> &dstOffsets,
|
||||
size_t srcRowPitch, size_t srcSlicePitch,
|
||||
size_t dstRowPitch, size_t dstSlicePitch,
|
||||
@@ -416,8 +416,7 @@ struct CommandListCoreFamily : public CommandListImp {
|
||||
bool singleEventPacketRequired(bool inputSinglePacketEventRequest) const;
|
||||
void programEventL3Flush(Event *event);
|
||||
virtual ze_result_t flushInOrderCounterSignal(bool waitOnInOrderCounterRequired) { return ZE_RESULT_SUCCESS; };
|
||||
bool isCopyOffloadAllowed(const NEO::GraphicsAllocation *srcAllocation, const NEO::GraphicsAllocation *dstAllocation) const;
|
||||
bool isSharedSystemEnabled() const;
|
||||
bool isCopyOffloadAllowed(const NEO::GraphicsAllocation &srcAllocation, const NEO::GraphicsAllocation &dstAllocation) const;
|
||||
void setAdditionalKernelLaunchParams(CmdListKernelLaunchParams &launchParams, Kernel &kernel) const;
|
||||
void dispatchInOrderPostOperationBarrier(Event *signalOperation, bool dcFlushRequired, bool copyOperation);
|
||||
NEO::GraphicsAllocation *getDeviceCounterAllocForResidency(NEO::GraphicsAllocation *counterDeviceAlloc);
|
||||
|
||||
@@ -814,8 +814,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
|
||||
return ZE_RESULT_ERROR_INVALID_NULL_POINTER;
|
||||
}
|
||||
|
||||
bool sharedSystemEnabled = isSharedSystemEnabled();
|
||||
|
||||
auto image = Image::fromHandle(hDstImage);
|
||||
auto bytesPerPixel = static_cast<uint32_t>(image->getImageInfo().surfaceFormat->imageElementSizeInBytes);
|
||||
Vec3<size_t> imgSize = {image->getImageDesc().width,
|
||||
@@ -859,17 +857,13 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
|
||||
|
||||
uint64_t bufferSize = getInputBufferSize(image->getImageInfo().imgDesc.imageType, srcRowPitch, srcSlicePitch, pDstRegion);
|
||||
|
||||
auto allocationStruct = getAlignedAllocationData(this->device, sharedSystemEnabled, srcPtr, bufferSize, true, false);
|
||||
if (allocationStruct.alloc == nullptr && sharedSystemEnabled == false) {
|
||||
auto allocationStruct = getAlignedAllocationData(this->device, false, srcPtr, bufferSize, true, false);
|
||||
if (allocationStruct.alloc == nullptr) {
|
||||
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
}
|
||||
|
||||
memoryCopyParams.taskCountUpdateRequired |= CommandList::isExternalHostPtrAlloc(allocationStruct.alloc);
|
||||
|
||||
if ((allocationStruct.alloc == nullptr) && (NEO::debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.get() == 1)) {
|
||||
appendMemAdvise(device, reinterpret_cast<void *>(allocationStruct.alignedAllocationPtr), bufferSize, static_cast<ze_memory_advice_t>(ZE_MEMORY_ADVICE_SET_SYSTEM_MEMORY_PREFERRED_LOCATION));
|
||||
}
|
||||
|
||||
DriverHandleImp *driverHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
|
||||
if (driverHandle->isRemoteImageNeeded(image, device)) {
|
||||
L0::Image *peerImage = nullptr;
|
||||
@@ -881,7 +875,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
|
||||
image = peerImage;
|
||||
}
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(allocationStruct.alloc, image->getAllocation());
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(*allocationStruct.alloc, *image->getAllocation());
|
||||
|
||||
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
|
||||
if ((bytesPerPixel == 3) || (bytesPerPixel == 6) || image->isMimickedImage()) {
|
||||
@@ -889,7 +883,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
|
||||
}
|
||||
size_t imgRowPitch = image->getImageInfo().rowPitch;
|
||||
size_t imgSlicePitch = image->getImageInfo().slicePitch;
|
||||
auto status = appendCopyImageBlit(allocationStruct.alignedAllocationPtr, allocationStruct.alloc, image->getAllocation()->getGpuAddress(), image->getAllocation(),
|
||||
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, numWaitEvents, phWaitEvents, memoryCopyParams);
|
||||
@@ -932,7 +926,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
|
||||
auto lock = device->getBuiltinFunctionsLib()->obtainUniqueOwnership();
|
||||
Kernel *builtinKernel = device->getBuiltinFunctionsLib()->getImageFunction(builtInType);
|
||||
|
||||
builtinSetArgCopy(builtinKernel, 0, reinterpret_cast<void *>(&allocationStruct.alignedAllocationPtr), allocationStruct.alloc);
|
||||
builtinKernel->setArgBufferWithAlloc(0u, allocationStruct.alignedAllocationPtr,
|
||||
allocationStruct.alloc,
|
||||
nullptr);
|
||||
builtinKernel->setArgRedescribedImage(1u, image->toHandle(), false);
|
||||
builtinKernel->setArgumentValue(2u, sizeof(size_t), &allocationStruct.offset);
|
||||
|
||||
@@ -1018,8 +1014,6 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
|
||||
return ZE_RESULT_ERROR_INVALID_NULL_HANDLE;
|
||||
}
|
||||
|
||||
bool sharedSystemEnabled = isSharedSystemEnabled();
|
||||
|
||||
auto image = Image::fromHandle(hSrcImage);
|
||||
auto bytesPerPixel = static_cast<uint32_t>(image->getImageInfo().surfaceFormat->imageElementSizeInBytes);
|
||||
Vec3<size_t> imgSize = {image->getImageDesc().width,
|
||||
@@ -1063,17 +1057,13 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
|
||||
|
||||
uint64_t bufferSize = getInputBufferSize(image->getImageInfo().imgDesc.imageType, destRowPitch, destSlicePitch, pSrcRegion);
|
||||
|
||||
auto allocationStruct = getAlignedAllocationData(this->device, sharedSystemEnabled, dstPtr, bufferSize, false, false);
|
||||
if (allocationStruct.alloc == nullptr && sharedSystemEnabled == false) {
|
||||
auto allocationStruct = getAlignedAllocationData(this->device, false, dstPtr, bufferSize, false, false);
|
||||
if (allocationStruct.alloc == nullptr) {
|
||||
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
|
||||
}
|
||||
|
||||
memoryCopyParams.taskCountUpdateRequired |= CommandList::isExternalHostPtrAlloc(allocationStruct.alloc);
|
||||
|
||||
if ((allocationStruct.alloc == nullptr) && (NEO::debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.get() == 1)) {
|
||||
appendMemAdvise(device, reinterpret_cast<void *>(allocationStruct.alignedAllocationPtr), bufferSize, static_cast<ze_memory_advice_t>(ZE_MEMORY_ADVICE_SET_SYSTEM_MEMORY_PREFERRED_LOCATION));
|
||||
}
|
||||
|
||||
DriverHandleImp *driverHandle = static_cast<DriverHandleImp *>(device->getDriverHandle());
|
||||
if (driverHandle->isRemoteImageNeeded(image, device)) {
|
||||
L0::Image *peerImage = nullptr;
|
||||
@@ -1085,7 +1075,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
|
||||
image = peerImage;
|
||||
}
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(image->getAllocation(), allocationStruct.alloc);
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(*image->getAllocation(), *allocationStruct.alloc);
|
||||
|
||||
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
|
||||
if ((bytesPerPixel == 3) || (bytesPerPixel == 6) || image->isMimickedImage()) {
|
||||
@@ -1093,7 +1083,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
|
||||
}
|
||||
size_t imgRowPitch = image->getImageInfo().rowPitch;
|
||||
size_t imgSlicePitch = image->getImageInfo().slicePitch;
|
||||
auto status = appendCopyImageBlit(image->getAllocation()->getGpuAddress(), image->getAllocation(), allocationStruct.alignedAllocationPtr, allocationStruct.alloc,
|
||||
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, numWaitEvents, phWaitEvents, memoryCopyParams);
|
||||
@@ -1147,7 +1137,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
|
||||
Kernel *builtinKernel = device->getBuiltinFunctionsLib()->getImageFunction(builtInType);
|
||||
|
||||
builtinKernel->setArgRedescribedImage(0u, image->toHandle(), false);
|
||||
builtinSetArgCopy(builtinKernel, 1, reinterpret_cast<void *>(&allocationStruct.alignedAllocationPtr), allocationStruct.alloc);
|
||||
builtinKernel->setArgBufferWithAlloc(1u, allocationStruct.alignedAllocationPtr,
|
||||
allocationStruct.alloc,
|
||||
nullptr);
|
||||
uint32_t origin[] = {pSrcRegion->originX,
|
||||
pSrcRegion->originY,
|
||||
pSrcRegion->originZ,
|
||||
@@ -1198,20 +1190,15 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
|
||||
ze_group_count_t kernelArgs{pSrcRegion->width / groupSizeX, pSrcRegion->height / groupSizeY,
|
||||
pSrcRegion->depth / groupSizeZ};
|
||||
|
||||
auto dstAllocationType = allocationStruct.alloc->getAllocationType();
|
||||
CmdListKernelLaunchParams launchParams = {};
|
||||
launchParams.isBuiltInKernel = true;
|
||||
if (allocationStruct.alloc == nullptr) {
|
||||
launchParams.isDestinationAllocationInSystemMemory = true;
|
||||
launchParams.isDestinationAllocationImported = false;
|
||||
} else {
|
||||
auto dstAllocationType = allocationStruct.alloc->getAllocationType();
|
||||
launchParams.isDestinationAllocationInSystemMemory =
|
||||
(dstAllocationType == NEO::AllocationType::bufferHostMemory) ||
|
||||
(dstAllocationType == NEO::AllocationType::externalHostPtr);
|
||||
launchParams.isDestinationAllocationInSystemMemory =
|
||||
(dstAllocationType == NEO::AllocationType::bufferHostMemory) ||
|
||||
(dstAllocationType == NEO::AllocationType::externalHostPtr);
|
||||
|
||||
if constexpr (checkIfAllocationImportedRequired()) {
|
||||
launchParams.isDestinationAllocationImported = this->isAllocationImported(allocationStruct.alloc, device->getDriverHandle()->getSvmAllocsManager());
|
||||
}
|
||||
if constexpr (checkIfAllocationImportedRequired()) {
|
||||
launchParams.isDestinationAllocationImported = this->isAllocationImported(allocationStruct.alloc, device->getDriverHandle()->getSvmAllocsManager());
|
||||
}
|
||||
launchParams.relaxedOrderingDispatch = memoryCopyParams.relaxedOrderingDispatch;
|
||||
ret = CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(builtinKernel->toHandle(), kernelArgs,
|
||||
@@ -1294,7 +1281,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
|
||||
srcImage = peerImage;
|
||||
}
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcImage->getAllocation(), dstImage->getAllocation());
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(*srcImage->getAllocation(), *dstImage->getAllocation());
|
||||
|
||||
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
|
||||
auto bytesPerPixel = static_cast<uint32_t>(srcImage->getImageInfo().surfaceFormat->imageElementSizeInBytes);
|
||||
@@ -1313,7 +1300,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyRegion(ze_image
|
||||
auto dstSlicePitch =
|
||||
(dstImage->getImageInfo().imgDesc.imageType == NEO::ImageType::image1DArray ? 1 : dstRegion.height) * dstRowPitch;
|
||||
|
||||
auto status = appendCopyImageBlit(srcImage->getAllocation()->getGpuAddress(), srcImage->getAllocation(), dstImage->getAllocation()->getGpuAddress(), dstImage->getAllocation(),
|
||||
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, numWaitEvents, phWaitEvents, memoryCopyParams);
|
||||
@@ -1689,9 +1676,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyBlitRegion(Ali
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(uintptr_t srcPtr,
|
||||
NEO::GraphicsAllocation *src,
|
||||
uintptr_t dstPtr,
|
||||
ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(NEO::GraphicsAllocation *src,
|
||||
NEO::GraphicsAllocation *dst,
|
||||
const Vec3<size_t> &srcOffsets, const Vec3<size_t> &dstOffsets,
|
||||
size_t srcRowPitch, size_t srcSlicePitch,
|
||||
@@ -1713,9 +1698,9 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendCopyImageBlit(uintptr_t
|
||||
|
||||
auto clearColorAllocation = device->getNEODevice()->getDefaultEngine().commandStreamReceiver->getClearColorAllocation();
|
||||
|
||||
auto blitProperties = NEO::BlitProperties::constructPropertiesForSystemCopy(dst, src, dstPtr, srcPtr,
|
||||
dstOffsets, srcOffsets, copySize, srcRowPitch, srcSlicePitch,
|
||||
dstRowPitch, dstSlicePitch, clearColorAllocation);
|
||||
auto blitProperties = NEO::BlitProperties::constructPropertiesForCopy(dst, src,
|
||||
dstOffsets, srcOffsets, copySize, srcRowPitch, srcSlicePitch,
|
||||
dstRowPitch, dstSlicePitch, clearColorAllocation);
|
||||
blitProperties.computeStreamPartitionCount = this->partitionCount;
|
||||
blitProperties.highPriority = isHighPriorityImmediateCmdList();
|
||||
blitProperties.bytesPerPixel = bytesPerPixel;
|
||||
@@ -1811,17 +1796,8 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendPageFaultCopy(NEO::Graph
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
bool CommandListCoreFamily<gfxCoreFamily>::isCopyOffloadAllowed(const NEO::GraphicsAllocation *srcAllocation, const NEO::GraphicsAllocation *dstAllocation) const {
|
||||
if (srcAllocation == nullptr || dstAllocation == nullptr) {
|
||||
return isCopyOffloadEnabled();
|
||||
}
|
||||
return !(srcAllocation->isAllocatedInLocalMemoryPool() && dstAllocation->isAllocatedInLocalMemoryPool()) && isCopyOffloadEnabled();
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
bool CommandListCoreFamily<gfxCoreFamily>::isSharedSystemEnabled() const {
|
||||
NEO::Device *neoDevice = device->getNEODevice();
|
||||
return neoDevice->areSharedSystemAllocationsAllowed() && (NEO::debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.get() == 1);
|
||||
bool CommandListCoreFamily<gfxCoreFamily>::isCopyOffloadAllowed(const NEO::GraphicsAllocation &srcAllocation, const NEO::GraphicsAllocation &dstAllocation) const {
|
||||
return !(srcAllocation.isAllocatedInLocalMemoryPool() && dstAllocation.isAllocatedInLocalMemoryPool()) && isCopyOffloadEnabled();
|
||||
}
|
||||
|
||||
template <GFXCORE_FAMILY gfxCoreFamily>
|
||||
@@ -1834,7 +1810,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
|
||||
CmdListMemoryCopyParams &memoryCopyParams) {
|
||||
|
||||
NEO::Device *neoDevice = device->getNEODevice();
|
||||
bool sharedSystemEnabled = isSharedSystemEnabled();
|
||||
bool sharedSystemEnabled = ((neoDevice->areSharedSystemAllocationsAllowed()) && (NEO::debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.get() == 1));
|
||||
|
||||
uint32_t callId = 0;
|
||||
if (NEO::debugManager.flags.EnableSWTags.get()) {
|
||||
@@ -1866,8 +1842,11 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
|
||||
appendMemAdvise(device, reinterpret_cast<void *>(srcAllocationStruct.alignedAllocationPtr), size, static_cast<ze_memory_advice_t>(ZE_MEMORY_ADVICE_SET_SYSTEM_MEMORY_PREFERRED_LOCATION));
|
||||
}
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc);
|
||||
|
||||
if (dstAllocationStruct.alloc == nullptr || srcAllocationStruct.alloc == nullptr) {
|
||||
memoryCopyParams.copyOffloadAllowed = true;
|
||||
} else {
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(*srcAllocationStruct.alloc, *dstAllocationStruct.alloc);
|
||||
}
|
||||
const bool isCopyOnlyEnabled = isCopyOnly(memoryCopyParams.copyOffloadAllowed);
|
||||
const bool inOrderCopyOnlySignalingAllowed = this->isInOrderExecutionEnabled() && !memoryCopyParams.forceDisableCopyOnlyInOrderSignaling && isCopyOnlyEnabled;
|
||||
|
||||
@@ -2113,7 +2092,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyRegion(void *d
|
||||
CommandList::isExternalHostPtrAlloc(srcAllocationStruct.alloc);
|
||||
}
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc);
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(*srcAllocationStruct.alloc, *dstAllocationStruct.alloc);
|
||||
const bool isCopyOnlyEnabled = isCopyOnly(memoryCopyParams.copyOffloadAllowed);
|
||||
const bool inOrderCopyOnlySignalingAllowed = this->isInOrderExecutionEnabled() && !memoryCopyParams.forceDisableCopyOnlyInOrderSignaling && isCopyOnlyEnabled;
|
||||
|
||||
@@ -2404,7 +2383,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryFill(void *ptr,
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadEnabled() && (patternSize <= this->maxFillPatternSizeForCopyEngine);
|
||||
|
||||
NEO::Device *neoDevice = device->getNEODevice();
|
||||
bool sharedSystemEnabled = isSharedSystemEnabled();
|
||||
bool sharedSystemEnabled = ((neoDevice->areSharedSystemAllocationsAllowed()) && (NEO::debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.get() == 1));
|
||||
uint32_t callId = 0;
|
||||
if (NEO::debugManager.flags.EnableSWTags.get()) {
|
||||
callId = neoDevice->getRootDeviceEnvironment().tagsManager->incrementAndGetCurrentCallCount();
|
||||
|
||||
@@ -141,8 +141,8 @@ class MockCommandListHw : public WhiteBox<::L0::CommandListCoreFamily<gfxCoreFam
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
ze_result_t appendCopyImageBlit(uintptr_t srcPtr, NEO::GraphicsAllocation *src,
|
||||
uintptr_t dstPtr, NEO::GraphicsAllocation *dst,
|
||||
ze_result_t appendCopyImageBlit(NEO::GraphicsAllocation *src,
|
||||
NEO::GraphicsAllocation *dst,
|
||||
const Vec3<size_t> &srcOffsets, const Vec3<size_t> &dstOffsets,
|
||||
size_t srcRowPitch, size_t srcSlicePitch,
|
||||
size_t dstRowPitch, size_t dstSlicePitch,
|
||||
@@ -1682,328 +1682,6 @@ HWTEST_F(CommandListAppendMemoryCopyBlit, whenAppendMemoryCopyBlitIsAppendedAndN
|
||||
EXPECT_NE(firstBatchBufferAllocation, secondBatchBufferAllocation);
|
||||
}
|
||||
|
||||
struct CommandListAppendImage : Test<CommandListFixture> {
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
};
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCommandListWhenAppendImageCopyFromMemoryIsCalledWithNullGraphicsAllocationAndSharedSystemNotEnabledThenErrorIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto commandList = std::make_unique<MockCommandListHw<FamilyType::gfxCoreFamily>>();
|
||||
commandList->failAlignedAlloc = true;
|
||||
commandList->initialize(device, NEO::EngineGroupType::copy, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
auto image = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
image->initialize(device, &zeDesc);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY, commandList->appendImageCopyFromMemory(image->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCommandListWhenAppendImageCopyFromMemoryIsCalledWithNullGraphicsAllocationAndSharedSystemEnabledThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.set(1);
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto commandList = std::make_unique<MockCommandListHw<FamilyType::gfxCoreFamily>>();
|
||||
commandList->failAlignedAlloc = true;
|
||||
commandList->initialize(device, NEO::EngineGroupType::copy, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
VariableBackup<uint64_t> sharedSystemMemCapabilities{&hwInfo.capabilityTable.sharedSystemMemCapabilities};
|
||||
sharedSystemMemCapabilities = 0xf;
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
auto image = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
image->initialize(device, &zeDesc);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyFromMemory(image->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCommandListWhenAppendImageCopyFromMemoryIsCalledWithValidGraphicsAllocationThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto commandList = std::make_unique<MockCommandListHw<FamilyType::gfxCoreFamily>>();
|
||||
commandList->failAlignedAlloc = false;
|
||||
commandList->initialize(device, NEO::EngineGroupType::copy, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
auto image = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
image->initialize(device, &zeDesc);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyFromMemory(image->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCommandListWhenAppendImageCopyToMemoryIsCalledWithNullGraphicsAllocationAndSharedSystemNotEnabledThenErrorIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto commandList = std::make_unique<MockCommandListHw<FamilyType::gfxCoreFamily>>();
|
||||
commandList->failAlignedAlloc = true;
|
||||
commandList->initialize(device, NEO::EngineGroupType::copy, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
auto image = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
image->initialize(device, &zeDesc);
|
||||
|
||||
void *dstPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY, commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), nullptr, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCommandListWhenAppendImageCopyToMemoryIsCalledWithNullGraphicsAllocationAndSharedSystemEnabledThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.set(1);
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto commandList = std::make_unique<MockCommandListHw<FamilyType::gfxCoreFamily>>();
|
||||
commandList->failAlignedAlloc = true;
|
||||
commandList->initialize(device, NEO::EngineGroupType::copy, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
VariableBackup<uint64_t> sharedSystemMemCapabilities{&hwInfo.capabilityTable.sharedSystemMemCapabilities};
|
||||
sharedSystemMemCapabilities = 0xf;
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
auto image = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
image->initialize(device, &zeDesc);
|
||||
|
||||
void *dstPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), nullptr, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCommandListWhenAppendImageCopyToMemoryIsCalledWithValidGraphicsAllocationThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto commandList = std::make_unique<MockCommandListHw<FamilyType::gfxCoreFamily>>();
|
||||
commandList->failAlignedAlloc = false;
|
||||
commandList->initialize(device, NEO::EngineGroupType::copy, 0u);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
auto image = std::make_unique<WhiteBox<::L0::ImageCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
image->initialize(device, &zeDesc);
|
||||
|
||||
void *dstPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), nullptr, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCopyCommandListWhenAppendImageCopyFromMemoryIsCalledWithSharedSystemAndEmitMemAdviseEnabledThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.set(1);
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
VariableBackup<uint64_t> sharedSystemMemCapabilities{&hwInfo.capabilityTable.sharedSystemMemCapabilities};
|
||||
sharedSystemMemCapabilities = 0xf;
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
zeDesc.type = ZE_IMAGE_TYPE_3D;
|
||||
zeDesc.width = 4;
|
||||
zeDesc.height = 2;
|
||||
zeDesc.depth = 2;
|
||||
|
||||
L0::Image *imagePtr = nullptr;
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, L0::Image::create(device->getNEODevice()->getHardwareInfo().platform.eProductFamily, device, &zeDesc, &imagePtr));
|
||||
std::unique_ptr<L0::Image> image(imagePtr);
|
||||
ze_image_region_t dstImgRegion = {2, 1, 1, 4, 2, 2};
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyFromMemory(image->toHandle(), srcPtr, &dstImgRegion, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCopyCommandListWhenAppendImageCopyFromMemoryIsCalledWithSharedSystemEnabledAndEmitMemAdviseNotEnabledThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.set(1);
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(-1);
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
VariableBackup<uint64_t> sharedSystemMemCapabilities{&hwInfo.capabilityTable.sharedSystemMemCapabilities};
|
||||
sharedSystemMemCapabilities = 0xf;
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
zeDesc.type = ZE_IMAGE_TYPE_3D;
|
||||
zeDesc.width = 4;
|
||||
zeDesc.height = 2;
|
||||
zeDesc.depth = 2;
|
||||
|
||||
L0::Image *imagePtr = nullptr;
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, L0::Image::create(device->getNEODevice()->getHardwareInfo().platform.eProductFamily, device, &zeDesc, &imagePtr));
|
||||
std::unique_ptr<L0::Image> image(imagePtr);
|
||||
ze_image_region_t dstImgRegion = {2, 1, 1, 4, 2, 2};
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyFromMemory(image->toHandle(), srcPtr, &dstImgRegion, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenComputeCommandListWhenAppendImageCopyFromMemoryIsCalledWithSharedSystemEnabledThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.set(1);
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto kernel = device->getBuiltinFunctionsLib()->getImageFunction(ImageBuiltin::copyBufferToImage3dBytes);
|
||||
auto mockBuiltinKernel = static_cast<Mock<::L0::KernelImp> *>(kernel);
|
||||
mockBuiltinKernel->setArgRedescribedImageCallBase = false;
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::renderCompute, 0u));
|
||||
|
||||
auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
VariableBackup<uint64_t> sharedSystemMemCapabilities{&hwInfo.capabilityTable.sharedSystemMemCapabilities};
|
||||
sharedSystemMemCapabilities = 0xf;
|
||||
|
||||
void *srcPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
zeDesc.type = ZE_IMAGE_TYPE_3D;
|
||||
zeDesc.width = 4;
|
||||
zeDesc.height = 2;
|
||||
zeDesc.depth = 2;
|
||||
|
||||
L0::Image *imagePtr = nullptr;
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, L0::Image::create(device->getNEODevice()->getHardwareInfo().platform.eProductFamily, device, &zeDesc, &imagePtr));
|
||||
std::unique_ptr<L0::Image> image(imagePtr);
|
||||
ze_image_region_t dstImgRegion = {2, 1, 1, 4, 2, 2};
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyFromMemory(image->toHandle(), srcPtr, &dstImgRegion, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCopyCommandListWhenAppendImageCopyToMemoryIsCalledWithSharedSystemAndEmitMemAdviseEnabledThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.set(1);
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
VariableBackup<uint64_t> sharedSystemMemCapabilities{&hwInfo.capabilityTable.sharedSystemMemCapabilities};
|
||||
sharedSystemMemCapabilities = 0xf;
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
zeDesc.type = ZE_IMAGE_TYPE_3D;
|
||||
zeDesc.width = 4;
|
||||
zeDesc.height = 2;
|
||||
zeDesc.depth = 2;
|
||||
|
||||
L0::Image *imagePtr = nullptr;
|
||||
auto result = L0::Image::create(device->getNEODevice()->getHardwareInfo().platform.eProductFamily, device, &zeDesc, &imagePtr);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
std::unique_ptr<L0::Image> image(imagePtr);
|
||||
ze_image_region_t srcImgRegion = {2, 1, 1, 4, 2, 2};
|
||||
|
||||
void *dstPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &srcImgRegion, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenCopyCommandListWhenAppendImageCopyToMemoryIsCalledWithSharedSystemEnabledAndEmitMemAdviseNotEnabledThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
|
||||
debugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.set(1);
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(-1);
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::copy, 0u));
|
||||
|
||||
auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
VariableBackup<uint64_t> sharedSystemMemCapabilities{&hwInfo.capabilityTable.sharedSystemMemCapabilities};
|
||||
sharedSystemMemCapabilities = 0xf;
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
zeDesc.type = ZE_IMAGE_TYPE_3D;
|
||||
zeDesc.width = 4;
|
||||
zeDesc.height = 2;
|
||||
zeDesc.depth = 2;
|
||||
|
||||
L0::Image *imagePtr = nullptr;
|
||||
auto result = L0::Image::create(device->getNEODevice()->getHardwareInfo().platform.eProductFamily, device, &zeDesc, &imagePtr);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
std::unique_ptr<L0::Image> image(imagePtr);
|
||||
ze_image_region_t srcImgRegion = {2, 1, 1, 4, 2, 2};
|
||||
|
||||
void *dstPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &srcImgRegion, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListAppendImage, givenComputeCommandListWhenAppendImageCopyToMemoryIsCalledWithSharedSystemEnabledThenSuccessIsReturned, IsAtLeastXe2HpgCore) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.EnableSharedSystemUsmSupport.set(1);
|
||||
debugManager.flags.TreatNonUsmForTransfersAsSharedSystem.set(1);
|
||||
debugManager.flags.EmitMemAdvisePriorToCopyForNonUsm.set(1);
|
||||
|
||||
auto kernel = device->getBuiltinFunctionsLib()->getImageFunction(ImageBuiltin::copyImage3dToBufferBytes);
|
||||
auto mockBuiltinKernel = static_cast<Mock<::L0::KernelImp> *>(kernel);
|
||||
mockBuiltinKernel->setArgRedescribedImageCallBase = false;
|
||||
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, commandList->initialize(device, NEO::EngineGroupType::renderCompute, 0u));
|
||||
|
||||
auto &hwInfo = *device->getNEODevice()->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
VariableBackup<uint64_t> sharedSystemMemCapabilities{&hwInfo.capabilityTable.sharedSystemMemCapabilities};
|
||||
sharedSystemMemCapabilities = 0xf;
|
||||
|
||||
ze_image_desc_t zeDesc = {};
|
||||
zeDesc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
|
||||
zeDesc.type = ZE_IMAGE_TYPE_3D;
|
||||
zeDesc.width = 4;
|
||||
zeDesc.height = 2;
|
||||
zeDesc.depth = 2;
|
||||
|
||||
L0::Image *imagePtr = nullptr;
|
||||
auto result = L0::Image::create(device->getNEODevice()->getHardwareInfo().platform.eProductFamily, device, &zeDesc, &imagePtr);
|
||||
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
|
||||
std::unique_ptr<L0::Image> image(imagePtr);
|
||||
ze_image_region_t srcImgRegion = {2, 1, 1, 4, 2, 2};
|
||||
|
||||
void *dstPtr = reinterpret_cast<void *>(0x1234);
|
||||
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, commandList->appendImageCopyToMemory(dstPtr, image->toHandle(), &srcImgRegion, nullptr, 0, nullptr, copyParams));
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct MockL0GfxCoreHelperSupportsCmdListHeapSharingHw : L0::L0GfxCoreHelperHw<GfxFamily> {
|
||||
bool platformSupportsCmdListHeapSharing() const override { return true; }
|
||||
|
||||
@@ -334,7 +334,7 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyCommandListWhenTimestampPassedToImageCo
|
||||
MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {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);
|
||||
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()));
|
||||
@@ -372,7 +372,7 @@ HWTEST2_F(AppendMemoryCopyTests, givenWaitWhenWhenAppendBlitCalledThenProgramSem
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
|
||||
{
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {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);
|
||||
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));
|
||||
|
||||
@@ -384,7 +384,7 @@ HWTEST2_F(AppendMemoryCopyTests, givenWaitWhenWhenAppendBlitCalledThenProgramSem
|
||||
offset = cmdStream->getUsed();
|
||||
auto eventHandle = event->toHandle();
|
||||
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 1, &eventHandle, 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, 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());
|
||||
@@ -455,7 +455,7 @@ HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenTiled1DArrayImagePassed
|
||||
size_t arrayLevels = 8;
|
||||
size_t depth = 1;
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {0, 0, 0}, {0, 0, 0}, 4, 4, 4, 4, 1, {1, arrayLevels, depth}, {1, arrayLevels, depth}, {1, arrayLevels, depth}, nullptr, 0, nullptr, 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()));
|
||||
@@ -490,7 +490,7 @@ HWTEST2_F(AppendMemoryCopyTests, givenCopyCommandListWhenNotTiled1DArrayImagePas
|
||||
size_t arrayLevels = 8;
|
||||
size_t depth = 1;
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, arrayLevels, depth}, {1, arrayLevels, depth}, {1, arrayLevels, depth}, nullptr, 0, nullptr, 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()));
|
||||
@@ -637,7 +637,7 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro
|
||||
EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled);
|
||||
EXPECT_EQ(0u, commandList->inOrderPatchCmds.size());
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 0, nullptr, 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);
|
||||
|
||||
@@ -649,7 +649,7 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro
|
||||
|
||||
commandList->useAdditionalBlitProperties = true;
|
||||
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 0, nullptr, 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(1u, commandList->appendSignalInOrderDependencyCounterCalled);
|
||||
if (commandList->inOrderCmdsPatchingEnabled()) {
|
||||
@@ -674,7 +674,7 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro
|
||||
EXPECT_EQ(0u, commandList->additionalBlitPropertiesCalled);
|
||||
EXPECT_EQ(0u, commandList->inOrderPatchCmds.size());
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 0, nullptr, 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());
|
||||
}
|
||||
@@ -885,7 +885,7 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro
|
||||
EXPECT_EQ(0u, commandList->appendSignalInOrderDependencyCounterCalled);
|
||||
EXPECT_EQ(0u, commandList->inOrderPatchCmds.size());
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 0, nullptr, 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);
|
||||
if (commandList->inOrderCmdsPatchingEnabled()) {
|
||||
@@ -907,18 +907,6 @@ HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPro
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithNonZeroNumWaitEventsAndNullEventHandlesWhenCallingAppendCopyImageBlitThenErrorIsReturned) {
|
||||
auto commandList = std::make_unique<WhiteBox<::L0::CommandListCoreFamily<FamilyType::gfxCoreFamily>>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::copy, 0u);
|
||||
NEO::MockGraphicsAllocation mockAllocationSrc(0, 1u /*num gmms*/, NEO::AllocationType::buffer, reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
NEO::MockGraphicsAllocation mockAllocationDst(0, 1u /*num gmms*/, NEO::AllocationType::image, reinterpret_cast<void *>(0x2345), 0x1000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
|
||||
CmdListMemoryCopyParams copyParams = {};
|
||||
auto result = commandList->appendCopyImageBlit(mockAllocationSrc.getGpuAddress(), &mockAllocationSrc, mockAllocationDst.getGpuAddress(), &mockAllocationDst, {0, 0, 0}, {0, 0, 0}, 1, 1, 1, 1, 1, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, nullptr, 1, nullptr, copyParams);
|
||||
|
||||
EXPECT_EQ(result, ZE_RESULT_ERROR_INVALID_ARGUMENT);
|
||||
}
|
||||
|
||||
HWTEST_F(AppendMemoryCopyTests, givenCopyOnlyCommandListWithUseAdditionalBlitPropertiesWhenPatchingCommandsAfterCallingMemoryFillWithTwoBytesPatternThenCommandsRemainsTheSame) {
|
||||
auto commandList = std::make_unique<MockCommandListForAdditionalBlitProperties2<FamilyType::gfxCoreFamily>>();
|
||||
commandList->initialize(device, NEO::EngineGroupType::copy, ZE_COMMAND_LIST_FLAG_IN_ORDER);
|
||||
|
||||
@@ -183,8 +183,8 @@ class MockCommandListExtensionHw : public WhiteBox<::L0::CommandListCoreFamily<g
|
||||
}
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
ze_result_t appendCopyImageBlit(uintptr_t srcPtr, NEO::GraphicsAllocation *src,
|
||||
uintptr_t dstPtr, NEO::GraphicsAllocation *dst,
|
||||
ze_result_t appendCopyImageBlit(NEO::GraphicsAllocation *src,
|
||||
NEO::GraphicsAllocation *dst,
|
||||
const Vec3<size_t> &srcOffsets, const Vec3<size_t> &dstOffsets,
|
||||
size_t srcRowPitch, size_t srcSlicePitch,
|
||||
size_t dstRowPitch, size_t dstSlicePitch,
|
||||
|
||||
@@ -1086,8 +1086,8 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
|
||||
|
||||
if (blitProperties.blitSyncProperties.outputTimestampPacket) {
|
||||
bool deviceToHostPostSyncFenceRequired = getProductHelper().isDeviceToHostCopySignalingFenceRequired() &&
|
||||
(blitProperties.dstAllocation && !blitProperties.dstAllocation->isAllocatedInLocalMemoryPool()) &&
|
||||
(blitProperties.srcAllocation && blitProperties.srcAllocation->isAllocatedInLocalMemoryPool());
|
||||
!blitProperties.dstAllocation->isAllocatedInLocalMemoryPool() &&
|
||||
blitProperties.srcAllocation->isAllocatedInLocalMemoryPool();
|
||||
|
||||
if (deviceToHostPostSyncFenceRequired) {
|
||||
MemorySynchronizationCommands<GfxFamily>::addAdditionalSynchronization(commandStream, tagAllocation->getGpuAddress(), NEO::FenceType::release, peekRootDeviceEnvironment());
|
||||
@@ -1106,12 +1106,8 @@ TaskCountType CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const BlitPropert
|
||||
}
|
||||
|
||||
blitProperties.csrDependencies.makeResident(*this);
|
||||
if (blitProperties.srcAllocation) {
|
||||
blitProperties.srcAllocation->prepareHostPtrForResidency(this);
|
||||
}
|
||||
if (blitProperties.dstAllocation) {
|
||||
blitProperties.dstAllocation->prepareHostPtrForResidency(this);
|
||||
}
|
||||
blitProperties.srcAllocation->prepareHostPtrForResidency(this);
|
||||
blitProperties.dstAllocation->prepareHostPtrForResidency(this);
|
||||
makeResident(*blitProperties.srcAllocation);
|
||||
makeResident(*blitProperties.dstAllocation);
|
||||
if (blitProperties.clearColorAllocation) {
|
||||
|
||||
@@ -291,14 +291,12 @@ void BlitCommandsHelper<Family>::appendBlitCommandsForImages(const BlitPropertie
|
||||
auto dstRowPitch = static_cast<uint32_t>(blitProperties.dstRowPitch);
|
||||
uint32_t mipTailLod = 0;
|
||||
auto compressionDetails = 0u;
|
||||
if (srcAllocation) {
|
||||
getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, tileType, mipTailLod, compressionDetails,
|
||||
rootDeviceEnvironment, blitProperties.srcPlane);
|
||||
}
|
||||
if (dstAllocation) {
|
||||
getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, tileType, mipTailLod, compressionDetails,
|
||||
rootDeviceEnvironment, blitProperties.dstPlane);
|
||||
}
|
||||
|
||||
getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, tileType, mipTailLod, compressionDetails,
|
||||
rootDeviceEnvironment, blitProperties.srcPlane);
|
||||
getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, tileType, mipTailLod, compressionDetails,
|
||||
rootDeviceEnvironment, blitProperties.dstPlane);
|
||||
|
||||
blitCmd.setSourcePitch(srcRowPitch);
|
||||
blitCmd.setDestinationPitch(dstRowPitch);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ template <typename GfxFamily>
|
||||
void BlitCommandsHelper<GfxFamily>::appendSurfaceType(const BlitProperties &blitProperties, typename GfxFamily::XY_BLOCK_COPY_BLT &blitCmd) {
|
||||
using XY_BLOCK_COPY_BLT = typename GfxFamily::XY_BLOCK_COPY_BLT;
|
||||
|
||||
if (blitProperties.srcAllocation && blitProperties.srcAllocation->getDefaultGmm()) {
|
||||
if (blitProperties.srcAllocation->getDefaultGmm()) {
|
||||
auto resInfo = blitProperties.srcAllocation->getDefaultGmm()->gmmResourceInfo.get();
|
||||
auto resourceType = resInfo->getResourceType();
|
||||
auto isArray = resInfo->getArraySize() > 1;
|
||||
@@ -100,7 +100,7 @@ void BlitCommandsHelper<GfxFamily>::appendSurfaceType(const BlitProperties &blit
|
||||
}
|
||||
}
|
||||
|
||||
if (blitProperties.dstAllocation && blitProperties.dstAllocation->getDefaultGmm()) {
|
||||
if (blitProperties.dstAllocation->getDefaultGmm()) {
|
||||
auto resInfo = blitProperties.dstAllocation->getDefaultGmm()->gmmResourceInfo.get();
|
||||
auto resourceType = resInfo->getResourceType();
|
||||
auto isArray = resInfo->getArraySize() > 1;
|
||||
@@ -212,14 +212,10 @@ void BlitCommandsHelper<GfxFamily>::appendBlitCommandsForImages(const BlitProper
|
||||
auto srcCompressionFormat = blitCmd.getSourceCompressionFormat();
|
||||
auto dstCompressionFormat = blitCmd.getDestinationCompressionFormat();
|
||||
|
||||
if (srcAllocation) {
|
||||
getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, srcTileType, srcMipTailLod, srcCompressionFormat,
|
||||
rootDeviceEnvironment, blitProperties.srcPlane);
|
||||
}
|
||||
if (dstAllocation) {
|
||||
getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, dstTileType, dstMipTailLod, dstCompressionFormat,
|
||||
rootDeviceEnvironment, blitProperties.dstPlane);
|
||||
}
|
||||
getBlitAllocationProperties(*srcAllocation, srcRowPitch, srcQPitch, srcTileType, srcMipTailLod, srcCompressionFormat,
|
||||
rootDeviceEnvironment, blitProperties.srcPlane);
|
||||
getBlitAllocationProperties(*dstAllocation, dstRowPitch, dstQPitch, dstTileType, dstMipTailLod, dstCompressionFormat,
|
||||
rootDeviceEnvironment, blitProperties.dstPlane);
|
||||
|
||||
srcSlicePitch = std::max(srcSlicePitch, srcRowPitch * srcQPitch);
|
||||
dstSlicePitch = std::max(dstSlicePitch, dstRowPitch * dstQPitch);
|
||||
|
||||
@@ -244,13 +244,13 @@ bool BlitProperties::isImageOperation() const {
|
||||
blitDirection == BlitterConstants::BlitDirection::imageToImage;
|
||||
}
|
||||
bool BlitProperties::isSrc1DTiledArray() const {
|
||||
if (srcAllocation && srcAllocation->getDefaultGmm()) {
|
||||
if (srcAllocation->getDefaultGmm()) {
|
||||
return is1DTiledArray(srcAllocation->getDefaultGmm()->gmmResourceInfo.get());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool BlitProperties::isDst1DTiledArray() const {
|
||||
if (dstAllocation && dstAllocation->getDefaultGmm()) {
|
||||
if (dstAllocation->getDefaultGmm()) {
|
||||
return is1DTiledArray(dstAllocation->getDefaultGmm()->gmmResourceInfo.get());
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -68,35 +68,35 @@ void BlitCommandsHelper<Family>::appendBlitCommandsBlockCopy(const BlitPropertie
|
||||
auto dstAllocation = blitProperties.dstAllocation;
|
||||
auto srcAllocation = blitProperties.srcAllocation;
|
||||
|
||||
if (srcAllocation && srcAllocation->isCompressionEnabled()) {
|
||||
if (srcAllocation->isCompressionEnabled()) {
|
||||
auto resourceFormat = srcAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat();
|
||||
srcCompressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
}
|
||||
|
||||
if (dstAllocation && dstAllocation->isCompressionEnabled()) {
|
||||
if (dstAllocation->isCompressionEnabled()) {
|
||||
auto resourceFormat = dstAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat();
|
||||
dstCompressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
}
|
||||
|
||||
if (debugManager.flags.ForceBufferCompressionFormat.get() != -1) {
|
||||
if (srcAllocation && srcAllocation->isCompressionEnabled()) {
|
||||
if (srcAllocation->isCompressionEnabled()) {
|
||||
srcCompressionFormat = static_cast<uint8_t>(debugManager.flags.ForceBufferCompressionFormat.get());
|
||||
}
|
||||
if (dstAllocation && dstAllocation->isCompressionEnabled()) {
|
||||
if (dstAllocation->isCompressionEnabled()) {
|
||||
dstCompressionFormat = static_cast<uint8_t>(debugManager.flags.ForceBufferCompressionFormat.get());
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_BREAK_IF((AuxTranslationDirection::none != blitProperties.auxTranslationDirection) &&
|
||||
(blitProperties.dstAllocation != blitProperties.srcAllocation || (blitProperties.dstAllocation && !blitProperties.dstAllocation->isCompressionEnabled())));
|
||||
(blitProperties.dstAllocation != blitProperties.srcAllocation || !blitProperties.dstAllocation->isCompressionEnabled()));
|
||||
|
||||
blitCmd.setSourceCompressionFormat(static_cast<XY_BLOCK_COPY_BLT::SOURCE_COMPRESSION_FORMAT>(srcCompressionFormat));
|
||||
blitCmd.setDestinationCompressionFormat(static_cast<XY_BLOCK_COPY_BLT::DESTINATION_COMPRESSION_FORMAT>(dstCompressionFormat));
|
||||
|
||||
if (!dstAllocation || MemoryPoolHelper::isSystemMemoryPool(dstAllocation->getMemoryPool())) {
|
||||
if (MemoryPoolHelper::isSystemMemoryPool(blitProperties.dstAllocation->getMemoryPool())) {
|
||||
blitCmd.setDestinationTargetMemory(XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
if (!srcAllocation || MemoryPoolHelper::isSystemMemoryPool(srcAllocation->getMemoryPool())) {
|
||||
if (MemoryPoolHelper::isSystemMemoryPool(blitProperties.srcAllocation->getMemoryPool())) {
|
||||
blitCmd.setSourceTargetMemory(XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,35 +67,35 @@ void BlitCommandsHelper<Family>::appendBlitCommandsBlockCopy(const BlitPropertie
|
||||
auto dstAllocation = blitProperties.dstAllocation;
|
||||
auto srcAllocation = blitProperties.srcAllocation;
|
||||
|
||||
if (srcAllocation && srcAllocation->isCompressionEnabled()) {
|
||||
if (srcAllocation->isCompressionEnabled()) {
|
||||
auto resourceFormat = srcAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat();
|
||||
srcCompressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
}
|
||||
|
||||
if (dstAllocation && dstAllocation->isCompressionEnabled()) {
|
||||
if (dstAllocation->isCompressionEnabled()) {
|
||||
auto resourceFormat = dstAllocation->getDefaultGmm()->gmmResourceInfo->getResourceFormat();
|
||||
dstCompressionFormat = rootDeviceEnvironment.getGmmClientContext()->getSurfaceStateCompressionFormat(resourceFormat);
|
||||
}
|
||||
|
||||
if (debugManager.flags.ForceBufferCompressionFormat.get() != -1) {
|
||||
if (srcAllocation && srcAllocation->isCompressionEnabled()) {
|
||||
if (srcAllocation->isCompressionEnabled()) {
|
||||
srcCompressionFormat = static_cast<uint8_t>(debugManager.flags.ForceBufferCompressionFormat.get());
|
||||
}
|
||||
if (dstAllocation && dstAllocation->isCompressionEnabled()) {
|
||||
if (dstAllocation->isCompressionEnabled()) {
|
||||
dstCompressionFormat = static_cast<uint8_t>(debugManager.flags.ForceBufferCompressionFormat.get());
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_BREAK_IF((AuxTranslationDirection::none != blitProperties.auxTranslationDirection) &&
|
||||
(blitProperties.dstAllocation != blitProperties.srcAllocation || (blitProperties.dstAllocation && !blitProperties.dstAllocation->isCompressionEnabled())));
|
||||
(blitProperties.dstAllocation != blitProperties.srcAllocation || !blitProperties.dstAllocation->isCompressionEnabled()));
|
||||
|
||||
blitCmd.setSourceCompressionFormat(static_cast<XY_BLOCK_COPY_BLT::SOURCE_COMPRESSION_FORMAT>(srcCompressionFormat));
|
||||
blitCmd.setDestinationCompressionFormat(static_cast<XY_BLOCK_COPY_BLT::DESTINATION_COMPRESSION_FORMAT>(dstCompressionFormat));
|
||||
|
||||
if (!dstAllocation || MemoryPoolHelper::isSystemMemoryPool(dstAllocation->getMemoryPool())) {
|
||||
if (MemoryPoolHelper::isSystemMemoryPool(blitProperties.dstAllocation->getMemoryPool())) {
|
||||
blitCmd.setDestinationTargetMemory(XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
if (!srcAllocation || MemoryPoolHelper::isSystemMemoryPool(srcAllocation->getMemoryPool())) {
|
||||
if (MemoryPoolHelper::isSystemMemoryPool(blitProperties.srcAllocation->getMemoryPool())) {
|
||||
blitCmd.setSourceTargetMemory(XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ void BlitCommandsHelper<Family>::appendBlitCommandsMemCopy(const BlitProperties
|
||||
}
|
||||
|
||||
DEBUG_BREAK_IF((AuxTranslationDirection::none != blitProperties.auxTranslationDirection) &&
|
||||
(dstAllocation != srcAllocation || (dstAllocation && !dstAllocation->isCompressionEnabled())));
|
||||
(dstAllocation != srcAllocation || !dstAllocation->isCompressionEnabled()));
|
||||
}
|
||||
|
||||
template <>
|
||||
@@ -209,8 +209,8 @@ void BlitCommandsHelper<Family>::encodeWa(LinearStream &cmdStream, const BlitPro
|
||||
const bool applyForDst = (debugManager.flags.EnableBcsSwControlWa.get() & dstInSystemMemOnly);
|
||||
const bool applyAlways = (debugManager.flags.EnableBcsSwControlWa.get() == enableAlways);
|
||||
|
||||
const bool enableWa = ((blitProperties.srcAllocation && !blitProperties.srcAllocation->isAllocatedInLocalMemoryPool()) && applyForSrc) ||
|
||||
((blitProperties.dstAllocation && !blitProperties.dstAllocation->isAllocatedInLocalMemoryPool()) && applyForDst) ||
|
||||
const bool enableWa = (!blitProperties.srcAllocation->isAllocatedInLocalMemoryPool() && applyForSrc) ||
|
||||
(!blitProperties.dstAllocation->isAllocatedInLocalMemoryPool() && applyForDst) ||
|
||||
applyAlways;
|
||||
|
||||
uint32_t newValue = enableWa ? waEnabledMMioValue : waDisabledMMioValue;
|
||||
|
||||
@@ -49,9 +49,9 @@ template <>
|
||||
void BlitCommandsHelper<Family>::adjustControlSurfaceType(const BlitProperties &blitProperties, typename Family::XY_BLOCK_COPY_BLT &blitCmd) {
|
||||
using CONTROL_SURFACE_TYPE = typename Family::XY_BLOCK_COPY_BLT::CONTROL_SURFACE_TYPE;
|
||||
using COMPRESSION_ENABLE = typename Family::XY_BLOCK_COPY_BLT::COMPRESSION_ENABLE;
|
||||
|
||||
auto srcAllocation = blitProperties.srcAllocation;
|
||||
if (srcAllocation && srcAllocation->getDefaultGmm()) {
|
||||
|
||||
if (srcAllocation->getDefaultGmm()) {
|
||||
auto gmmResourceInfo = srcAllocation->getDefaultGmm()->gmmResourceInfo.get();
|
||||
auto resInfo = gmmResourceInfo->getResourceFlags()->Info;
|
||||
if (resInfo.MediaCompressed) {
|
||||
@@ -62,7 +62,7 @@ void BlitCommandsHelper<Family>::adjustControlSurfaceType(const BlitProperties &
|
||||
}
|
||||
|
||||
auto dstAllocation = blitProperties.dstAllocation;
|
||||
if (dstAllocation && dstAllocation->getDefaultGmm()) {
|
||||
if (dstAllocation->getDefaultGmm()) {
|
||||
auto gmmResourceInfo = dstAllocation->getDefaultGmm()->gmmResourceInfo.get();
|
||||
auto resInfo = gmmResourceInfo->getResourceFlags()->Info;
|
||||
if (resInfo.MediaCompressed) {
|
||||
@@ -90,13 +90,12 @@ void BlitCommandsHelper<Family>::appendBlitCommandsBlockCopy(const BlitPropertie
|
||||
compressionEnabledField = static_cast<typename XY_BLOCK_COPY_BLT::COMPRESSION_ENABLE>(debugManager.flags.ForceCompressionDisabledForCompressedBlitCopies.get());
|
||||
}
|
||||
|
||||
if (blitProperties.dstAllocation && blitProperties.dstAllocation->isCompressionEnabled()) {
|
||||
if (blitProperties.dstAllocation->isCompressionEnabled()) {
|
||||
blitCmd.setDestinationCompressionEnable(compressionEnabledField);
|
||||
blitCmd.setDestinationAuxiliarysurfacemode(XY_BLOCK_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
blitCmd.setDestinationCompressionFormat(compressionFormat);
|
||||
}
|
||||
|
||||
if (blitProperties.srcAllocation && blitProperties.srcAllocation->isCompressionEnabled()) {
|
||||
if (blitProperties.srcAllocation->isCompressionEnabled()) {
|
||||
blitCmd.setSourceCompressionEnable(compressionEnabledField);
|
||||
blitCmd.setSourceAuxiliarysurfacemode(XY_BLOCK_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
blitCmd.setSourceCompressionFormat(compressionFormat);
|
||||
@@ -129,7 +128,7 @@ void BlitCommandsHelper<Family>::appendBlitCommandsBlockCopy(const BlitPropertie
|
||||
}
|
||||
|
||||
DEBUG_BREAK_IF((AuxTranslationDirection::none != blitProperties.auxTranslationDirection) &&
|
||||
(blitProperties.dstAllocation != blitProperties.srcAllocation || (blitProperties.dstAllocation && !blitProperties.dstAllocation->isCompressionEnabled())));
|
||||
(blitProperties.dstAllocation != blitProperties.srcAllocation || !blitProperties.dstAllocation->isCompressionEnabled()));
|
||||
|
||||
auto mocs = rootDeviceEnvironment.getGmmHelper()->getUncachedMOCS();
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ TEST_F(BlitPropertiesTests, givenBlitPropertiesWhenDstIs1DTiledArrayThenTransfor
|
||||
EXPECT_EQ(blitProperties.dstOffset.y, 0u);
|
||||
EXPECT_EQ(blitProperties.dstOffset.z, size.y);
|
||||
}
|
||||
|
||||
TEST_F(BlitPropertiesTests, givenBlitPropertiesWhenDstAndSrcIsNot1DTiledArrayThenSizeAndOffsetNotchanged) {
|
||||
blitProperties.transform1DArrayTo2DArrayIfNeeded();
|
||||
|
||||
@@ -144,24 +143,4 @@ TEST_F(BlitPropertiesTests, givenGmmResInfoForTiled1DWhenIs1DTiledArrayCalledThe
|
||||
resourceInfoSrc->mockResourceCreateParams.ArraySize = 1;
|
||||
EXPECT_FALSE(blitProperties.is1DTiledArray(resourceInfoSrc));
|
||||
}
|
||||
|
||||
TEST_F(BlitPropertiesTests, givenNullSrcAllocationWhenCallingIsSrc1DTiledArrayThenFalseIsReturned) {
|
||||
blitProperties.srcAllocation = nullptr;
|
||||
EXPECT_FALSE(blitProperties.isSrc1DTiledArray());
|
||||
}
|
||||
|
||||
TEST_F(BlitPropertiesTests, givenNullDstAllocationWhenCallingIsDst1DTiledArrayThenFalseIsReturned) {
|
||||
blitProperties.dstAllocation = nullptr;
|
||||
EXPECT_FALSE(blitProperties.isDst1DTiledArray());
|
||||
}
|
||||
|
||||
TEST_F(BlitPropertiesTests, givenSrcAllocationWithNullGmmWhenCallingIsSrc1DTiledArrayThenFalseIsReturned) {
|
||||
blitProperties.srcAllocation->setGmm(nullptr, 0);
|
||||
EXPECT_FALSE(blitProperties.isSrc1DTiledArray());
|
||||
}
|
||||
|
||||
TEST_F(BlitPropertiesTests, givenDstAllocationWithNullGmmWhenCallingIsDst1DTiledArrayThenFalseIsReturned) {
|
||||
blitProperties.dstAllocation->setGmm(nullptr, 0);
|
||||
EXPECT_FALSE(blitProperties.isDst1DTiledArray());
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1422,258 +1422,3 @@ HWTEST2_F(BlitTests, givenXyCopyBltCommandWhenApplyBlitPropertiesIsCalledThenNot
|
||||
NEO::BlitCommandsHelper<FamilyType>::applyAdditionalBlitProperties(properties, bltCmd, pDevice->getRootDeviceEnvironment(), true);
|
||||
EXPECT_EQ(memcmp(&bltCmd, &bltCmdBefore, sizeof(XY_COPY_BLT)), 0);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenSrcAndDstAllocationWithCompressionEnabledWhenAppendBlitCommandsBlockCopyThenSetSrcAndDstTargetMemToLocalMemAndCompressionHandled, IsXeHpgCore) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
blitCmd.setSourceX1CoordinateLeft(0);
|
||||
blitCmd.setSourceY1CoordinateTop(0);
|
||||
blitCmd.setDestinationX2CoordinateRight(1);
|
||||
blitCmd.setDestinationY2CoordinateBottom(1);
|
||||
|
||||
BlitProperties properties{};
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
|
||||
gmm->setCompressionEnabled(true);
|
||||
MockGraphicsAllocation mockDstAllocation(0, 1u /*num gmms*/, AllocationType::internalHostMemory, reinterpret_cast<void *>(0x1234),
|
||||
0x2000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
MockGraphicsAllocation mockSrcAllocation(0, 1u /*num gmms*/, AllocationType::internalHostMemory, reinterpret_cast<void *>(0x2345),
|
||||
0x2000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
mockDstAllocation.setGmm(gmm.get(), 0);
|
||||
mockSrcAllocation.setGmm(gmm.get(), 0);
|
||||
|
||||
properties.dstAllocation = &mockDstAllocation;
|
||||
properties.srcAllocation = &mockSrcAllocation;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsBlockCopy(properties, blitCmd, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(blitCmd.getSourceTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionEnable(), XY_BLOCK_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionEnable(), XY_BLOCK_COPY_BLT::COMPRESSION_ENABLE::COMPRESSION_ENABLE_COMPRESSION_ENABLE);
|
||||
EXPECT_EQ(blitCmd.getDestinationAuxiliarysurfacemode(), XY_BLOCK_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
EXPECT_EQ(blitCmd.getSourceAuxiliarysurfacemode(), XY_BLOCK_COPY_BLT::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenSrcAndDstAllocationWithoutCompressionEnabledWhenAppendBlitCommandsBlockCopyThenSetSrcAndDstTargetMemToLocalMemAndCompressionHandled, IsXeHpgCore) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
blitCmd.setSourceX1CoordinateLeft(0);
|
||||
blitCmd.setSourceY1CoordinateTop(0);
|
||||
blitCmd.setDestinationX2CoordinateRight(1);
|
||||
blitCmd.setDestinationY2CoordinateBottom(1);
|
||||
|
||||
BlitProperties properties{};
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
|
||||
gmm->setCompressionEnabled(false);
|
||||
MockGraphicsAllocation mockDstAllocation(0, 1u /*num gmms*/, AllocationType::internalHostMemory, reinterpret_cast<void *>(0x1234),
|
||||
0x2000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
MockGraphicsAllocation mockSrcAllocation(0, 1u /*num gmms*/, AllocationType::internalHostMemory, reinterpret_cast<void *>(0x2345),
|
||||
0x2000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
mockDstAllocation.setGmm(gmm.get(), 0);
|
||||
mockSrcAllocation.setGmm(gmm.get(), 0);
|
||||
|
||||
properties.dstAllocation = &mockDstAllocation;
|
||||
properties.srcAllocation = &mockSrcAllocation;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsBlockCopy(properties, blitCmd, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(blitCmd.getSourceTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionEnable(), 0u);
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionEnable(), 0u);
|
||||
EXPECT_EQ(blitCmd.getDestinationAuxiliarysurfacemode(), 0u);
|
||||
EXPECT_EQ(blitCmd.getSourceAuxiliarysurfacemode(), 0u);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenNullAllocationsWhenAppendBlitCommandsBlockCopyThenSetSrcAndDstTargetMemToLocalMemAndCompressionHandled, IsXeHpgCore) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
blitCmd.setSourceX1CoordinateLeft(0);
|
||||
blitCmd.setSourceY1CoordinateTop(0);
|
||||
blitCmd.setDestinationX2CoordinateRight(1);
|
||||
blitCmd.setDestinationY2CoordinateBottom(1);
|
||||
|
||||
BlitProperties properties{};
|
||||
|
||||
properties.dstAllocation = nullptr;
|
||||
properties.srcAllocation = nullptr;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsBlockCopy(properties, blitCmd, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(blitCmd.getSourceTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_LOCAL_MEM);
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionEnable(), 0u);
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionEnable(), 0u);
|
||||
EXPECT_EQ(blitCmd.getDestinationAuxiliarysurfacemode(), 0u);
|
||||
EXPECT_EQ(blitCmd.getSourceAuxiliarysurfacemode(), 0u);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenNullAllocationsWhenAdjustControlSurfaceTypeThenSurfaceTypeWillNotChange, IsXeHpgCore) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
BlitProperties properties{};
|
||||
properties.srcAllocation = nullptr;
|
||||
properties.dstAllocation = nullptr;
|
||||
|
||||
constexpr auto initialSrcSurface = 0; // CONTROL_SURFACE_TYPE_3D
|
||||
constexpr auto initialDstSurface = 0; // CONTROL_SURFACE_TYPE_3D
|
||||
|
||||
BlitCommandsHelper<FamilyType>::adjustControlSurfaceType(properties, blitCmd);
|
||||
|
||||
EXPECT_EQ(blitCmd.getSourceControlSurfaceType(), initialSrcSurface);
|
||||
EXPECT_EQ(blitCmd.getDestinationControlSurfaceType(), initialDstSurface);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenSrcAndDstAllocationWithCompressionEnabledAndForceBufferCompressionFormatSetWhenAppendBlitCommandsBlockCopyIsCalledThenSetSrcAndDstTargetMemToSystemMemAndCompressionHandled, IsAtLeastXe2HpgCore) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
blitCmd.setSourceX1CoordinateLeft(0);
|
||||
blitCmd.setSourceY1CoordinateTop(0);
|
||||
blitCmd.setDestinationX2CoordinateRight(1);
|
||||
blitCmd.setDestinationY2CoordinateBottom(1);
|
||||
|
||||
BlitProperties properties = {};
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
|
||||
uint32_t compressionFormat = 1;
|
||||
debugManager.flags.ForceBufferCompressionFormat.set(static_cast<int32_t>(compressionFormat));
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
|
||||
gmm->setCompressionEnabled(true);
|
||||
MockGraphicsAllocation mockDstAllocation(0, 1u /*num gmms*/, AllocationType::buffer, reinterpret_cast<void *>(0x1234), 0x1000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
MockGraphicsAllocation mockSrcAllocation(0, 1u /*num gmms*/, AllocationType::buffer, reinterpret_cast<void *>(0x2345), 0x2000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
mockDstAllocation.setGmm(gmm.get(), 0);
|
||||
mockSrcAllocation.setGmm(gmm.get(), 0);
|
||||
|
||||
properties.dstAllocation = &mockDstAllocation;
|
||||
properties.srcAllocation = &mockSrcAllocation;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsBlockCopy(properties, blitCmd, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionFormat(), compressionFormat);
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionFormat(), compressionFormat);
|
||||
EXPECT_EQ(blitCmd.getDestinationTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
EXPECT_EQ(blitCmd.getSourceTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenSrcAllocationWithoutCompressionEnabledAndForceBufferCompressionFormatSetWhenAppendBlitCommandsBlockCopyIsCalledThenSetSrcTargetMemToSystemMemAndCompressionHandled, IsAtLeastXe2HpgCore) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
blitCmd.setSourceX1CoordinateLeft(0);
|
||||
blitCmd.setSourceY1CoordinateTop(0);
|
||||
blitCmd.setDestinationX2CoordinateRight(1);
|
||||
blitCmd.setDestinationY2CoordinateBottom(1);
|
||||
|
||||
BlitProperties properties = {};
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
|
||||
MockGraphicsAllocation mockSrcAllocation(0, 1u /*num gmms*/, AllocationType::internalHostMemory, reinterpret_cast<void *>(0x1234),
|
||||
0x2000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
|
||||
gmm->setCompressionEnabled(false);
|
||||
mockSrcAllocation.setGmm(gmm.get(), 0);
|
||||
|
||||
properties.srcAllocation = &mockSrcAllocation;
|
||||
properties.dstAllocation = nullptr;
|
||||
|
||||
debugManager.flags.ForceBufferCompressionFormat.set(1);
|
||||
|
||||
auto initialDstCompressionFormat = blitCmd.getDestinationCompressionFormat();
|
||||
auto initialSrcCompressionFormat = blitCmd.getSourceCompressionFormat();
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsBlockCopy(properties, blitCmd, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionFormat(), initialDstCompressionFormat);
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionFormat(), initialSrcCompressionFormat);
|
||||
EXPECT_EQ(blitCmd.getDestinationTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
EXPECT_EQ(blitCmd.getSourceTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenDstAllocationWithoutCompressionEnabledAndForceBufferCompressionFormatSetWhenAppendBlitCommandsBlockCopyIsCalledThenSetDstTargetMemToSystemMemAndCompressionHandled, IsAtLeastXe2HpgCore) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
blitCmd.setSourceX1CoordinateLeft(0);
|
||||
blitCmd.setSourceY1CoordinateTop(0);
|
||||
blitCmd.setDestinationX2CoordinateRight(1);
|
||||
blitCmd.setDestinationY2CoordinateBottom(1);
|
||||
|
||||
BlitProperties properties = {};
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
|
||||
MockGraphicsAllocation mockDstAllocation(0, 1u /*num gmms*/, AllocationType::internalHostMemory, reinterpret_cast<void *>(0x1234),
|
||||
0x2000, 0, sizeof(uint32_t), MemoryPool::system4KBPages, MemoryManager::maxOsContextCount);
|
||||
|
||||
auto gmm = std::make_unique<MockGmm>(pDevice->getGmmHelper());
|
||||
gmm->setCompressionEnabled(false);
|
||||
mockDstAllocation.setGmm(gmm.get(), 0);
|
||||
|
||||
properties.dstAllocation = &mockDstAllocation;
|
||||
properties.srcAllocation = nullptr;
|
||||
|
||||
debugManager.flags.ForceBufferCompressionFormat.set(1);
|
||||
|
||||
auto initialDstCompressionFormat = blitCmd.getDestinationCompressionFormat();
|
||||
auto initialSrcCompressionFormat = blitCmd.getSourceCompressionFormat();
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsBlockCopy(properties, blitCmd, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionFormat(), initialDstCompressionFormat);
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionFormat(), initialSrcCompressionFormat);
|
||||
EXPECT_EQ(blitCmd.getDestinationTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
EXPECT_EQ(blitCmd.getSourceTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenNullAllocationsAndForceBufferCompressionFormatSetWhenAppendBlitCommandsBlockCopyIsCalledThenSetSrcAndDstTargetMemToSystemMemAndCompressionHandled, IsAtLeastXe2HpgCore) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
blitCmd.setSourceX1CoordinateLeft(0);
|
||||
blitCmd.setSourceY1CoordinateTop(0);
|
||||
blitCmd.setDestinationX2CoordinateRight(1);
|
||||
blitCmd.setDestinationY2CoordinateBottom(1);
|
||||
|
||||
BlitProperties properties = {};
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
|
||||
properties.dstAllocation = nullptr;
|
||||
properties.srcAllocation = nullptr;
|
||||
|
||||
debugManager.flags.ForceBufferCompressionFormat.set(1);
|
||||
|
||||
auto initialDstCompressionFormat = blitCmd.getDestinationCompressionFormat();
|
||||
auto initialSrcCompressionFormat = blitCmd.getSourceCompressionFormat();
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsBlockCopy(properties, blitCmd, pDevice->getRootDeviceEnvironment());
|
||||
|
||||
EXPECT_EQ(blitCmd.getDestinationCompressionFormat(), initialDstCompressionFormat);
|
||||
EXPECT_EQ(blitCmd.getSourceCompressionFormat(), initialSrcCompressionFormat);
|
||||
EXPECT_EQ(blitCmd.getDestinationTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
EXPECT_EQ(blitCmd.getSourceTargetMemory(), XY_BLOCK_COPY_BLT::TARGET_MEMORY::TARGET_MEMORY_SYSTEM_MEM);
|
||||
}
|
||||
|
||||
HWTEST2_F(BlitTests, givenNullAllocationsWhenAppendBlitCommandsForImagesThenSlicePitchesWillBeUpdated, IsNotPVC) {
|
||||
using XY_BLOCK_COPY_BLT = typename FamilyType::XY_BLOCK_COPY_BLT;
|
||||
XY_BLOCK_COPY_BLT blitCmd = FamilyType::cmdInitXyBlockCopyBlt;
|
||||
|
||||
BlitProperties properties{};
|
||||
properties.dstAllocation = nullptr;
|
||||
properties.srcAllocation = nullptr;
|
||||
properties.dstSize = {8, 12, 1};
|
||||
properties.srcSize = {10, 10, 1};
|
||||
properties.dstRowPitch = 0x40;
|
||||
properties.srcRowPitch = 0x10;
|
||||
uint32_t dstSlicePitch = 0;
|
||||
uint32_t srcSlicePitch = 0;
|
||||
|
||||
BlitCommandsHelper<FamilyType>::appendBlitCommandsForImages(properties, blitCmd, pDevice->getRootDeviceEnvironment(), srcSlicePitch, dstSlicePitch);
|
||||
|
||||
EXPECT_NE(dstSlicePitch, 0u);
|
||||
EXPECT_NE(srcSlicePitch, 0u);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user