Skip to content

JIT: add JitEnablePhaseChecks, and disable it for the base SuperPMI asm diffs JIT - #132822

Merged
jakobbotsch merged 4 commits into
dotnet:mainfrom
jakobbotsch:jit-phase-checks-config
Sep 9, 2026
Merged

jakobbotsch merged 4 commits into
dotnet:mainfrom
jakobbotsch:jit-phase-checks-config

Conversation

@jakobbotsch

Copy link
Copy Markdown
Member

The baseline JIT is already validated, so re-running the phase IR checks on it during asm diffs is unnecessary. Add a JitEnablePhaseChecks config and turn it off for the base JIT. It stays on for the diff JIT, which is the one under test.

Add -full_ir_checks to asmdiffs to run them in the base JIT as well, and -no_ir_checks to replay, asmdiffs, tpdiff and metricdiff to turn them off everywhere. tpdiff and metricdiff only ever configure both JITs the same way, since they compare the base against the diff. The asm diffs CI pipeline passes -full_ir_checks.

The diff artifact runs are left alone: --diff_jit_dump compares the base and diff JitDumps textually and the checks are visible there, so both sides have to be configured identically.

asmdiffs over benchmarks.run_pgo (92,134 contexts, min of 3):

-full_ir_checks 12.23s
default 10.88s (-11.0%)
-no_ir_checks 9.57s (-21.8%)

…sm diffs JIT

The baseline JIT is already validated, so re-running the phase IR checks
on it during asm diffs is unnecessary. Add a JitEnablePhaseChecks config
and turn it off for the base JIT. It stays on for the diff JIT, which is
the one under test.

Add -full_ir_checks to asmdiffs to run them in the base JIT as well, and
-no_ir_checks to replay, asmdiffs, tpdiff and metricdiff to turn them off
everywhere. tpdiff and metricdiff only ever configure both JITs the same
way, since they compare the base against the diff. The asm diffs CI
pipeline passes -full_ir_checks.

The diff artifact runs are left alone: --diff_jit_dump compares the base
and diff JitDumps textually and the checks are visible there, so both
sides have to be configured identically.

asmdiffs over benchmarks.run_pgo (92,134 contexts, min of 3):

  -full_ir_checks   12.23s
  default           10.88s  (-11.0%)
  -no_ir_checks      9.57s  (-21.8%)

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 064035bf-fb1f-450e-afd2-08a7700aa736
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 27, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@jakobbotsch
jakobbotsch marked this pull request as ready for review August 28, 2026 11:07
Copilot AI lite review requested due to automatic review settings August 28, 2026 11:07
@jakobbotsch

Copy link
Copy Markdown
Member Author

PTAL @dotnet/jit-contrib

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new JIT config knob (JitEnablePhaseChecks) to allow disabling post-phase IR/graph validation checks in selected SuperPMI scenarios (notably the base JIT during asm diffs), while keeping checks enabled for the diff JIT under test. It also adds command-line switches to control this behavior from superpmi.py and wires the asm-diffs pipeline to run with full checks when desired.

Changes:

  • Add JitEnablePhaseChecks JIT config and gate post-phase checks on it.
  • Extend superpmi.py with -full_ir_checks / -no_ir_checks and pass JitEnablePhaseChecks=0 to the appropriate JIT(s).
  • Update superpmi_diffs.py to invoke asm diffs with -full_ir_checks.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/coreclr/scripts/superpmi.py Adds CLI switches and threads JitEnablePhaseChecks through SuperPMI replay/asmdiffs/tpdiff/metricdiff.
src/coreclr/scripts/superpmi_diffs.py Ensures asm-diffs runs use -full_ir_checks (pipeline behavior).
src/coreclr/jit/phase.cpp Gates post-phase validation checks behind JitEnablePhaseChecks.
src/coreclr/jit/jitconfigvalues.h Defines the new JitEnablePhaseChecks config value.

Comment thread src/coreclr/scripts/superpmi.py Resolved
Comment thread src/coreclr/scripts/superpmi.py Resolved
Comment thread src/coreclr/jit/jitconfigvalues.h Resolved
Verify no_ir_checks in the collect branch of setup_args. collect does a
replay internally when verifying the final MCH, but it does not call
verify_replay_common_args(), so reading the arg raised an AttributeError.

Apply -no_ir_checks to the diff artifact runs as well. It is documented as
turning the checks off everywhere, but it only reached the main asmdiffs
replay. It applies to both JITs, so it keeps the base and diff artifact runs
configured identically, which the textual JitDump comparison requires. The
asymmetric default still cannot be passed along there.

Set the option with -jitoption/-jit2option force so it overrides any value
recorded in the method context.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 42b3ef5b-567c-4da1-a6d1-1fe8e860a52b
Copilot AI review requested due to automatic review settings September 2, 2026 10:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

There are correctness/documentation mismatches in the new flag semantics (including conflicting-option precedence) and a repro-command mismatch that should be fixed before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (5)

Previously missed (2) — in code that hasn't changed since the last review.

src/coreclr/scripts/superpmi.py:5746

  • The warning for specifying both -full_ir_checks and -no_ir_checks currently ignores -no_ir_checks, but the option's help and comments describe -no_ir_checks as disabling checks everywhere. Either make the options mutually exclusive (error) or have -no_ir_checks take precedence (e.g., ignore -full_ir_checks).
    src/coreclr/scripts/superpmi.py:351
  • The new JitEnablePhaseChecks knob gates all post-phase checks (flow graph, loops, uniqueness, profile, IR, etc.), not just IR checks. The -no_ir_checks help text is misleading; it should describe disabling post-phase checks rather than only "phase IR checks".

This issue also appears in the following locations of the same file:

  • line 380
  • line 2216

src/coreclr/scripts/superpmi.py:380

  • Similar to -no_ir_checks, -full_ir_checks controls JitEnablePhaseChecks, which gates all post-phase checks, not only IR checks. The help text should avoid calling these "phase IR checks" to prevent confusion about what is being disabled/enabled.
asm_diff_parser.add_argument("-full_ir_checks", action="store_true", help="Run the phase IR checks in the base JIT as well. By default they are only run in the diff JIT, since the base JIT is already validated.")

src/coreclr/jit/jitconfigvalues.h:199

  • The JitEnablePhaseChecks config gates all post-phase checks (not only IR checks). The comment should reflect that broader scope so it's clear what behavior this config controls.
CONFIG_INTEGER(JitEnablePhaseChecks, "JitEnablePhaseChecks", 1) // Run the phase IR checks

src/coreclr/scripts/superpmi.py:2220

  • This comment block repeatedly refers to "phase IR checks", but the new JitEnablePhaseChecks toggle actually gates all post-phase checks, not only IR. Updating the wording here will help prevent misunderstandings about what the new flags/config control.
        # The base JIT is already validated, so the phase IR checks are turned off for it by
        # default and left on for the diff JIT, which is the one under test. -full_ir_checks
        # turns them back on for the base JIT, and -no_ir_checks turns them off everywhere.
        #
        # The diff artifact runs compare the base and diff JitDumps textually, so the checks
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/coreclr/scripts/superpmi.py Resolved
…d line

The option was appended to common_flags after repro_flags had been merged in,
so the repro command line saved for failures did not reflect the actual
invocation. It changes what the JIT does, so put it in repro_flags instead.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 42b3ef5b-567c-4da1-a6d1-1fe8e860a52b
Copilot AI review requested due to automatic review settings September 7, 2026 14:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Some newly added help text/comments mischaracterize the scope of what’s disabled (not only IR checks) and one warning uses print() instead of logging, reducing clarity/diagnostic consistency.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (4)

Previously missed (1) — in code that hasn't changed since the last review.

src/coreclr/scripts/superpmi.py:5748

  • This warning currently uses print(), which bypasses the script's logging configuration (log file, timestamps, etc.). Using logging.warning keeps output consistent with other warnings in this script.

src/coreclr/scripts/superpmi.py:380

  • -full_ir_checks is described as enabling "phase IR checks" in the base JIT, but JitEnablePhaseChecks actually gates all post-phase checks controlled by activePhaseChecks (not only IR). Updating the option help text to match the actual behavior will make this flag clearer.
asm_diff_parser.add_argument("-full_ir_checks", action="store_true", help="Run the phase IR checks in the base JIT as well. By default they are only run in the diff JIT, since the base JIT is already validated.")

src/coreclr/scripts/superpmi.py:2222

  • This comment block uses the term "phase IR checks", but the new JitEnablePhaseChecks gating affects all post-phase checks driven by activePhaseChecks. Consider updating the terminology here to avoid implying only IR validation is affected.
        # The base JIT is already validated, so the phase IR checks are turned off for it by
        # default and left on for the diff JIT, which is the one under test. -full_ir_checks
        # turns them back on for the base JIT, and -no_ir_checks turns them off everywhere.
        #
        # The diff artifact runs compare the base and diff JitDumps textually, so the checks

src/coreclr/jit/jitconfigvalues.h:199

  • The comment for JitEnablePhaseChecks says "phase IR checks", but the gating in Phase::PostPhase controls all post-phase checks (flowgraph/EH/loops/profile/etc.). Consider tweaking the comment to reflect the broader scope.
CONFIG_INTEGER(JitEnablePhaseChecks, "JitEnablePhaseChecks", 1) // Run the phase IR checks
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/coreclr/scripts/superpmi.py Resolved
@jakobbotsch

Copy link
Copy Markdown
Member Author

PTAL @dotnet/jit-contrib

@jakobbotsch
jakobbotsch merged commit eb0f29e into dotnet:main Sep 9, 2026
135 of 136 checks passed
@jakobbotsch
jakobbotsch deleted the jit-phase-checks-config branch September 9, 2026 17:28
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 10, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants