Repository navigation
Rollup of 9 pull requests - #166567
Rollup of 9 pull requests#166567
Conversation
`WakeByAddressSingle` doesn't report whether it woke anything, so `futex_wake` is always false on Windows and `wake_writer_or_readers` wakes a writer and the readers together. The writer usually loses. Count the writers going to sleep on `writer_notify` and treat a non-zero count as a wakeup that reached a writer.
We start with a fresh incr comp session dir, so an already existing file would mean that there is a conflict between two files produced by the same rustc instance.
crate_info.each_linked_rlib_file_for_lto is empty for thin local LTO and by extension crate_info.exported_symbols_for_lto is adopted appropriately. As such behavior should be unchanged.
This test switches the section with `.section` and never switches it back. The Reference says that assembly using a stateful directive must undo the effect of the directive before the block ends (see `asm.directives.stateful`). In this case, nothing follows the block, so nothing is affected. But let's make the test follow the rule.
Most of this commit is moving code around and extracting some functions to make bb assignments clear and explicit.
Prepare for splitting tests. Done in a separate commit so git has an easier time tracking these.
This crate currently takes a rather long time to build, 40s-1m, which makes iteration difficult. Switch to the same pattern as std using Cargo's test detection so this automatically gets split into more crates. The change cuts off about 50% of the cold build time on my machine, and avoids needing to rebuild everything when a single test file is changed (incremental unfortunately does not work great). `num` is the limiting test, as it alone takes about 20s to build, but that could possibly be split further in the future. This change also caught that error.rs was not being run because it wasn't listed as a test module. `deny(unsafe_op_in_unsafe_fn)` is also removed as that is now implied by the edition. Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Library.20tests.20build.20time/with/643081197
…nthey core: Use autotests to split up coretests This crate currently takes a rather long time to build, 40s-1m, which makes iteration difficult. Switch to the same pattern as std using Cargo's test detection so this automatically gets split into more crates. The change cuts off about 50% of the cold build time on my machine, and avoids needing to rebuild everything when a single test file is changed (incremental unfortunately does not work great). `num` is the limiting test, as it alone takes about 20s to build, but that could possibly be split further in the future. This change also caught that error.rs was not being run because it wasn't listed as a test module. `deny(unsafe_op_in_unsafe_fn)` is also removed as that is now implied by the edition. Zulip discussion: https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Library.20tests.20build.20time/with/643081197
…nkov Various incr comp session refactors The first half of this PR is preparations for being able to create multiple incr comp sessions for a single crate. This will become important to store the post-ThinLTO incr comp artifacts once `-Zno-link`/`-Zlink-only` will run ThinLTO in a separate rustc session, thus requiring the main incr comp session to be finished before ThinLTO runs. The second half of this PR is a bunch of minor cleanups to `load_dep_graph`. Part of rust-lang/compiler-team#908
…ers, r=joboet Windows: Don't make RwLock writers race readers Fixes rust-lang#165314 The futex `RwLock` is meant to prefer writers. rust-lang#95801 does that by waking a writer first and only waking readers if `futex_wake` says there was no writer to wake. `WakeByAddressSingle` doesn't report that, so on Windows `futex_wake` is always false and a writer and the readers are woken together to race, which is the thing rust-lang#95801 set out to avoid. The writer usually loses. Just returning `true` doesn't work: `WRITERS_WAITING` can be stale, and then nothing ever wakes the readers. So this counts the writers going to sleep on `writer_notify`. If the count isn't zero, a writer still has to retry the lock. It'll either take it or find it held, and either way whoever unlocks will see `READERS_WAITING`. The compare-exchange before `wake_writer` must be `Acquire`. With `Relaxed` it can see the unlock of a writer that has already left and still read the old count, which leaves the readers asleep for good. Miri finds this if you force the interleaving, and a litmus test of just this ordering on an Apple M4 saw the old count 718829 times in 2.9 billion runs with `Relaxed` and never in 2.8 billion with `Acquire`. It can't happen on x86, where the generated code is the same. Before and after on a Ryzen 5 5600 with Windows 10. Locks are held for 20 us unless noted. | | writes/s | Writer p99 | reads/s | |---|---:|---:|---:| | Program from the issue | 1000 -> 6410 | 4.5 ms -> 36 us | | | 1 writer every 1 ms, 6 readers | x1.6 | 4 ms -> 47 us | +10% | | 3 writers, 6 readers | x2.4 | 2 ms -> 77 us | -30% | | 4 writers, 12 readers, 5 us holds | x31 | 24 ms -> 766 us | -79% | The last row is the cost. Writers go first, as on Linux, so with that many of them the readers mostly wait, and total operations drop 73%. In a `HashMap` cache shared by 6-24 threads, with 0.1-10% writes, 0-20 us between operations and 0-20 us read holds, total throughput rose in 19 of these 54 configurations and fell in 3, by about a quarter in the two with 10% writes and nothing between operations. Reader p99 got more than 1.5x worse in 8, all but one with 10% writes. Typst doesn't contend on any `RwLock` while compiling, so it doesn't change. `RwLock<T>` grows by 4 bytes unless `T` is aligned to 8. The uncontended paths are effectively unchanged. The queue-based `RwLock` is the obvious alternative and loses much less under heavy writes, but it makes uncontended reads 32% slower. Tested with `./x test library/std` and Miri on x86_64 only. FreeBSD, DragonFly and Fuchsia have the same `futex_wake` behavior and are left as they are. Adding them to the `cfg_select!` opts them in.
…ations-terminology, r=BoxyUwU feat: rename region obligations **For Context**: rust-lang/project-assumptions-on-binders#42 As mentioned in the issue, there are quite a few places in the repo with a variable called(or included) `region_obligations`, but they're neither regions(they're types) nor obligations(more likely a result). This is confusing and misleading, and this PR addresses it. **Changelog**: While reading the code, I found that there were already a few naming-related changes about some time ago. The most obvious one is this [line](https://github.com/rust-lang/rust/blob/249c1e4e31111b54ad2483cfd4cea06c7020c653/compiler/rustc_infer/src/infer/mod.rs#L149): ```rust region_obligations: Vec<TypeOutlivesConstraint<'tcx>> ``` which perfectly matches the issue's description. I reanmeed it to `type_outlives_constraints `, and using that as an achor, rename all the related related occurrences (thanks to rust-analyzer and grep). [One special case](https://github.com/rust-lang/rust/blob/249c1e4e31111b54ad2483cfd4cea06c7020c653/compiler/rustc_infer/src/infer/outlives/obligations.rs#L347) is `process_registered_region_obligations`, which involves both `region obligations` and `type outlives constraints`, **but in the near future we will remove the region outlives constraints**, so rename it `process_registered_type_outlives_constraints` directly will be better. Also, a purely mechanical replacement would miss quite a few places. For each change, i paid attention to params, return values, other local variables, and comments. That said, i can't claim i've renamed everything exhaustively. Still, i think this PR will greatly improve this situation :) I'm happy to make change if there are any issues. Thanks for your reivew!
… r=ZuseZ4 Offload: generic kernels in a lib This solves one of the blockers for using generic offload kernels (tracking issue rust-lang#131513) defined in a library. It uses the same logic for codegen in the device as for generics in normal compilations. The first commit also improves the ICE when an unknown symbol is read from the offload manifest, which has happened a lot while improving multi-crate support. With this, it's possible to call kernels from dependencies. The test shows that the kernels are generated in the appropriate device compilations. I verified the test failing before the patch. My local tests also include linking by running on my cargo fork with offload support and it links and runs correctly. There are still limitations. The most notable is that crate loading isn't propagated from host to device, which is the reason for the `extern crate` in the test. It will be fixed in a follow up [if we can converge on a design](https://rust-lang.zulipchat.com/#narrow/channel/422870-t-compiler.2Fgpgpu-backend/topic/offload.3A.20loading.20crates.20in.20the.20device.20pass/with/640253806) Another one is that it's impossible to call the kernels from a lib. I'm working on this, but it's fairly independent and I will make it as a follow up. @rustbot label +F-gpu_offload r? @ZuseZ4
…global-target-feature, r=Amanieu Restore the section in `global-target-feature.rs` This test switches the section with `.section` and never switches it back. The Reference says that assembly using a stateful directive must undo the effect of the directive before the block ends (see `asm.directives.stateful`). In this case, nothing follows the block, so nothing is affected. But let's make the test follow the rule. r? @Amanieu
…utine-drop, r=oli-obk avoid Terminator:None in coroutine drop shim building Another step towards changing `Option<Terminator>` to `Terminator` in `BasicBlockData`. More info in [this thread](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/vibe.20check.20-.20removing.20Option.20from.20Terminator/with/637588808). Most of this is moving some code around to make basic block id assumption happen right next to the list creation.
…caping-regions, r=nnethercote perf: remove cache in `FoldEscapingRegions`
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 42e0b13 (parent) -> 6c709eb (this PR) Test differencesShow 12315 test diffsStage 1
Stage 2
(and 12196 additional test diffs) Additionally, 19 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 6c709eb428d472a3c3d93681c1ba37d44a1c27cf --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (6c709eb): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary -5.2%, secondary -3.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.4%, secondary 2.5%)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: 459.97s -> 460.462s (0.11%) |
|
📌 Perf builds for each rolled up PR:
parent commit: 42e0b13fb7 In the case of a perf regression, run the following command with the SHAs of each PR you suspect might be the cause: |
Successful merges:
global-target-feature.rs#166539 (Restore the section inglobal-target-feature.rs)FoldEscapingRegions#166453 (perf: remove cache inFoldEscapingRegions)r? @ghost
Create a similar rollup