@@ -239,6 +239,16 @@ inline void AddAnalysisPasses(CodeGenContext &ctx, IGCPassManager& mpm)
239239 // to avoid URBRead/URBWrite interference
240240 AddURBWriteRelatedPass (ctx, mpm);
241241
242+ // moving the scheduling and sample clustering passes right before code-sinking.
243+ // Need to merge the scheduling, code-sinking and clustering passes better to avoid redundancy and better optimization
244+ if (IGC_IS_FLAG_DISABLED (DisablePreRAScheduler) &&
245+ ctx.type == ShaderType::PIXEL_SHADER &&
246+ ctx.m_retryManager .AllowPreRAScheduler () &&
247+ !ctx.m_enableSubroutine )
248+ {
249+ mpm.add (createPreRASchedulerPass ());
250+ }
251+
242252 if (IGC_IS_FLAG_DISABLED (DisableMemOpt2) &&
243253 (ctx.type == ShaderType::COMPUTE_SHADER || (ctx.m_DriverInfo .WAEnableMemOpt2ForOCL ())) &&
244254 !isOptDisabled)
@@ -265,7 +275,6 @@ inline void AddAnalysisPasses(CodeGenContext &ctx, IGCPassManager& mpm)
265275 // need this before WIAnalysis:
266276 // insert phi to prevent changing of WIAnalysis result by later code-motion
267277 mpm.add (llvm::createLCSSAPass ());
268-
269278 if ( !isOptDisabled )
270279 {
271280 // If you want to clean up the dead-code after push optimization
@@ -568,17 +577,7 @@ inline void AddLegalizationPasses(CodeGenContext &ctx, IGCPassManager& mpm)
568577 // Scalarizer in codegen to handle the vector instructions
569578 mpm.add (new ScalarizerCodeGen ());
570579
571- // moving the scheduling and sample clustering passes right before code-sinking.
572- // Need to merge the scheduling, code-sinking and clustering passes better to avoid redundancy and better optimization
573- if (IGC_IS_FLAG_DISABLED (DisablePreRAScheduler) &&
574- ctx.type == ShaderType::PIXEL_SHADER &&
575- ctx.m_retryManager .AllowPreRAScheduler () &&
576- !ctx.m_enableSubroutine )
577- {
578- mpm.add (createPreRASchedulerPass ());
579- }
580-
581- // coalesce scalar loads into loads of larger quantity
580+ // coalesce scalar loads into loads of larger quantity.
582581 // This require and preserves uniform analysis we should keep
583582 // other passes using uniformness together to avoid re-running it several times
584583 if (IGC_IS_FLAG_DISABLED (DisableConstantCoalescing))
0 commit comments