refactor: move blit post sync data to BlitProperties

Related-To: NEO-13003

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2025-01-22 14:38:36 +00:00
committed by Compute-Runtime-Automation
parent 9cfc6e6bbe
commit c2dbdb6797
30 changed files with 209 additions and 185 deletions

View File

@@ -144,7 +144,7 @@ size_t BlitCommandsHelper<GfxFamily>::estimateBlitCommandsSize(const BlitPropert
size_t size = 0;
EncodeDummyBlitWaArgs waArgs{false, const_cast<RootDeviceEnvironment *>(&rootDeviceEnvironment)};
for (auto &blitProperties : blitPropertiesContainer) {
auto updateTimestampPacket = blitProperties.outputTimestampPacket != nullptr;
auto updateTimestampPacket = blitProperties.blitSyncProperties.outputTimestampPacket != nullptr;
auto isImage = blitProperties.isImageOperation();
size += BlitCommandsHelper<GfxFamily>::estimateBlitCommandSize(blitProperties.copySize, blitProperties.csrDependencies, updateTimestampPacket,
profilingEnabled, isImage, rootDeviceEnvironment, blitProperties.isSystemMemoryPoolUsed, relaxedOrderingEnabled);

View File

@@ -65,7 +65,7 @@ BlitOperationResult BlitHelper::blitMemoryToAllocationBanks(const Device &device
(memory->getGpuAddress() + offset),
0, 0, 0, size, 0, 0, 0, 0));
const auto newTaskCount = bcsEngine->commandStreamReceiver->flushBcsTask(blitPropertiesContainer, true, false, *pDeviceForBlit);
const auto newTaskCount = bcsEngine->commandStreamReceiver->flushBcsTask(blitPropertiesContainer, true, *pDeviceForBlit);
if (newTaskCount == CompletionStamp::gpuHang) {
return BlitOperationResult::gpuHang;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -42,51 +42,48 @@ BlitProperties BlitProperties::constructPropertiesForReadWrite(BlitterConstants:
if (BlitterConstants::BlitDirection::hostPtrToBuffer == blitDirection ||
BlitterConstants::BlitDirection::hostPtrToImage == blitDirection) {
return {
nullptr, // outputTimestampPacket
nullptr, // multiRootDeviceEventSync
blitDirection, // blitDirection
{}, // csrDependencies
AuxTranslationDirection::none, // auxTranslationDirection
memObjAllocation, // dstAllocation
hostAllocation, // srcAllocation
clearColorAllocation, // clearColorAllocation
memObjGpuVa, // dstGpuAddress
hostAllocGpuVa, // srcGpuAddress
copySize, // copySize
copyOffset, // dstOffset
hostPtrOffset, // srcOffset
true,
gpuRowPitch, // dstRowPitch
gpuSlicePitch, // dstSlicePitch
hostRowPitch, // srcRowPitch
hostSlicePitch, // srcSlicePitch
copySize, // dstSize
copySize // srcSize
};
.blitSyncProperties = {},
.csrDependencies = {},
.multiRootDeviceEventSync = nullptr,
.blitDirection = blitDirection,
.auxTranslationDirection = AuxTranslationDirection::none,
.dstAllocation = memObjAllocation,
.srcAllocation = hostAllocation,
.clearColorAllocation = clearColorAllocation,
.dstGpuAddress = memObjGpuVa,
.srcGpuAddress = hostAllocGpuVa,
.copySize = copySize,
.dstOffset = copyOffset,
.srcOffset = hostPtrOffset,
.dstRowPitch = gpuRowPitch,
.dstSlicePitch = gpuSlicePitch,
.srcRowPitch = hostRowPitch,
.srcSlicePitch = hostSlicePitch,
.dstSize = copySize,
.srcSize = copySize,
.isSystemMemoryPoolUsed = true};
} else {
return {
nullptr, // outputTimestampPacket
nullptr, // multiRootDeviceEventSync
blitDirection, // blitDirection
{}, // csrDependencies
AuxTranslationDirection::none, // auxTranslationDirection
hostAllocation, // dstAllocation
memObjAllocation, // srcAllocation
clearColorAllocation, // clearColorAllocation
hostAllocGpuVa, // dstGpuAddress
memObjGpuVa, // srcGpuAddress
copySize, // copySize
hostPtrOffset, // dstOffset
copyOffset, // srcOffset
true,
hostRowPitch, // dstRowPitch
hostSlicePitch, // dstSlicePitch
gpuRowPitch, // srcRowPitch
gpuSlicePitch, // srcSlicePitch
copySize, // dstSize
copySize // srcSize
};
.blitSyncProperties = {},
.csrDependencies = {},
.multiRootDeviceEventSync = nullptr,
.blitDirection = blitDirection,
.auxTranslationDirection = AuxTranslationDirection::none,
.dstAllocation = hostAllocation,
.srcAllocation = memObjAllocation,
.clearColorAllocation = clearColorAllocation,
.dstGpuAddress = hostAllocGpuVa,
.srcGpuAddress = memObjGpuVa,
.copySize = copySize,
.dstOffset = hostPtrOffset,
.srcOffset = copyOffset,
.dstRowPitch = hostRowPitch,
.dstSlicePitch = hostSlicePitch,
.srcRowPitch = gpuRowPitch,
.srcSlicePitch = gpuSlicePitch,
.dstSize = copySize,
.srcSize = copySize,
.isSystemMemoryPoolUsed = true};
};
}
@@ -98,24 +95,24 @@ BlitProperties BlitProperties::constructPropertiesForCopy(GraphicsAllocation *ds
copySize.z = copySize.z ? copySize.z : 1;
return {
nullptr, // outputTimestampPacket
nullptr, // multiRootDeviceEventSync
BlitterConstants::BlitDirection::bufferToBuffer, // blitDirection
{}, // csrDependencies
AuxTranslationDirection::none, // auxTranslationDirection
dstAllocation, // dstAllocation
srcAllocation, // srcAllocation
clearColorAllocation, // clearColorAllocation
dstAllocation->getGpuAddress(), // dstGpuAddress
srcAllocation->getGpuAddress(), // srcGpuAddress
copySize, // copySize
dstOffset, // dstOffset
srcOffset, // srcOffset
MemoryPoolHelper::isSystemMemoryPool(dstAllocation->getMemoryPool(), srcAllocation->getMemoryPool()),
dstRowPitch, // dstRowPitch
dstSlicePitch, // dstSlicePitch
srcRowPitch, // srcRowPitch
srcSlicePitch}; // srcSlicePitch
.blitSyncProperties = {},
.csrDependencies = {},
.multiRootDeviceEventSync = nullptr,
.blitDirection = BlitterConstants::BlitDirection::bufferToBuffer,
.auxTranslationDirection = AuxTranslationDirection::none,
.dstAllocation = dstAllocation,
.srcAllocation = srcAllocation,
.clearColorAllocation = clearColorAllocation,
.dstGpuAddress = dstAllocation->getGpuAddress(),
.srcGpuAddress = srcAllocation->getGpuAddress(),
.copySize = copySize,
.dstOffset = dstOffset,
.srcOffset = srcOffset,
.dstRowPitch = dstRowPitch,
.dstSlicePitch = dstSlicePitch,
.srcRowPitch = srcRowPitch,
.srcSlicePitch = srcSlicePitch,
.isSystemMemoryPoolUsed = MemoryPoolHelper::isSystemMemoryPool(dstAllocation->getMemoryPool(), srcAllocation->getMemoryPool())};
}
BlitProperties BlitProperties::constructPropertiesForAuxTranslation(AuxTranslationDirection auxTranslationDirection,
@@ -123,20 +120,18 @@ BlitProperties BlitProperties::constructPropertiesForAuxTranslation(AuxTranslati
auto allocationSize = allocation->getUnderlyingBufferSize();
return {
nullptr, // outputTimestampPacket
nullptr, // multiRootDeviceEventSync
BlitterConstants::BlitDirection::bufferToBuffer, // blitDirection
{}, // csrDependencies
auxTranslationDirection, // auxTranslationDirection
allocation, // dstAllocation
allocation, // srcAllocation
clearColorAllocation, // clearColorAllocation
allocation->getGpuAddress(), // dstGpuAddress
allocation->getGpuAddress(), // srcGpuAddress
{allocationSize, 1, 1}, // copySize
0, // dstOffset
0, // srcOffset
MemoryPoolHelper::isSystemMemoryPool(allocation->getMemoryPool())};
.blitSyncProperties = {},
.csrDependencies = {},
.multiRootDeviceEventSync = nullptr,
.blitDirection = BlitterConstants::BlitDirection::bufferToBuffer,
.auxTranslationDirection = auxTranslationDirection,
.dstAllocation = allocation,
.srcAllocation = allocation,
.clearColorAllocation = clearColorAllocation,
.dstGpuAddress = allocation->getGpuAddress(),
.srcGpuAddress = allocation->getGpuAddress(),
.copySize = {allocationSize, 1, 1},
.isSystemMemoryPoolUsed = MemoryPoolHelper::isSystemMemoryPool(allocation->getMemoryPool())};
}
void BlitProperties::setupDependenciesForAuxTranslation(BlitPropertiesContainer &blitPropertiesContainer, TimestampPacketDependencies &timestampPacketDependencies,
@@ -145,8 +140,11 @@ void BlitProperties::setupDependenciesForAuxTranslation(BlitPropertiesContainer
auto numObjects = blitPropertiesContainer.size() / 2;
for (size_t i = 0; i < numObjects; i++) {
blitPropertiesContainer[i].outputTimestampPacket = timestampPacketDependencies.auxToNonAuxNodes.peekNodes()[i];
blitPropertiesContainer[i + numObjects].outputTimestampPacket = timestampPacketDependencies.nonAuxToAuxNodes.peekNodes()[i];
blitPropertiesContainer[i].blitSyncProperties.outputTimestampPacket = timestampPacketDependencies.auxToNonAuxNodes.peekNodes()[i];
blitPropertiesContainer[i].blitSyncProperties.syncMode = BlitSyncMode::immediate;
blitPropertiesContainer[i + numObjects].blitSyncProperties.outputTimestampPacket = timestampPacketDependencies.nonAuxToAuxNodes.peekNodes()[i];
blitPropertiesContainer[i + numObjects].blitSyncProperties.syncMode = BlitSyncMode::immediate;
}
auto nodesAllocator = gpguCsr.getTimestampPacketAllocator();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 Intel Corporation
* Copyright (C) 2023-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -22,6 +22,26 @@ class TimestampPacketContainer;
class GraphicsAllocation;
class CommandStreamReceiver;
enum class BlitSyncMode {
none = 0,
timestamp,
immediate,
timestampAndImmediate
};
struct BlitSyncProperties {
TagNodeBase *outputTimestampPacket = nullptr;
BlitSyncMode syncMode = BlitSyncMode::none;
uint64_t deviceGpuWriteAddress = 0;
uint64_t hostGpuWriteAddress = 0;
uint64_t timestampGpuWriteAddress = 0;
uint64_t writeValue = 0;
bool isTimestampMode() const {
return (syncMode == BlitSyncMode::timestamp) || (syncMode == BlitSyncMode::timestampAndImmediate);
}
};
struct BlitProperties {
static BlitProperties constructPropertiesForReadWrite(BlitterConstants::BlitDirection blitDirection,
CommandStreamReceiver &commandStreamReceiver,
@@ -45,10 +65,11 @@ struct BlitProperties {
TimestampPacketContainer &kernelTimestamps, const CsrDependencies &depsFromEvents,
CommandStreamReceiver &gpguCsr, CommandStreamReceiver &bcsCsr);
TagNodeBase *outputTimestampPacket = nullptr;
TagNodeBase *multiRootDeviceEventSync = nullptr;
BlitterConstants::BlitDirection blitDirection = BlitterConstants::BlitDirection::bufferToHostPtr;
BlitSyncProperties blitSyncProperties = {};
CsrDependencies csrDependencies;
TagNodeBase *multiRootDeviceEventSync = nullptr;
BlitterConstants::BlitDirection blitDirection = BlitterConstants::BlitDirection::bufferToHostPtr;
AuxTranslationDirection auxTranslationDirection = AuxTranslationDirection::none;
GraphicsAllocation *dstAllocation = nullptr;
@@ -60,7 +81,6 @@ struct BlitProperties {
Vec3<size_t> copySize = 0;
Vec3<size_t> dstOffset = 0;
Vec3<size_t> srcOffset = 0;
bool isSystemMemoryPoolUsed = false;
size_t dstRowPitch = 0;
size_t dstSlicePitch = 0;
@@ -71,6 +91,7 @@ struct BlitProperties {
size_t bytesPerPixel = 1;
GMM_YUV_PLANE_ENUM dstPlane = GMM_YUV_PLANE_ENUM::GMM_NO_PLANE;
GMM_YUV_PLANE_ENUM srcPlane = GMM_YUV_PLANE_ENUM::GMM_NO_PLANE;
bool isSystemMemoryPoolUsed = false;
bool isImageOperation() const;
};