about summary refs log tree commit diff
path: root/compiler/rustc_query_system/src/dep_graph
AgeCommit message (Collapse)AuthorLines
2025-07-28use let chains in mir, resolve, targetKivooeo-6/+6
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-06-03Ensure query keys are printed with reduced queriesMichael Goulet-5/+8
2025-05-14Handle `rustc_query_system` cases of `rustc::potential_query_instability` lintismailarilik-0/+4
2025-05-07Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obkbors-171/+287
Use thread local dep graph encoding This adds thread local encoding of dep graph nodes. Each thread has a `MemEncoder` that gets flushed to the global `FileEncoder` when it exceeds 64 kB. Each thread also has a local cache of dep indices. This means there can now be empty gaps in `SerializedDepGraph`. Indices are marked green and also allocated by the new atomic operation `DepNodeColorMap::try_mark_green` as the encoder lock is removed.
2025-05-06Use the portable `AtomicU64`John Kåre Alsaker-2/+2
2025-05-06Rename `graph::implementation::Graph` to `LinkedGraph`Zalathar-3/+3
2025-05-05Add some comments about thread local indicesJohn Kåre Alsaker-1/+5
2025-05-05Tweak index chunk allocationJohn Kåre Alsaker-5/+9
2025-05-01Add some commentsJohn Kåre Alsaker-1/+3
2025-05-01Use thread local dep graph encodingJohn Kåre Alsaker-170/+276
2025-04-22Make sure there's no duplicate indices in the dep graphJohn Kåre Alsaker-1/+5
2025-04-22Tweak edgesJohn Kåre Alsaker-8/+5
2025-04-22Use `IndexVec::from_elem_n`John Kåre Alsaker-10/+7
2025-04-22Add index to the dep graph format and encode via `MemEncoder`John Kåre Alsaker-39/+83
2025-04-17Rollup merge of #139236 - Zoxc:anon-counter, r=davidtwcoMatthias Krüger-8/+16
Use a session counter to make anon dep nodes unique This changes the unique session hash used to ensure unique anon dep nodes per session from a timestamp to a counter. This is nicer for debugging as it makes the dep graph deterministic.
2025-04-13Rollup merge of #139636 - Zoxc:graph-edges-len-u32, r=compiler-errorsJacob Pratt-8/+10
Encode dep node edge count as u32 instead of usize This encodes the dep node edge count as u32 instead of usize. It doesn't need to be usize as the count is limited the the unique number of dep nodes which we use a 32-bit index for. It probably saves some branches for encoding / decoding, but it isn't too hot as the count gets packed in with other fields when it's low. <table><tr><td rowspan="2">Benchmark</td><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th><td colspan="1"><b>Before</b></th><td colspan="2"><b>After</b></th></tr><tr><td align="right">Time</td><td align="right">Time</td><td align="right">%</th><td align="right">Physical Memory</td><td align="right">Physical Memory</td><td align="right">%</th><td align="right">Committed Memory</td><td align="right">Committed Memory</td><td align="right">%</th></tr><tr><td>🟣 <b>clap</b>:check:unchanged</td><td align="right">0.3343s</td><td align="right">0.3343s</td><td align="right"> -0.00%</td><td align="right">97.02 MiB</td><td align="right">96.89 MiB</td><td align="right"> -0.13%</td><td align="right">167.93 MiB</td><td align="right">167.80 MiB</td><td align="right"> -0.08%</td></tr><tr><td>🟣 <b>hyper</b>:check:unchanged</td><td align="right">0.1353s</td><td align="right">0.1350s</td><td align="right"> -0.19%</td><td align="right">61.91 MiB</td><td align="right">61.83 MiB</td><td align="right"> -0.13%</td><td align="right">124.64 MiB</td><td align="right">124.64 MiB</td><td align="right"> 0.00%</td></tr><tr><td>🟣 <b>regex</b>:check:unchanged</td><td align="right">0.2479s</td><td align="right">0.2481s</td><td align="right"> 0.10%</td><td align="right">78.34 MiB</td><td align="right">78.35 MiB</td><td align="right"> 0.02%</td><td align="right">145.20 MiB</td><td align="right">145.31 MiB</td><td align="right"> 0.08%</td></tr><tr><td>🟣 <b>syn</b>:check:unchanged</td><td align="right">0.5347s</td><td align="right">0.5333s</td><td align="right"> -0.26%</td><td align="right">118.63 MiB</td><td align="right">118.66 MiB</td><td align="right"> 0.02%</td><td align="right">193.05 MiB</td><td align="right">193.11 MiB</td><td align="right"> 0.03%</td></tr><tr><td>Total</td><td align="right">1.2521s</td><td align="right">1.2507s</td><td align="right"> -0.11%</td><td align="right">355.90 MiB</td><td align="right">355.74 MiB</td><td align="right"> -0.05%</td><td align="right">630.83 MiB</td><td align="right">630.87 MiB</td><td align="right"> 0.01%</td></tr><tr><td>Summary</td><td align="right">1.0000s</td><td align="right">0.9991s</td><td align="right"> -0.09%</td><td align="right">1 byte</td><td align="right">1.00 bytes</td><td align="right"> -0.06%</td><td align="right">1 byte</td><td align="right">1.00 bytes</td><td align="right"> 0.01%</td></tr></table>
2025-04-10Encode dep node edge count as u32 instead of usizeJohn Kåre Alsaker-8/+10
2025-04-05Reuse the index from promoted nodes when coloring executed tasksJohn Kåre Alsaker-36/+88
2025-04-02Add a dep kind for use of the anon node with zero dependenciesJohn Kåre Alsaker-5/+8
2025-04-02Use a session counter to make anon dep nodes uniqueJohn Kåre Alsaker-8/+16
2025-03-30Encode synthetic by-move coroutine body with a different DefPathDataMichael Goulet-3/+4
2025-03-24Remove `prev_index_to_index` field from `CurrentDepGraph`John Kåre Alsaker-185/+144
2025-03-19Allow duplicates for side effect nodesJohn Kåre Alsaker-2/+5
2025-03-19Pass in dep kind names to the duplicate dep node checkJohn Kåre Alsaker-4/+7
2025-03-19Rename `intern_new_node` to `alloc_new_node`John Kåre Alsaker-4/+4
2025-03-19Use `ShardedHashMap` for `anon_node_to_index`John Kåre Alsaker-28/+9
2025-03-19Use `nodes_newly_allocated_in_current_session` to lookup forbidden readsJohn Kåre Alsaker-5/+18
2025-03-19Check for duplicate dep nodes when creating the indexJohn Kåre Alsaker-1/+8
2025-03-19Add fixmeJohn Kåre Alsaker-0/+1
2025-03-19Outline some cold code and turn on hash collision detection with ↵John Kåre Alsaker-16/+21
debug_assertions
2025-03-19Only use the new node hashmap for anonymous nodes.Camille GILLOT-48/+101
2025-03-15Fix `record_diagnostic`John Kåre Alsaker-2/+6
2025-03-14Add commentsJohn Kåre Alsaker-0/+9
2025-03-14Rename `QuerySideEffects` to `QuerySideEffect`John Kåre Alsaker-6/+10
2025-03-14Represent diagnostic side effects as dep nodesJohn Kåre Alsaker-46/+76
2025-03-10Convert `ShardedHashMap` to use `hashbrown::HashTable`Josh Stone-20/+11
The `hash_raw_entry` feature has finished fcp-close, so the compiler should stop using it to allow its removal. Several `Sharded` maps were using raw entries to avoid re-hashing between shard and map lookup, and we can do that with `hashbrown::HashTable` instead.
2025-03-09Auto merge of #138267 - matthiaskrgr:rollup-vt76bhs, r=matthiaskrgrbors-6/+5
Rollup of 12 pull requests Successful merges: - #136127 (Allow `*const W<dyn A> -> *const dyn A` ptr cast) - #136968 (Turn order dependent trait objects future incompat warning into a hard error) - #137319 (Stabilize `const_vec_string_slice`) - #137885 (tidy: add triagebot checks) - #138040 (compiler: Use `size_of` from the prelude instead of imported) - #138084 (Use workspace lints for crates in `compiler/`) - #138158 (Move more layouting logic to `rustc_abi`) - #138160 (depend more on attr_data_structures and move find_attr! there) - #138192 (crashes: couple more tests) - #138216 (bootstrap: Fix stack printing when a step cycle is detected) - #138232 (Reduce verbosity of GCC build log) - #138242 (Revert "Don't test new error messages with the stage 0 compiler") r? `@ghost` `@rustbot` modify labels: rollup
2025-03-07compiler: Use size_of from the prelude instead of importedThalia Archibald-6/+5
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-02-27Changed the dependency graph to start preallocated with 128 capacityMichał Kostrubiec-2/+1
2025-02-22Greatly simplify lifetime captures in edition 2024Michael Goulet-1/+1
2025-02-11compiler/rustc_data_structures/src/sync.rs: remove atomics, but not AtomicU64!Askar Safin-2/+2
2025-02-06Auto merge of #136471 - safinaskar:parallel, r=SparrowLiibors-6/+6
tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc` tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc` This is continuation of https://github.com/rust-lang/rust/pull/132282 . I'm pretty sure I did everything right. In particular, I searched all occurrences of `Lrc` in submodules and made sure that they don't need replacement. There are other possibilities, through. We can define `enum Lrc<T> { Rc(Rc<T>), Arc(Arc<T>) }`. Or we can make `Lrc` a union and on every clone we can read from special thread-local variable. Or we can add a generic parameter to `Lrc` and, yes, this parameter will be everywhere across all codebase. So, if you think we should take some alternative approach, then don't merge this PR. But if it is decided to stick with `Arc`, then, please, merge. cc "Parallel Rustc Front-end" ( https://github.com/rust-lang/rust/issues/113349 ) r? SparrowLii `@rustbot` label WG-compiler-parallel
2025-02-04Remove `dep_node` comment duplication.Nicholas Nethercote-13/+26
`rustc_middle` and `rustc_query_system` both have a file called `dep_node.rs` with a big comment at the top, and the comments are very similar. The one in `rustc_query_system` looks like the original, and the one in `rustc_middle` is a copy with some improvements. This commit removes the comment from `rustc_middle` and updates the one in `rustc_query_system` to include the improvements. I did it this way because `rustc_query_system` is the crate that defines `DepNode`, and so seems like the right place for the comment.
2025-02-03tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`Askar Safin-6/+6
2025-01-13remove code duplication when hashing query result and interning nodeMartin Zacho-42/+36
Refactored the duplicated code into a function. `with_feed_task` currently passes the query key to `debug_assert!`. This commit changes that, so it debug prints the `DepNode`, as in `with_task`.
2024-12-04Make sure to record deps from cached task in new solver on first runMichael Goulet-2/+15
2024-11-12Auto merge of #132282 - Noratrieb:it-is-the-end-of-serial, r=cjgillotbors-13/+0
Delete the `cfg(not(parallel))` serial compiler Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon! #113349 Note that the default is still 1 thread, as more than 1 thread is still fairly broken. cc `@onur-ozkan` to see if i did the bootstrap field removal correctly, `@SparrowLii` on the sync parts
2024-11-12Delete the `cfg(not(parallel))` serial compilerNoratrieb-13/+0
Since it's inception a long time ago, the parallel compiler and its cfgs have been a maintenance burden. This was a necessary evil the allow iteration while not degrading performance because of synchronization overhead. But this time is over. Thanks to the amazing work by the parallel working group (and the dyn sync crimes), the parallel compiler has now been fast enough to be shipped by default in nightly for quite a while now. Stable and beta have still been on the serial compiler, because they can't use `-Zthreads` anyways. But this is quite suboptimal: - the maintenance burden still sucks - we're not testing the serial compiler in nightly Because of these reasons, it's time to end it. The serial compiler has served us well in the years since it was split from the parallel one, but it's over now. Let the knight slay one head of the two-headed dragon!
2024-11-03replace manual time convertions with std onesklensy-1/+1