Repository navigation
Skip redundant storage-conflict updates during coroutine layout - #163126
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @oli-obk rustbot has assigned @oli-obk. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
@bors try @rust-timer queue We now have tokio in the benchmark suite, so maybe it can show something. Though we still lack real-world async benchmarks. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Skip redundant storage-conflict updates during coroutine layout
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (12bb1d5): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression 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 -0.9%, secondary 1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Bootstrap: 493.092s -> 490.131s (-0.60%) |
This comment was marked as resolved.
This comment was marked as resolved.
| local_conflicts: BitMatrix<Local, Local>, | ||
| // We keep this bitset as a buffer to avoid reallocating memory. | ||
| eligible_storage_live: DenseBitSet<Local>, | ||
| last_recorded_storage_live: DenseBitSet<Local>, |
There was a problem hiding this comment.
Document that this is solely used as a fast path for avoiding recording conflicts that we already recorded if the currently live locals are the same or a subset of the previous live locals, for which we already recorded conflicts
|
@bors r+ rollup |
…=oli-obk
Skip redundant storage-conflict updates during coroutine layout
## Summary
When computing coroutine storage conflicts, we currently record conflicts between every pair in the live set. This PR instead remembers the last live set whose conflicts were recorded; if the current set is a subset, we skip the matrix updates. For example, after recording `{a, b, c}`, observing `{a, b}` adds no new conflicts.
I used an LLM to profile this change, and saw a compiler CPU reduction in the following projects:
- Codex: 2.69%
- Ruff: 2.84%
- uv: 5.28%
- ty: 3.28%
…uwer Rollup of 13 pull requests Successful merges: - #156949 (Detect missing else in let statement) - #160436 (stabilize `Box::take`) - #160570 (macro_metavar_expr_concat: support concatenating into string literals) - #162837 (Dedicated Display type for CStr::display) - #163099 (Use wrapping arithmetic in `from_str_radix`) - #163166 (Tiny cleanups to deferred liveness) - #161667 (Add `f16` inline ASM support for `nvptx64-nvidia-cuda`) - #163063 (Restore `Send` and `Sync` for `BorrowedCursor`) - #163097 (OpenBSD/sparc64 has switched from GCC to Clang) - #163126 (Skip redundant storage-conflict updates during coroutine layout) - #163135 (librustdoc: remove stale dep on base64) - #163146 (tests: Update `f16b` codegen test for LoongArch and RISC-V) - #163159 (treat inductive cycles as ambig)
Rollup merge of #163126 - charliermarsh:charlie/conflicts, r=oli-obk Skip redundant storage-conflict updates during coroutine layout ## Summary When computing coroutine storage conflicts, we currently record conflicts between every pair in the live set. This PR instead remembers the last live set whose conflicts were recorded; if the current set is a subset, we skip the matrix updates. For example, after recording `{a, b, c}`, observing `{a, b}` adds no new conflicts. I used an LLM to profile this change, and saw a compiler CPU reduction in the following projects: - Codex: 2.69% - Ruff: 2.84% - uv: 5.28% - ty: 3.28%
Prepare Ohm 1.99.0-3 with the current Rust, Cargo, Clippy, and rustfmt stack tips. The Rust pin includes the coroutine storage-conflict backport from rust-lang/rust#163126 and pins the same Cargo revision as the release manifest. Bundled upstream Wild remains at 0.10.0. The manifest schema, source revisions, Cargo gitlink, manifest history, and formatting checks pass. The optimizations guide is updated separately in #151 for review.
Summary
When computing coroutine storage conflicts, we currently record conflicts between every pair in the live set. This PR instead remembers the last live set whose conflicts were recorded; if the current set is a subset, we skip the matrix updates. For example, after recording
{a, b, c}, observing{a, b}adds no new conflicts.I used an LLM to profile this change, and saw a compiler CPU reduction in the following projects: