Run SimplifyCFG before the bare AlwaysInlinerPass runs #4050
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 238 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.328
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4050"
general
weight: 0.35
vchuravy
The three places in
compiler.jlthat ranremove_alwaysinline_roots!(mod); run!(AlwaysInlinerPass(), mod)directly (lower_convention, the BLAS bitcode replacement, and the post-AD wrapper inlining) now callinline_alwaysinline!(mod). This runs one pass pipeline: SimplifyCFG on every function, thenRemoveAlwaysInlineRootsPass, thenAlwaysInlinerPass. The two pipelines inoptimize.jlalready have this shape.LLVM 18's
AlwaysInlinerPasscomputesBlockFrequencyInfofor each callee, andBranchProbabilityInfois superlinear in the number of blocks inside a loop. Unoptimized KernelAbstractions kernel bodies can be very large: in an Oceananigans hydrostatic model with GM/Redi (IsopycnalSkewSymmetricDiffusivity), the tracer tendency kernelcompute_hydrostatic_free_surface_Gc!has ~285k blocks, and the inliner spent ~340 s on each of the T and S kernels inlower_convention. After SimplifyCFG the same function has 13 blocks and inlining takes well under a second.Measured on a 4° global ocean (90×40×20, implicit-free-surface variant of MITgcm's
tutorial_tracer_adjsens), first reverse-modeautodiffof 2 time steps including compilation, Julia 1.12.7, same environment except for this PR:| | reverse pass (incl. compile) |
|---|---|
| main (01265672) | 1353 s |
| first version of this PR | 1006 s |
These numbers are from the first version of this PR, which ran SimplifyCFG only on
alwaysinlinefunctions with more than 1000 blocks, one function at a time. The current version runs it on all functions at those three sites. It has not been re-timed. The gradients were bit-identical between the two runs and agree with central finite differences to 1e-10 to 1e-7.Tests: after rebasing onto main 9cc1c3a1,
basic,callconv,blas,passes,optimizeandrooted_argspass on Julia 1.12 and 1.13.🤖 Generated with Claude Code