Skip to content

Skip stalled goals before the fast path in the fulfillment loop - #23550

Open
Hexay wants to merge 2 commits into
rust-lang:masterfrom
Hexay:perf/skip-stalled-goals
Open

Hexay wants to merge 2 commits into
rust-lang:masterfrom
Hexay:perf/skip-stalled-goals

Conversation

@Hexay

@Hexay Hexay commented Oct 22, 2026

Copy link
Copy Markdown

Goals that stalled on an earlier pass build new SearchGraph and EvalCtxt, before reaching the stall check.

before after
Inference 368 G instr 189 G instr (−49%)
Total 550 G instr 371 G instr (−33%)

No divergence found across large dependency workspace.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 22, 2026
self.obligations.register(obligation, stalled_on);
continue;
}

@ShoyuVanilla ShoyuVanilla Oct 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Might not be possible b/c we haven't updated the solver for a while. Maybe blocked on updating it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

An update isn't needed, but a bump of solver to 0.175 would make it cleaner.

@ShoyuVanilla ShoyuVanilla Oct 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ada4a has been working on the solver update but it would take some time.
cc https://rust-lang.zulipchat.com/#narrow/channel/185405-t-compiler.2Frust-analyzer/topic/Updating.20next-solver/with/629296217

So, if we could bump it to 0.175 without breaking things that would be nice, but if not, working with the current solver would make sense, I think

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(I'm slowly doing the updates locally, and am now at 0.169. But right now I'm on vacation until the end of the week + we need to set up trusted publishing for the shared crates to actually perform the updates. Every version bump is a gamble in terms of how much fixing-up is required, so it's hard to estimate when I'll be able to get to 0.175 – maybe middle/end of November?)

@ShoyuVanilla ShoyuVanilla Oct 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for disturbing your vacation 😅 Let me know if there's anything I could help a bit and have a good time!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All good, just wanted to give some context^^

You're involved with the next solver as well, right? If I have any questions while doing the update, I might ping you on Zulip :3 (probably in the thread you've linked)

Thank you, you too! Talk to you soon:)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it be an option to merge this fix as is, but also add a FIXME including the simpler fix you're talking about @Hexay? That way, I could switch over to it once I get to 0.175. In case getting this fix in quickly is a priority

@tilladam

Copy link
Copy Markdown
Contributor

For reference, the impact on real-world workloads is very real. Using rust-lang/rustc-perf#2601 from rust-lang/rust#159933, the (AI assisted) benchmarks yield:

Compared PR head a9170a97e6 with its direct parent ea09c7b724, using AP 0.166, and nightly-2026-08-17 on arm64 macOS.

Median inference time, three runs per variant:

Workload Parent PR Speedup
Slint generated body 11.894s 3.186s 3.73×
RA prefill 8.381s 4.003s 2.09×
RA workspace 23.980s 15.288s 1.57×
Delayed-type Vec, N=8000 111.312s 80.297s 1.39×
HashMap, N=8000 84.714s 19.545s 4.33×

The improvement is substantial, but scaling remains approximately quadratic: N=4000 → N=8000 costs 4.02× for patched Vec and 3.91× for patched HashMap.

These are batch-analysis results with build scripts and procedural macros disabled. Slint’s whole-process speedup was 1.41×; incremental editor behavior was not measured

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

I object to any change to the next solver until we sync or unless @ada4a specifically approves it. I also object specifically to this one since upstream fulfillment is already shared between rustc and r-a.

@ada4a

ada4a commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

I object to any change to the next solver until we sync or unless @ada4a specifically approves it.

I frankly still lack the knowledge to make a decision, so I'll trust your judgement.

upstream fulfillment is already shared between rustc and r-a.

Just for my understanding: by this you mean that we copy-paste rustc code here, right? AFAICT the code comes from https://github.com/rust-lang/rust/blob/f01f1dda4a792e18fe1a2ae6a5f205cc2b9d3c97/compiler/rustc_trait_selection/src/solve/fulfill.rs, and rustc_trait_selection isn't one of the shared crates (yet?)

@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Just for my understanding: by this you mean that we copy-paste rustc code here, right? AFAICT the code comes from https://github.com/rust-lang/rust/blob/f01f1dda4a792e18fe1a2ae6a5f205cc2b9d3c97/compiler/rustc_trait_selection/src/solve/fulfill.rs, and rustc_trait_selection isn't one of the shared crates (yet?)

It appears I was wrong, that PR (rust-lang/rust#160485) isn't merged yet. It's still about to be.

@ada4a

ada4a commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

rust-lang/rust#160485

Ohh, exciting:)) I kinda wonder whether that makes it more okay to make some temporary changes to our fulfill.rs (like in this PR), given that we'll delete the whole file anyway once rust-lang/rust#160485 lands. But again, no preference either way.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants