Revert "fix: adjust copy offload selection logic"

This reverts commit 6bee05e894.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2025-10-07 04:25:47 +02:00
committed by Compute-Runtime-Automation
parent bafb847c73
commit fca882ceda
4 changed files with 7 additions and 58 deletions

View File

@@ -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, bool imageToBuffer) const;
bool isCopyOffloadAllowed(const NEO::GraphicsAllocation *srcAllocation, const NEO::GraphicsAllocation *dstAllocation) const;
bool isSharedSystemEnabled() const;
void emitMemAdviseForSystemCopy(const AlignedAllocationData &allocationStruct, size_t size);
void setAdditionalKernelLaunchParams(CmdListKernelLaunchParams &launchParams, Kernel &kernel) const;

View File

@@ -824,7 +824,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendImageCopyFromMemoryExt(z
image = peerImage;
}
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(allocationStruct.alloc, image->getAllocation(), false);
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(allocationStruct.alloc, image->getAllocation());
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, true);
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(image->getAllocation(), allocationStruct.alloc);
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(), false);
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcImage->getAllocation(), dstImage->getAllocation());
if (isCopyOnly(memoryCopyParams.copyOffloadAllowed)) {
auto bytesPerPixel = static_cast<uint32_t>(srcImage->getImageInfo().surfaceFormat->imageElementSizeInBytes);
@@ -1764,12 +1764,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendPageFaultCopy(NEO::Graph
}
template <GFXCORE_FAMILY gfxCoreFamily>
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;
}
bool CommandListCoreFamily<gfxCoreFamily>::isCopyOffloadAllowed(const NEO::GraphicsAllocation *srcAllocation, const NEO::GraphicsAllocation *dstAllocation) const {
if (srcAllocation == nullptr || dstAllocation == nullptr) {
return isCopyOffloadEnabled();
}
@@ -1916,7 +1911,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopy(void *dstptr,
emitMemAdviseForSystemCopy(dstAllocationStruct, size);
emitMemAdviseForSystemCopy(srcAllocationStruct, size);
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc, false);
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc);
const bool isCopyOnlyEnabled = isCopyOnly(memoryCopyParams.copyOffloadAllowed);
const bool inOrderCopyOnlySignalingAllowed = this->isInOrderExecutionEnabled() && !memoryCopyParams.forceDisableCopyOnlyInOrderSignaling && isCopyOnlyEnabled;
@@ -2168,7 +2163,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendMemoryCopyRegion(void *d
emitMemAdviseForSystemCopy(dstAllocationStruct, dstSize);
emitMemAdviseForSystemCopy(srcAllocationStruct, srcSize);
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc, false);
memoryCopyParams.copyOffloadAllowed = isCopyOffloadAllowed(srcAllocationStruct.alloc, dstAllocationStruct.alloc);
const bool isCopyOnlyEnabled = isCopyOnly(memoryCopyParams.copyOffloadAllowed);
const bool inOrderCopyOnlySignalingAllowed = this->isInOrderExecutionEnabled() && !memoryCopyParams.forceDisableCopyOnlyInOrderSignaling && isCopyOnlyEnabled;

View File

@@ -235,7 +235,6 @@ struct WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>>
using BaseClass::internalUsage;
using BaseClass::interruptEvents;
using BaseClass::isBcsSplitNeeded;
using BaseClass::isCopyOffloadAllowed;
using BaseClass::isInOrderNonWalkerSignalingRequired;
using BaseClass::isQwordInOrderCounter;
using BaseClass::isSyncModeQueue;

View File

@@ -25,7 +25,6 @@ namespace ult {
struct CopyOffloadInOrderTests : public InOrderCmdListFixture {
void SetUp() override {
debugManager.flags.EnableLocalMemory.set(1);
debugManager.flags.EnableBlitterForEnqueueOperations.set(1);
backupHwInfo = std::make_unique<VariableBackup<NEO::HardwareInfo>>(defaultHwInfo.get());
defaultHwInfo->capabilityTable.blitterOperationsSupported = true;
defaultHwInfo->featureTable.ftrBcsInfo = 0b111;
@@ -50,49 +49,6 @@ struct CopyOffloadInOrderTests : public InOrderCmdListFixture {
std::unique_ptr<VariableBackup<NEO::HardwareInfo>> backupHwInfo;
};
HWTEST_F(CopyOffloadInOrderTests, givenDebugFlagSetWhenAskingForCopyOffloadThenReturnCorrectValue) {
auto immCmdList = createImmCmdListWithOffload<FamilyType::gfxCoreFamily>();
MockGraphicsAllocation hostAlloc;
hostAlloc.overrideMemoryPool(NEO::MemoryPool::system64KBPages);
MockGraphicsAllocation deviceAlloc;
deviceAlloc.overrideMemoryPool(NEO::MemoryPool::localMemory);
auto &productHelper = device->getProductHelper();
std::array<GraphicsAllocation *, 3> allocations = {&hostAlloc, &deviceAlloc, nullptr};
for (int32_t flag : {-1, 0, 1}) {
debugManager.flags.EnableBlitterForEnqueueOperations.set(flag);
for (auto srcAlloc : allocations) {
for (auto dstAlloc : allocations) {
for (bool imgToBuffer : {true, false}) {
bool expected = false;
if (flag != 0) {
bool preferred = productHelper.blitEnqueuePreferred(imgToBuffer);
if (!debugManager.flags.EnableBlitterForEnqueueOperations.getIfNotDefault(preferred)) {
expected = false;
} else {
if (srcAlloc == nullptr || dstAlloc == nullptr) {
expected = true;
} else {
expected = !(srcAlloc->isAllocatedInLocalMemoryPool() && dstAlloc->isAllocatedInLocalMemoryPool());
}
}
} else {
expected = false;
}
EXPECT_EQ(expected, immCmdList->isCopyOffloadAllowed(srcAlloc, dstAlloc, imgToBuffer));
}
}
}
}
}
HWCMDTEST_F(IGFX_XE_HP_CORE, CopyOffloadInOrderTests, givenCmdsChainingWhenDispatchingCopyOffloadThenDontSkipImplictDependency) {
using MI_SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
@@ -132,7 +88,6 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CopyOffloadInOrderTests, givenCmdsChainingWhenDispa
uint32_t copyData = 0;
immCmdList->appendMemoryCopy(&copyData, &copyData, 1, nullptr, 0, nullptr, copyParams);
findSemaphores(1); // implicit dependency
context->freeMem(alloc);