-
Notifications
You must be signed in to change notification settings - Fork 13.8k
JumpThreading: compute place and value indices on-demand #142881
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
base: master
Are you sure you want to change the base?
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
JumpThreading: compute place and value indices on-demand Perf experiment r? `@ghost`
This comment has been minimized.
This comment has been minimized.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (1587bef): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 3.6%, secondary 2.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeResults (primary -0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 689.082s -> 684.233s (-0.70%) |
This comment has been minimized.
This comment has been minimized.
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Some changes occurred in coverage tests. cc @Zalathar |
r? compiler |
d08b44c
to
f2018e5
Compare
☔ The latest upstream changes (presumably #144469) made this pull request unmergeable. Please resolve the merge conflicts. |
r? oli-obk |
|
This comment has been minimized.
This comment has been minimized.
r? saethlin |
The PR description sounds like this is just a perf change, but I see that some of the tests were perturbed. Do you know why? |
This comment has been minimized.
This comment has been minimized.
// CHECK: [[tmp:_.*]] = copy [[c]]; | ||
// CHECK: [[eq:_.*]] = Eq(move [[tmp]], const 2_i32); | ||
// CHECK: switchInt(move [[eq]]) -> [0: bb2, otherwise: bb1]; | ||
// CHECK: goto -> bb1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @saethlin for pushing me to investigate this. One of the behaviour changes is a bugfix for this pattern. On master
, if we read a
twice, the b = a
assignment makes us forget what the c = a
assignment told us. With this PR, we correctly merge the sets of conditions.
As for the other behaviour changes, my understanding is that this PR changes the order in which place and value indices are allocated. So changes where the |
☔ The latest upstream changes (presumably #146829) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Profiling JumpThreading reveals that a large part of the runtime happens constructing the place and value
Map
. This is unfortunate, as jump-threading may end up not even doing anything.The cause for this large up-front cost is following:
Map
attempts to create aPlaceIndex
for each place that may hold a relevant value. This means all places that appear in MIR, but also all places whose value is accessed by a projection of a copy of a larger place.This PR refactors the creation of
Map
to happen on-demand: place and value indices are created when threading computation happens.The up-front mode is still relevant for DataflowConstProp, so is not touched.