Fix edge likelihoods out of optimize bools#131356
Open
dhartglassMSFT wants to merge 3 commits into
Open
Conversation
|
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. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes edge-likelihood propagation when optOptimizeCompareChainCondBlock merges two consecutive conditional blocks into a single compare-chain condition, ensuring the resulting block’s outgoing edge likelihoods preserve the original control-flow probabilities (including the “shared target” case).
Changes:
- Capture the pre-merge likelihoods for
b1’s removed and fallthrough edges and use them to recomputeb2’s outgoing edge likelihoods as unconditional probabilities after compaction. - Adjust
b2’s profile weight prior tofgCompactBlockso the merged block inherits the correct weight without incorrectly decrementing the shared-target’s weight. - Remove the prior call to
fgRepairProfileCondToUncond(which is tailored for true removal of alternate flow) in favor of this targeted repair for the compare-chain merge shape.
|
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. |
Contributor
Author
|
/azp list |
Contributor
Author
|
/azp run runtime-coreclr superpmi-diffs |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
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.
Optimize bools could produce incorrect edge likelihoods.
From the bug, we'd combine (note BB03->BB06 likelihood of 0.96):
------------ BB03 [0002] [016..022) -> BB06(0.9697322),BB04(0.03026775) (cond), preds={BB02} succs={BB04,BB06} ------------ BB04 [0003] [022..02B) -> BB06(0),BB05(1) (cond), preds={BB03} succs={BB05,BB06}into this after fusing BB003,04 (Note BB03->BB06 likelihood of 0)
------------ BB03 [0002] [016..02B) -> BB06(0),BB05(1) (cond), preds={BB02} succs={BB05,BB06}Fix
optOptimizeCompareChainCondBlockto correct this likelihood.I also replaced the call to fgRepairProfileCondToUncond which would incorrectly decrease the profile weight of BB06 in the above example.
Spent a bit looking through diffs. Regressions and improvements in perfscore are due to block weight inside loops now being calculated correctly. Some codesize changes caused by block reordering changes, as blockweight has gone 0.00->0.01 in some examples.
fixes #130150