JIT: elide redundant wasm Virtual IP updates - #131688
Open
AndyAyersMS wants to merge 1 commit into
Open
Conversation
fgWasmVirtualIP stored the frame's Virtual IP at the start of every non-empty block. Most stores are redundant: consecutive blocks in the same EH region require the same value. Record the value each block requires during the region walk, then solve a forward available-Virtual-IP dataflow and emit a store only where the value is not already on the frame on every path in (cross-func EH returns and function entries force a store). Reduces the wasm R2R code section of System.Private.CoreLib by ~1.76 MB (~9.7%). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 89caa9c8-5b0f-4fcc-a8c4-726ac8535110
|
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. |
Member
Author
|
@adamperlin PTAL Local testing including some contrived EH looks good. But I will probably hold off merging this until the CI testing is enabled. |
Contributor
|
Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines the WASM JIT “Virtual IP” update logic to avoid emitting redundant frame stores by computing, per basic block, which Virtual IP value is required and then running a forward dataflow analysis to determine whether that value is already available on all incoming paths.
Changes:
- Records per-block required Virtual IP (and whether a store is required) while walking regions/blocks.
- Runs a forward “available Virtual IP” dataflow merge to compute
availableIn/availableOutand elide stores when the needed value is already on-frame on all incoming paths. - Emits Virtual IP frame updates only at blocks where
availableIn != requiredVip, and invalidates the DFS tree afterDataFlow::ForwardAnalysisso later WASM phases recompute their own traversal data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fgWasmVirtualIP stored the frame's Virtual IP at the start of every non-empty block. Most stores are redundant: consecutive blocks in the same EH region require the same value. Record the value each block requires during the region walk, then solve a forward available-Virtual-IP dataflow and emit a store only where the value is not already on the frame on every path in (cross-func EH returns and function entries force a store). Reduces the wasm R2R code section of System.Private.CoreLib by ~1.76 MB (~9.7%).