mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
fix: adjust copy offload selection logic
Related-To: NEO-16250 Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
42371ee7bd
commit
6bee05e894
@@ -441,7 +441,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 isCopyOffloadAllowed(const NEO::GraphicsAllocation *srcAllocation, const NEO::GraphicsAllocation *dstAllocation, bool imageToBuffer) const;
|
||||
bool isSharedSystemEnabled() const;
|
||||
void emitMemAdviseForSystemCopy(const AlignedAllocationData &allocationStruct, size_t size);
|
||||
void setAdditionalKernelLaunchParams(CmdListKernelLaunchParams &launchParams, Kernel &kernel) const;
|
||||
|
||||
@@ -824,7 +824,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
|
||||
image = peerImage;
|
||||
}
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(allocationStruct.alloc, image->getAllocation());
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(allocationStruct.alloc, image->getAllocation(), false);
|
||||
|
||||
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
|
||||
if ((bytesPerPixel == 3) || (bytesPerPixel == 6) || image->isMimickedImage()) {
|
||||
@@ -1029,7 +1029,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyToMemoryExt(voi
|
||||
image = peerImage;
|
||||
}
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(image->getAllocation(), allocationStruct.alloc);
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(image->getAllocation(), allocationStruct.alloc, true);
|
||||
|
||||
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
|
||||
if ((bytesPerPixel == 3) || (bytesPerPixel == 6) || image->isMimickedImage()) {
|
||||
@@ -1241,7 +1241,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(), false);
|
||||
|
||||
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
|
||||
auto bytesPerPixel = static_cast<uint32_t>(srcImage->getImageInfo().surfaceFormat->imageElementSizeInBytes);
|
||||
@@ -1764,7 +1764,12 @@ 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 {
|
||||
bool CommandListCoreFamily<gfxCoreFamily>::isCopyOffloadAllowed(const NEO::GraphicsAllocation *srcAllocation, const NEO::GraphicsAllocation *dstAllocation, bool imageToBuffer) const {
|
||||
bool preferred = device->getProductHelper().blitEnqueuePreferred(imageToBuffer);
|
||||
if (!NEO::debugManager.flags.EnableBlitterForEnqueueOperations.getIfNotDefault(preferred)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (srcAllocation == nullptr || dstAllocation == nullptr) {
|
||||
return isCopyOffloadEnabled();
|
||||
}
|
||||
@@ -1911,7 +1916,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
|
||||
emitMemAdviseForSystemCopy(dstAllocationStruct, size);
|
||||
emitMemAdviseForSystemCopy(srcAllocationStruct, size);
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc);
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc, false);
|
||||
|
||||
const bool isCopyOnlyEnabled = isCopyOnly(memoryCopyParams.copyOffloadAllowed);
|
||||
const bool inOrderCopyOnlySignalingAllowed = this->isInOrderExecutionEnabled() && !memoryCopyParams.forceDisableCopyOnlyInOrderSignaling && isCopyOnlyEnabled;
|
||||
@@ -2163,7 +2168,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyRegion(void *d
|
||||
emitMemAdviseForSystemCopy(dstAllocationStruct, dstSize);
|
||||
emitMemAdviseForSystemCopy(srcAllocationStruct, srcSize);
|
||||
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc);
|
||||
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc, false);
|
||||
const bool isCopyOnlyEnabled = isCopyOnly(memoryCopyParams.copyOffloadAllowed);
|
||||
const bool inOrderCopyOnlySignalingAllowed = this->isInOrderExecutionEnabled() && !memoryCopyParams.forceDisableCopyOnlyInOrderSignaling && isCopyOnlyEnabled;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user