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

Preprocess and cache dominator tree #111673

Merged
merged 9 commits into from
May 24, 2023
Merged

Conversation

cjgillot
Copy link
Contributor

Preprocessing dominators has a very strong effect for #111344.
That pass checks that assignments dominate their uses repeatedly. Using the unprocessed dominator tree caused a quadratic runtime (number of bbs x depth of the dominator tree).

This PR also caches the dominator tree and the pre-processed dominators in the MIR cfg cache.

Rebase of #107157
cc @tmiasko

@rustbot
Copy link
Collaborator

rustbot commented May 17, 2023

r? @oli-obk

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 17, 2023
@rustbot
Copy link
Collaborator

rustbot commented May 17, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

compiler/rustc_mir_transform/src/ctfe_limit.rs Outdated Show resolved Hide resolved
compiler/rustc_mir_transform/src/ssa.rs Outdated Show resolved Hide resolved
compiler/rustc_borrowck/src/lib.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/mir/basic_blocks.rs Outdated Show resolved Hide resolved
@cjgillot cjgillot force-pushed the dominator-preprocess branch from e6505cf to f1f9088 Compare May 17, 2023 10:45
@rust-log-analyzer

This comment has been minimized.

@cjgillot cjgillot force-pushed the dominator-preprocess branch from f1f9088 to 8c2c695 Compare May 17, 2023 12:19
Copy link
Contributor

@tmiasko tmiasko left a comment

Choose a reason for hiding this comment

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

r=cjgillot,tmiasko after addressing remaining nits, unless you think it deserves another look given that it was coauthored.

compiler/rustc_const_eval/src/transform/validate.rs Outdated Show resolved Hide resolved
compiler/rustc_const_eval/src/transform/validate.rs Outdated Show resolved Hide resolved
@oli-obk
Copy link
Contributor

oli-obk commented May 24, 2023

r? @tmiasko

@rustbot rustbot assigned tmiasko and unassigned oli-obk May 24, 2023
@oli-obk
Copy link
Contributor

oli-obk commented May 24, 2023

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 24, 2023
@cjgillot
Copy link
Contributor Author

@bors r=cjgillot,tmiasko

@bors
Copy link
Contributor

bors commented May 24, 2023

📌 Commit 7c8f29f has been approved by cjgillot,tmiasko

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 24, 2023
@bors
Copy link
Contributor

bors commented May 24, 2023

⌛ Testing commit 7c8f29f with merge 97d3280...

@bors
Copy link
Contributor

bors commented May 24, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot,tmiasko
Pushing 97d3280 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 24, 2023
@bors bors merged commit 97d3280 into rust-lang:master May 24, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 24, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (97d3280): comparison URL.

Overall result: ❌✅ regressions and improvements - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 3
Regressions ❌
(secondary)
0.3% [0.2%, 0.4%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.2% [-1.2%, -1.2%] 3
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 3

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.4% [1.0%, 2.8%] 7
Regressions ❌
(secondary)
1.9% [1.1%, 2.9%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.4% [1.0%, 2.8%] 7

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-2.7%, -2.1%] 2
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 645.989s -> 647.059s (0.17%)

@rustbot rustbot added the perf-regression Performance regression. label May 24, 2023
@cjgillot cjgillot deleted the dominator-preprocess branch May 25, 2023 18:28
@pnkfelix
Copy link
Member

  • primary benchmarks libc {check, debug}-full and bitmaps check-full regressed a little.
  • this pays a bit of upfront cost to avoid a O(n^2) pathology in other planned code.
  • marked as triaged.

@rustbot label: perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants