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

Remove AreVNsEquivalent #113304

Merged
merged 1 commit into from
Mar 10, 2025
Merged

Remove AreVNsEquivalent #113304

merged 1 commit into from
Mar 10, 2025

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Mar 9, 2025

Seems to be useless and decreases JIT TP.

Zero size diffs with TP improvements.

The function seems to try to compare two PHI defs and make sure their Phi args are the same. Judging by the diffs that never happens and we just pay a big TP price for it.

Maybe someday we'll have some generic tooling to decide whether two different VNs are in fact the same, but not today.

@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 9, 2025
Copy link
Contributor

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

@EgorBo EgorBo marked this pull request as ready for review March 9, 2025 19:49
@Copilot Copilot bot review requested due to automatic review settings March 9, 2025 19:49
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

@EgorBo
Copy link
Member Author

EgorBo commented Mar 10, 2025

@AndyAyersMS @jakobbotsch @dotnet/jit-contrib PTAL, simple PR, zero-diff, TP improvements - see desc.

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.

The PR that added this had some diffs and improvements: #104752. You might look at the case mentioned there. Maybe we're now able to get these cases by other means?

I had more ambitious plans for this but reasoning about memory proved challenging.

@EgorBo
Copy link
Member Author

EgorBo commented Mar 10, 2025

The PR that added this had some diffs and improvements: #104752. You might look at the case mentioned there. Maybe we're now able to get these cases by other means?

I had more ambitious plans for this but reasoning about memory proved challenging.

From top of my head, since then we did:

  • PhiDefs no longer have their own VN functions (@jakobbotsch removed them recently). I wonder if Phis where all args have the same VN now have that VN at the def effectively.
  • ValueNum/Assertprop now iterate Phi Args for optimizations via VNVisitReachingVNs and optVisitReachingAssertions and catch (both were introduced recently too)

@jakobbotsch
Copy link
Member

I recall we had to revert parts of that change because of soundness issues due to the fact that VNs from different loop iterations can be equal without actually having the same value. Looks like the revert happened in #106229, so perhaps that took all of the diffs with it as well.
There might be a bit more code that can be removed if that is the case.

@EgorBo
Copy link
Member Author

EgorBo commented Mar 10, 2025

I recall we had to revert parts of that change because of soundness issues due to the fact that VNs from different loop iterations can be equal without actually having the same value. Looks like the revert happened in #106229, so perhaps that took all of the diffs with it as well. There might be a bit more code that can be removed if that is the case.

Ah that explains it. Looks like number of benchmarks improved and then regressed match for these PRs

@AndyAyersMS
Copy link
Member

I recall we had to revert parts of that change because of soundness issues due to the fact that VNs from different loop iterations can be equal without actually having the same value. Looks like the revert happened in #106229, so perhaps that took all of the diffs with it as well. There might be a bit more code that can be removed if that is the case.

Yeah reading the notes on the revert it looks like we had regressions, so perhaps the net was zero diffs.

@EgorBo EgorBo merged commit a73d197 into dotnet:main Mar 10, 2025
114 checks passed
@EgorBo EgorBo deleted the remove-vnequals branch March 10, 2025 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

3 participants