Skip to content

[lint] Add TRITON_ENABLE_EXTRA_ANALYSIS_PASSES knob with outer-loop pipelining check#1260

Open
sfzhu93 wants to merge 2 commits intofacebookexperimental:mainfrom
sfzhu93:export-D100448245
Open

[lint] Add TRITON_ENABLE_EXTRA_ANALYSIS_PASSES knob with outer-loop pipelining check#1260
sfzhu93 wants to merge 2 commits intofacebookexperimental:mainfrom
sfzhu93:export-D100448245

Conversation

@sfzhu93
Copy link
Copy Markdown
Contributor

@sfzhu93 sfzhu93 commented Apr 15, 2026

Summary

Add a new opt-in knob TRITON_ENABLE_EXTRA_ANALYSIS_PASSES that gates extra static analysis passes in the compiler pipeline. This establishes the infrastructure for compiler-induced lint — a series of read-only analysis passes that emit MLIR remarks to help diagnose compiler behavior.

What this PR does

  • Adds TRITON_ENABLE_EXTRA_ANALYSIS_PASSES env var and knobs.nvidia.enable_extra_analysis_passes knob
  • Adds a PipeliningAnalysis pass that runs after loop fusion but before the pipeliner
  • As a first example, diagnoses outer loops that request pipelining (num_stages > 1) but will be skipped because they contain nested loops
  • Includes lit tests and an end-to-end Python test

Why a separate knob?

These analysis passes are opt-in diagnostic tools, not part of the default compilation pipeline. They emit MLIR remarks (visible when MLIR_ENABLE_DIAGNOSTICS=remarks is set) to help users and compiler developers understand why certain optimizations were not applied.

Follow-up work

More analysis checks will be added under the same knob in follow-up PRs. For example, a complete and sound diagnosis on the loop pipelining, barrier analysis and more static analyses.

Mostly authored with Claude.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 15, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Apr 15, 2026

@sfzhu93 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100448245.

Summary:
Add a read-only MLIR analysis pass that runs after the software pipeliner
and emits remarks explaining why scf.ForOp loops were not pipelined.

Checks the 3 most common failure reasons:
- num_stages <= 1 (pipelining not requested)
- loop distance > 1 (not supported)
- outer loop with nested loops (not supported)
- no latency assigned to any op in loop

Gated by TRITON_ENABLE_PIPELINING_ANALYSIS env var (off by default).
Placed in CACHE_NEUTRAL since it is read-only and does not modify IR.

Differential Revision: D100448245
@sfzhu93 sfzhu93 force-pushed the export-D100448245 branch 2 times, most recently from cf708c7 to 91ba0cf Compare April 28, 2026 02:56
@sfzhu93 sfzhu93 changed the title [triton] Add PipeliningAnalysis pass for diagnosing unpipelined loops Add TRITON_ENABLE_EXTRA_ANALYSIS_PASSES knob with outer-loop pipelining check Apr 28, 2026
@sfzhu93 sfzhu93 changed the title Add TRITON_ENABLE_EXTRA_ANALYSIS_PASSES knob with outer-loop pipelining check [lint] Add TRITON_ENABLE_EXTRA_ANALYSIS_PASSES knob with outer-loop pipelining check Apr 28, 2026
@sfzhu93 sfzhu93 requested review from kvbp2k and njriasan April 28, 2026 03:03
…ng check

Add a new opt-in knob TRITON_ENABLE_EXTRA_ANALYSIS_PASSES that gates
extra static analysis passes in the compiler pipeline. This establishes
the infrastructure for compiler-induced lint — a series of read-only
analysis passes that emit MLIR remarks to help diagnose compiler behavior.

As a first check, the PipeliningAnalysis pass diagnoses outer loops
(containing nested loops) that request pipelining but will be skipped.
The pass runs after loop fusion and before the pipeliner, so it sees
the IR after nested loops have had a chance to be flattened.

More analysis checks will be added in follow-up PRs.

Authored with Claude.
@sfzhu93 sfzhu93 force-pushed the export-D100448245 branch from 91ba0cf to 9636e44 Compare April 28, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant