Skip to content

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.
@ghost ghost 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.

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.

2 participants