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: Stop using ref counts in forward sub #85909

Merged
merged 3 commits into from
May 9, 2023

Conversation

jakobbotsch
Copy link
Member

Instead of going to great lengths to keep the ref counts correct in physical promotion just stop using them in forward sub. The last use information generalizes what forward sub needs except for when the tracking limit is reached, which shows in the improvements we actually get from consulting the ref counts -- the improvements are very modest and in tests only.

This makes early liveness the only consumer of the "regular" ref counts computed by local morph. Weighted ref counts are still used for undoing regular promotion of implicit byref parameters.

Instead of going to great lengths to keep the ref counts correct in
physical promotion just stop using them in forward sub. The last use
information generalizes what forward sub needs except for when the
tracking limit is reached, which shows in the improvements we actually
get from consulting the ref counts -- the improvements are very modest
and in tests only.

This makes early liveness the only consumer of the "regular" ref counts
computed by local morph. Weighted ref counts are still used for undoing
regular promotion of implicit byref parameters.
@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 May 8, 2023
@ghost ghost assigned jakobbotsch May 8, 2023
@ghost
Copy link

ghost commented May 8, 2023

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

Issue Details

Instead of going to great lengths to keep the ref counts correct in physical promotion just stop using them in forward sub. The last use information generalizes what forward sub needs except for when the tracking limit is reached, which shows in the improvements we actually get from consulting the ref counts -- the improvements are very modest and in tests only.

This makes early liveness the only consumer of the "regular" ref counts computed by local morph. Weighted ref counts are still used for undoing regular promotion of implicit byref parameters.

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch jakobbotsch marked this pull request as ready for review May 8, 2023 15:32
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

Diffs.

Let me know if you have any objections to this...

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with removing reliance on early ref counts.

//
bool livenessBased = false;
if (varDsc->lvRefCnt(RCS_EARLY) != 2)
if (!fgDidEarlyLiveness)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bail up in fgForwardSub, and assert `fgDidEarlyLiveness' is true here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, done

@jakobbotsch jakobbotsch merged commit 547c506 into dotnet:main May 9, 2023
@jakobbotsch jakobbotsch deleted the physical-promotion-ref-counts branch May 9, 2023 07:24
@ghost ghost locked as resolved and limited conversation to collaborators Jun 8, 2023
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