Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: fix count reconstruction when a natural loop contains an improper loop #100449

Merged
merged 1 commit into from
Mar 29, 2024

Conversation

AndyAyersMS
Copy link
Member

If a natural loop contains an improper loop, the cyclic probability computation for the natural loop will be an underestimate, as the cyclic probability computation assumes one pass convergence.

In such cases count reconstruction may report convergence when it has not in fact converged, as any natural loop header ignores flow from its back edges, assuming their impact has been accounted for by the cyclic probability.

So, when a loop contains improper loops, fall back to normal iterative computation for the loop. We could use the cyclic probability initially as a convergence accelerator but would need to switch over to not using it to guarantee full convergence. But that complicates the logic, and these cases are rare.

…r loop

If a natural loop contains an improper loop, the cyclic probability computation
for the natural loop will be an understimate, as the cyclic probability computation
assumes one pass convergence.

In such cases count reconstruction may report convergence when it has not in
fact converged, as any natural loop header ignores flow from its backedges, assuming
their impact has been accounted for by the cyclic probability.

So when a loop contains improper loops, fall back to normal iterative computation
for the loop. We could use the cyclic probability initially as a convergence
accelerator, but would need to switch over to not using it to guarantee full
convergence. But that complicates the logic and these cases are rare.
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 29, 2024
Copy link
Contributor

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

@AndyAyersMS
Copy link
Member Author

@jakobbotsch @BruceForstall PTAL
cc @dotnet/jit-contrib

Locally one perf score diff (no asm diffs).

Found while scouting changes for block count consistency after profile incorporation, with more widespread use of count repair than we do now.

@AndyAyersMS AndyAyersMS merged commit d1cc577 into dotnet:main Mar 29, 2024
110 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 29, 2024
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.

None yet

2 participants