Introduce TypingMode::Codegen to avoid layout cycles on coroutines#145477
Introduce TypingMode::Codegen to avoid layout cycles on coroutines#145477cjgillot wants to merge 4 commits into
TypingMode::Codegen to avoid layout cycles on coroutines#145477Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
[EXPERIMENT] Introduce `TypingMode::Codegen` to avoid layout cycles
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (34dd67f): comparison URL. Overall result: ❌ regressions - 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 1.4%, secondary 4.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.9%, secondary 4.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary -1.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 469.562s -> 472.464s (0.62%) |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
[EXPERIMENT] Introduce `TypingMode::Codegen` to avoid layout cycles
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (4e9488c): comparison URL. Overall result: ❌ regressions - 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 1.7%, secondary 5.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.0%, secondary -1.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 470.222s -> 472.094s (0.40%) |
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #145469) made this pull request unmergeable. Please resolve the merge conflicts. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
[EXPERIMENT] Introduce `TypingMode::Codegen` to avoid layout cycles
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (7bf3ad1): comparison URL. Overall result: ❌ regressions - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in 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 1.6%, secondary 1.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.0%, secondary 2.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.3%, secondary -0.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 495.343s -> 498.406s (0.62%) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
TypingMode::Codegen to avoid layout cyclesTypingMode::Codegen to avoid layout cycles on coroutines
|
The Clippy subtree was changed cc @rust-lang/clippy Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri Some changes occurred in match checking cc @Nadrieril Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt Some changes occurred to the CTFE machinery Some changes occurred to the core trait solver cc @rust-lang/initiative-trait-system-refactor |
|
r? @oli-obk rustbot has assigned @oli-obk. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| match key.typing_env.typing_mode().assert_not_erased() { | ||
| ty::TypingMode::PostAnalysis => {} | ||
| // We are in codegen. It's very likely this constant has been evaluated in PostAnalysis before. | ||
| // Try to reuse this evaluation, and only re-run if we hit a `TooGeneric` error. |
There was a problem hiding this comment.
Is it reasonably practical to not have to repeat this logic twice?
View all comments
Computing layout of coroutines depends on their
optimized_mir. At the same time, MIR opts can require using layouts to work. For instance to evaluate constants. This leads to cycles and clumsy workarounds.This PR creates a new typing mode for layout computations:
TypingMode::PostAnalysisor earlier, returnLayourError::TooGeneric;TypingMode::Codegen, actually compute it.TypingMode::Codegenis meant be be used by codegen code, and analyses that require coroutine layout, like transmute check and coroutine recursion check.With this PR, we can remove all
is_coroutinechecks fromrustc_mir_transformand unlock simplifying coroutine MIR.Perf is not terrific. This PR causes recomputation of a few queries, and I had to insert workarounds.