performance: small tweaks of patch preamble encoding

Related-To: NEO-16434

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2025-10-23 14:43:09 +00:00
committed by Compute-Runtime-Automation
parent 74d050f7be
commit 17b92df5fb
2 changed files with 19 additions and 13 deletions

View File

@@ -2026,8 +2026,9 @@ size_t CommandListCoreFamilyImmediate<gfxCoreFamily>::estimateAdditionalSizeAppe
totalNoopSpace += cmdList->getInOrderExecDeviceRequiredSize(); totalNoopSpace += cmdList->getInOrderExecDeviceRequiredSize();
totalNoopSpace += cmdList->getInOrderExecHostRequiredSize(); totalNoopSpace += cmdList->getInOrderExecHostRequiredSize();
} }
const size_t noopEncodeSize = NEO::EncodeDataMemory<GfxFamily>::getCommandSizeForEncode(totalNoopSpace); if (totalNoopSpace > 0) {
additionalSize += noopEncodeSize; additionalSize += NEO::EncodeDataMemory<GfxFamily>::getCommandSizeForEncode(totalNoopSpace);
}
} }
return additionalSize; return additionalSize;
} }

View File

@@ -921,12 +921,15 @@ template <GFXCORE_FAMILY gfxCoreFamily>
size_t CommandQueueHw<gfxCoreFamily>::estimateCommandListPatchPreambleFrontEndCmd(CommandListExecutionContext &ctx, CommandList *commandList) { size_t CommandQueueHw<gfxCoreFamily>::estimateCommandListPatchPreambleFrontEndCmd(CommandListExecutionContext &ctx, CommandList *commandList) {
size_t encodeSize = 0; size_t encodeSize = 0;
if (this->patchingPreamble) { if (this->patchingPreamble) {
uint32_t feCmdCount = commandList->getFrontEndPatchListCount();
if (feCmdCount > 0) {
const size_t feCmdSize = NEO::PreambleHelper<GfxFamily>::getVFECommandsSize(); const size_t feCmdSize = NEO::PreambleHelper<GfxFamily>::getVFECommandsSize();
size_t singleFeCmdEncodeSize = NEO::EncodeDataMemory<GfxFamily>::getCommandSizeForEncode(feCmdSize); size_t singleFeCmdEncodeSize = NEO::EncodeDataMemory<GfxFamily>::getCommandSizeForEncode(feCmdSize);
encodeSize = singleFeCmdEncodeSize * commandList->getFrontEndPatchListCount(); encodeSize = singleFeCmdEncodeSize * feCmdCount;
ctx.bufferSpaceForPatchPreamble += encodeSize; ctx.bufferSpaceForPatchPreamble += encodeSize;
} }
}
return encodeSize; return encodeSize;
} }
@@ -950,12 +953,16 @@ template <GFXCORE_FAMILY gfxCoreFamily>
inline size_t CommandQueueHw<gfxCoreFamily>::estimateTotalPatchPreambleData(CommandListExecutionContext &ctx) { inline size_t CommandQueueHw<gfxCoreFamily>::estimateTotalPatchPreambleData(CommandListExecutionContext &ctx) {
size_t encodeSize = 0; size_t encodeSize = 0;
if (this->patchingPreamble) { if (this->patchingPreamble) {
if (ctx.totalNoopSpaceForPatchPreamble > 0) {
encodeSize = NEO::EncodeDataMemory<GfxFamily>::getCommandSizeForEncode(ctx.totalNoopSpaceForPatchPreamble); encodeSize = NEO::EncodeDataMemory<GfxFamily>::getCommandSizeForEncode(ctx.totalNoopSpaceForPatchPreamble);
}
if (ctx.totalActiveScratchPatchElements > 0) {
const size_t qwordEncodeSize = NEO::EncodeDataMemory<GfxFamily>::getCommandSizeForEncode(sizeof(uint64_t)); const size_t qwordEncodeSize = NEO::EncodeDataMemory<GfxFamily>::getCommandSizeForEncode(sizeof(uint64_t));
size_t patchScratchElemsEncodeSize = qwordEncodeSize * ctx.totalActiveScratchPatchElements; size_t patchScratchElemsEncodeSize = qwordEncodeSize * ctx.totalActiveScratchPatchElements;
encodeSize += patchScratchElemsEncodeSize; encodeSize += patchScratchElemsEncodeSize;
}
ctx.bufferSpaceForPatchPreamble += encodeSize; ctx.bufferSpaceForPatchPreamble += encodeSize;
} }
return encodeSize; return encodeSize;
@@ -964,9 +971,7 @@ inline size_t CommandQueueHw<gfxCoreFamily>::estimateTotalPatchPreambleData(Comm
template <GFXCORE_FAMILY gfxCoreFamily> template <GFXCORE_FAMILY gfxCoreFamily>
inline void CommandQueueHw<gfxCoreFamily>::getCommandListPatchPreambleData(CommandListExecutionContext &ctx, CommandList *commandList) { inline void CommandQueueHw<gfxCoreFamily>::getCommandListPatchPreambleData(CommandListExecutionContext &ctx, CommandList *commandList) {
if (this->patchingPreamble) { if (this->patchingPreamble) {
const size_t totalNoopSize = commandList->getTotalNoopSpace(); ctx.totalNoopSpaceForPatchPreamble += commandList->getTotalNoopSpace();
ctx.totalNoopSpaceForPatchPreamble += totalNoopSize;
ctx.totalActiveScratchPatchElements += commandList->getActiveScratchPatchElements(); ctx.totalActiveScratchPatchElements += commandList->getActiveScratchPatchElements();
} }
} }