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

Only clear written-to locals in ConstProp #109087

Merged
merged 2 commits into from
Mar 22, 2023
Merged

Conversation

cjgillot
Copy link
Contributor

This aims to revert the regression in #108872

Clearing all locals at the end of each bb is very costly.
This PR goes back to the original implementation of recording which locals are modified.

@rustbot
Copy link
Collaborator

rustbot commented Mar 13, 2023

r? @davidtwco

(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 Mar 13, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 13, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@cjgillot
Copy link
Contributor Author

@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 Mar 13, 2023
@bors
Copy link
Contributor

bors commented Mar 13, 2023

⌛ Trying commit f1639046613c8a2d8d145b6988f07e483e6493c8 with merge b366731ad56f28626f3195de1a16febed2a84475...

self.ecx.machine.written_only_inside_own_block_locals =
written_only_inside_own_block_locals;

#[cfg(debug_assertions)]
Copy link
Member

Choose a reason for hiding this comment

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

could you turn this into an if cfg!(debug_assertions) instead? it does increase the indentation slightly but it's a lot nicer to work with

@bors
Copy link
Contributor

bors commented Mar 13, 2023

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b366731ad56f28626f3195de1a16febed2a84475): 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)
-2.5% [-6.2%, -0.6%] 30
Improvements ✅
(secondary)
-18.0% [-59.1%, -0.4%] 14
All ❌✅ (primary) -2.5% [-6.2%, -0.6%] 30

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

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)
-1.5% [-2.0%, -1.1%] 7
Improvements ✅
(secondary)
-17.2% [-34.2%, -4.1%] 8
All ❌✅ (primary) -1.5% [-2.0%, -1.1%] 7

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 14, 2023
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

r=me, resolving nils comment if you want

@nnethercote
Copy link
Contributor

Oh dear: #108815 was a big improvement for keccak and cranelift-codegen. Unfortunately, it was merged between #108872 (which massively regressed those benchmarks) and this PR (which mostly?/entirely? fixes the regression). It will be tricky to disentangle the individual perf effects of the three PRs.

cc @the8472

@cjgillot
Copy link
Contributor Author

@bors r=davidtwco

@bors
Copy link
Contributor

bors commented Mar 19, 2023

📌 Commit e5a55dc has been approved by davidtwco

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-review Status: Awaiting review from the assignee but also interested parties. labels Mar 19, 2023
@bors
Copy link
Contributor

bors commented Mar 21, 2023

⌛ Testing commit e5a55dc with merge 309b33d943f412e3c1c3235cf01ee083d7ec1dd9...

@bors
Copy link
Contributor

bors commented Mar 21, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 21, 2023
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-mingw-2 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[2529/3025] Building CXX object lib/ToolDrivers/llvm-lib/CMakeFiles/LLVMLibDriver.dir/LibDriver.cpp.obj
[2530/3025] Building CXX object lib/XRay/CMakeFiles/LLVMXRay.dir/BlockVerifier.cpp.obj
[2531/3025] Linking CXX static library lib\libLLVMDebugInfoDWARF.a
[2532/3025] Linking CXX static library lib\libLLVMRuntimeDyld.a
FAILED: lib/libLLVMRuntimeDyld.a 
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E rm -f lib\libLLVMRuntimeDyld.a && C:\a\rust\rust\mingw64\bin\ar.exe qc lib\libLLVMRuntimeDyld.a  lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/JITSymbol.cpp.obj lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RTDyldMemoryManager.cpp.obj lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyld.cpp.obj lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldChecker.cpp.obj lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldCOFF.cpp.obj lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldELF.cpp.obj lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/RuntimeDyldMachO.cpp.obj lib/ExecutionEngine/RuntimeDyld/CMakeFiles/LLVMRuntimeDyld.dir/Targets/RuntimeDyldELFMips.cpp.obj && C:\a\rust\rust\mingw64\bin\ranlib.exe lib\libLLVMRuntimeDyld.a && cd ."
C:\a\rust\rust\mingw64\bin\ar.exe: could not create temporary file whilst writing archive: no more archived files
[2533/3025] Linking CXX static library lib\libLLVMObjCopy.a
[2534/3025] Building CXX object lib/XRay/CMakeFiles/LLVMXRay.dir/Profile.cpp.obj
[2535/3025] Linking CXX static library lib\libLLVMJITLink.a
[2536/3025] Linking CXX static library lib\libLLVMDebugInfoGSYM.a
[2536/3025] Linking CXX static library lib\libLLVMDebugInfoGSYM.a
[2537/3025] Building CXX object lib/XRay/CMakeFiles/LLVMXRay.dir/RecordPrinter.cpp.obj
[2538/3025] Linking CXX static library lib\libLLVMDebugInfoPDB.a
[2539/3025] Linking CXX static library lib\libLLVMObjectYAML.a
ninja: build stopped: subcommand failed.
command did not execute successfully, got: exit code: 1


build script failed, must exit now', C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\cmake-0.1.48\src\lib.rs:975:5
 finished in 280.692 seconds
Build completed unsuccessfully in 0:05:51
Build completed unsuccessfully in 0:05:51
make: *** [Makefile:80: ci-mingw-subset-2] Error 1

@nnethercote
Copy link
Contributor

Failure while building LLVM:

could not create temporary file whilst writing archive: no more archived files

Seems like a transient error unrelated to this PR.

@bors retry

@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-review Status: Awaiting review from the assignee but also interested parties. labels Mar 22, 2023
@bors
Copy link
Contributor

bors commented Mar 22, 2023

⌛ Testing commit e5a55dc with merge 5fa73a7...

@bors
Copy link
Contributor

bors commented Mar 22, 2023

☀️ Test successful - checks-actions
Approved by: davidtwco
Pushing 5fa73a7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 22, 2023
@bors bors merged commit 5fa73a7 into rust-lang:master Mar 22, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 22, 2023
@cjgillot cjgillot deleted the sparse-bb-clear branch March 22, 2023 07:40
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5fa73a7): 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
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 3
Improvements ✅
(primary)
-2.7% [-6.1%, -0.8%] 27
Improvements ✅
(secondary)
-15.8% [-63.2%, -0.2%] 17
All ❌✅ (primary) -2.7% [-6.1%, -0.8%] 27

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

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.8% [0.4%, 1.4%] 5
Improvements ✅
(primary)
-1.5% [-1.9%, -1.0%] 6
Improvements ✅
(secondary)
-14.6% [-36.5%, -0.6%] 10
All ❌✅ (primary) -1.5% [-1.9%, -1.0%] 6

@rustbot rustbot added the perf-regression Performance regression. label Mar 22, 2023
@rylev
Copy link
Member

rylev commented Mar 28, 2023

Given the overall positive impact of this PR and the complex relationship it has with some other PRs, I think it's safe to say the perf results are fine here.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Mar 28, 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.

9 participants