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

MIR dominators: computed on-demand and cached #106956

Closed
wants to merge 2 commits into from

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Jan 16, 2023

  • Cached inside MIR body - motivated by potential reuse opportunity when
    code generating different instantiations of the same generic code.

  • Delayed until demanded in borrowck - motivated by observation that
    some check / metadata only builds, where dominator computation is hot,
    never query the dominator tree.

@rustbot
Copy link
Collaborator

rustbot commented Jan 16, 2023

r? @michaelwoerister

(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 Jan 16, 2023
@tmiasko
Copy link
Contributor Author

tmiasko commented Jan 16, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 16, 2023
@bors
Copy link
Contributor

bors commented Jan 17, 2023

⌛ Trying commit b27385511d924359203d0e48811d3007cb00b609 with merge ac9ac65b7d6f65d110c0805046ceecd553737a3f...

@bors
Copy link
Contributor

bors commented Jan 17, 2023

☀️ Try build successful - checks-actions
Build commit: ac9ac65b7d6f65d110c0805046ceecd553737a3f (ac9ac65b7d6f65d110c0805046ceecd553737a3f)

1 similar comment
@bors
Copy link
Contributor

bors commented Jan 17, 2023

☀️ Try build successful - checks-actions
Build commit: ac9ac65b7d6f65d110c0805046ceecd553737a3f (ac9ac65b7d6f65d110c0805046ceecd553737a3f)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ac9ac65b7d6f65d110c0805046ceecd553737a3f): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.5%, -0.2%] 22
Improvements ✅
(secondary)
-0.6% [-1.4%, -0.2%] 15
All ❌✅ (primary) -0.3% [-0.5%, -0.2%] 22

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)
0.8% [0.5%, 1.3%] 3
Regressions ❌
(secondary)
1.6% [0.8%, 3.3%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.3% [-5.3%, -5.3%] 1
All ❌✅ (primary) 0.8% [0.5%, 1.3%] 3

Cycles

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

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 17, 2023
@tmiasko
Copy link
Contributor Author

tmiasko commented Jan 17, 2023

Separated part of changes into #106976 and #106975. Not sure if caching dominators globally is good time / memory trade-off.

@tmiasko tmiasko closed this Jan 17, 2023
@tmiasko tmiasko deleted the dominators-cached branch January 17, 2023 12:09
@cjgillot
Copy link
Contributor

I think this PR is a good idea. From the perf report, average effect on max-rss is almost 0, so we can't conclude that this caching has a significant memory impact, while it sure has a instr-count impact.

Borrowck is not the only place that may use dominators. #106908 and #106285 may benefit from this caching too.

@tmiasko
Copy link
Contributor Author

tmiasko commented Jan 17, 2023

If you are still interested in this, I can reopen and rerun perf after merging the borrowck changes in #106976, so the effect of caching is benchmarked in isolation.

@tmiasko tmiasko restored the dominators-cached branch January 21, 2023 14:32
@tmiasko tmiasko reopened this Jan 21, 2023
 Cached inside MIR body - motivated by potential reuse opportunity when
 code generating different instantiations of the same generic code.
@tmiasko
Copy link
Contributor Author

tmiasko commented Jan 21, 2023

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 21, 2023
@bors
Copy link
Contributor

bors commented Jan 21, 2023

⌛ Trying commit a705ccb with merge 31e5d42f7a60fc1ac5c6b1c67ff019141c11a208...

@bors
Copy link
Contributor

bors commented Jan 21, 2023

☀️ Try build successful - checks-actions
Build commit: 31e5d42f7a60fc1ac5c6b1c67ff019141c11a208 (31e5d42f7a60fc1ac5c6b1c67ff019141c11a208)

1 similar comment
@bors
Copy link
Contributor

bors commented Jan 21, 2023

☀️ Try build successful - checks-actions
Build commit: 31e5d42f7a60fc1ac5c6b1c67ff019141c11a208 (31e5d42f7a60fc1ac5c6b1c67ff019141c11a208)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (31e5d42f7a60fc1ac5c6b1c67ff019141c11a208): comparison URL.

Overall result: ❌ regressions - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

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
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

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)
0.5% [0.5%, 0.6%] 2
Regressions ❌
(secondary)
1.2% [1.1%, 1.2%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.7% [-6.7%, -2.0%] 4
All ❌✅ (primary) 0.5% [0.5%, 0.6%] 2

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)
1.7% [1.2%, 2.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 21, 2023
@tmiasko
Copy link
Contributor Author

tmiasko commented Jan 22, 2023

Caching on its own is not an improvement right now. It might make sense to revisit this after #106908, #106285, #107172 land, if all those passes can indeed be organized to reuse the computation.

@tmiasko tmiasko closed this Jan 22, 2023
@tmiasko tmiasko deleted the dominators-cached branch January 22, 2023 11:07
@cjgillot cjgillot mentioned this pull request Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants