@@ -182,8 +182,10 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandListsRegular(
182182 auto &finalStreamState = commandList->getFinalStreamState ();
183183
184184 this ->updateOneCmdListPreemptionModeAndCtxStatePreemption (ctx, commandList->getCommandListPreemptionMode (), child);
185+
185186 this ->programOneCmdListPipelineSelect (commandList, child, csrStateProperties, requiredStreamState, finalStreamState);
186187 this ->programOneCmdListFrontEndIfDirty (ctx, child, csrStateProperties, requiredStreamState, finalStreamState);
188+ this ->programRequiredStateComputeModeForCommandList (commandList, child, csrStateProperties, requiredStreamState, finalStreamState);
187189
188190 this ->patchCommands (*commandList, this ->csr ->getScratchSpaceController ()->getScratchPatchAddress ());
189191 this ->programOneCmdListBatchBufferStart (commandList, child, ctx);
@@ -655,7 +657,7 @@ size_t CommandQueueHw<gfxCoreFamily>::estimateLinearStreamSizeComplementary(
655657 linearStreamSizeEstimate += estimateFrontEndCmdSize (ctx.frontEndStateDirty );
656658 linearStreamSizeEstimate += estimatePipelineSelectCmdSize ();
657659
658- if (this ->pipelineSelectStateTracking || frontEndTrackingEnabled ()) {
660+ if (this ->stateComputeModeTracking || this -> pipelineSelectStateTracking || frontEndTrackingEnabled ()) {
659661 bool frontEndStateDirtyCopy = ctx.frontEndStateDirty ;
660662 auto streamPropertiesCopy = csr->getStreamProperties ();
661663 bool gpgpuEnabledCopy = csr->getPreambleSetFlag ();
@@ -667,6 +669,7 @@ size_t CommandQueueHw<gfxCoreFamily>::estimateLinearStreamSizeComplementary(
667669 linearStreamSizeEstimate += estimateFrontEndCmdSizeForMultipleCommandLists (frontEndStateDirtyCopy, ctx.engineInstanced , cmdList,
668670 streamPropertiesCopy, requiredStreamState, finalStreamState);
669671 linearStreamSizeEstimate += estimatePipelineSelectCmdSizeForMultipleCommandLists (streamPropertiesCopy, requiredStreamState, finalStreamState, gpgpuEnabledCopy);
672+ linearStreamSizeEstimate += estimateScmCmdSizeForMultipleCommandLists (streamPropertiesCopy, requiredStreamState, finalStreamState);
670673 }
671674 }
672675
@@ -1174,6 +1177,54 @@ void CommandQueueHw<gfxCoreFamily>::programOneCmdListPipelineSelect(CommandList
11741177 csrState.pipelineSelect .setProperties (cmdListFinal.pipelineSelect );
11751178}
11761179
1180+ template <GFXCORE_FAMILY gfxCoreFamily>
1181+ size_t CommandQueueHw<gfxCoreFamily>::estimateScmCmdSizeForMultipleCommandLists(NEO::StreamProperties &csrStateCopy,
1182+ const NEO::StreamProperties &cmdListRequired,
1183+ const NEO::StreamProperties &cmdListFinal) {
1184+ if (!this ->stateComputeModeTracking ) {
1185+ return 0 ;
1186+ }
1187+
1188+ size_t estimatedSize = 0 ;
1189+
1190+ bool isRcs = this ->getCsr ()->isRcs ();
1191+ size_t singleScmCmdSize = NEO::EncodeComputeMode<GfxFamily>::getCmdSizeForComputeMode (device->getHwInfo (), false , isRcs);
1192+
1193+ csrStateCopy.stateComputeMode .setProperties (cmdListRequired.stateComputeMode );
1194+ if (csrStateCopy.stateComputeMode .isDirty ()) {
1195+ estimatedSize += singleScmCmdSize;
1196+ }
1197+ csrStateCopy.stateComputeMode .setProperties (cmdListFinal.stateComputeMode );
1198+
1199+ return estimatedSize;
1200+ }
1201+
1202+ template <GFXCORE_FAMILY gfxCoreFamily>
1203+ void CommandQueueHw<gfxCoreFamily>::programRequiredStateComputeModeForCommandList(CommandList *commandList,
1204+ NEO::LinearStream &commandStream,
1205+ NEO::StreamProperties &csrState,
1206+ const NEO::StreamProperties &cmdListRequired,
1207+ const NEO::StreamProperties &cmdListFinal) {
1208+ if (!this ->stateComputeModeTracking ) {
1209+ return ;
1210+ }
1211+
1212+ csrState.stateComputeMode .setProperties (cmdListRequired.stateComputeMode );
1213+
1214+ if (csrState.stateComputeMode .isDirty ()) {
1215+ NEO::PipelineSelectArgs pipelineSelectArgs = {
1216+ !!csrState.pipelineSelect .systolicMode .value ,
1217+ false ,
1218+ false ,
1219+ commandList->getSystolicModeSupport ()};
1220+
1221+ bool isRcs = this ->getCsr ()->isRcs ();
1222+ NEO::EncodeComputeMode<GfxFamily>::programComputeModeCommandWithSynchronization (commandStream, csrState.stateComputeMode , pipelineSelectArgs,
1223+ false , device->getHwInfo (), isRcs, nullptr );
1224+ }
1225+ csrState.stateComputeMode .setProperties (cmdListFinal.stateComputeMode );
1226+ }
1227+
11771228template <GFXCORE_FAMILY gfxCoreFamily>
11781229bool CommandQueueHw<gfxCoreFamily>::isCleanLeftoverMemoryRequired() {
11791230 return false ;
0 commit comments