Skip to content

Invalidate PGO after Wasm SCC transform - #133122

Closed
lewing wants to merge 1 commit into
mainfrom
lewing-pr-failure-scan
Closed

Invalidate PGO after Wasm SCC transform#133122
lewing wants to merge 1 commit into
mainfrom
lewing-pr-failure-scan

Conversation

@lewing

@lewing lewing commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

The Wasm SCC transform rewrites multi-entry SCCs to route entry flow through a dispatcher. When profile data has already been incorporated, that rewrite can leave block weights structurally inconsistent with the new CFG and trigger checked JIT profile verification asserts.

This conservatively marks PGO data inconsistent after the SCC transform, matching the existing approach used by fgWasmRepairTryEntries when it reroutes weighted flow.

Fixes #133120.

Validation

  • ./build.sh clr+libs+host
  • python3 src/coreclr/scripts/jitformat.py -r . -o osx -a arm64
  • ./build.sh clr

Note

This PR description was generated by GitHub Copilot.

The Wasm SCC transform reroutes SCC entry flow through a dispatcher, which can leave incorporated PGO block weights structurally inconsistent with the rewritten CFG. Mark the profile data inconsistent after the transform so checked profile validation does not assert on stale weights.

Fixes #133120

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: db8401cb-c388-4481-a625-34811ab8a269
Copilot AI lite review requested due to automatic review settings September 2, 2026 19:25
@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 Sep 2, 2026
@lewing lewing added the arch-wasm WebAssembly architecture label Sep 2, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 6 pipeline(s).
10 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 'arch-wasm': @lewing, @pavelsavara
See info in area-owners.md if you want to be subscribed.

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.

🟢 Approval recommended

The change is small, matches an established pattern in the same file for CFG-rewriting passes, and the only feedback is a minor comment-wording nit.

Pull request overview

This PR updates the Wasm SCC transform phase to conservatively invalidate PGO “consistency” after CFG rewriting, preventing post-phase profile-weight verification asserts when multi-entry SCCs are rewritten through a dispatcher.

Changes:

  • Mark fgPgoConsistent = false after WasmTransformSccs runs (when irreducible loops are transformed).
  • Add a JITDUMP note explaining why profile data is considered inconsistent after SCC entry flow is rerouted.
File summaries
File Description
src/coreclr/jit/fgwasm.cpp Invalidates PGO consistency after SCC transform rewires entry flow through a dispatcher to avoid checked profile verification asserts.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment on lines +1563 to +1564
// Weight moved from the SCC entry blocks through the dispatcher, so any
// profile data we had is no longer self-consistent.
@AndyAyersMS

Copy link
Copy Markdown
Member

I'd prefer to try and fix the profile, let me see if that looks tractable. If not, we can take this.

@AndyAyersMS

Copy link
Copy Markdown
Member

#133132 fixes the weights -- if you can validate it, I'd prefer that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm WebAssembly architecture 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.

Wasm R2R crossgen2 asserts with inconsistent profile data during SCC transform

3 participants