Skip to content

Add offload guard flags to typeck to prevent perf regressions - #160454

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Sa4dUs:offload-fix-perf
Aug 4, 2026
Merged

Add offload guard flags to typeck to prevent perf regressions#160454
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Sa4dUs:offload-fix-perf

Conversation

@Sa4dUs

@Sa4dUs Sa4dUs commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Fixes perf regression in #158693

r? @ZuseZ4

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 3, 2026
@rustbot

rustbot commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 19 candidates

@rustbot rustbot assigned ZuseZ4 and unassigned chenyukang Aug 3, 2026
@ZuseZ4

ZuseZ4 commented Aug 3, 2026

Copy link
Copy Markdown
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 3, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 3, 2026
Add offload guard flags to typeck to prevent perf regressions
@rust-bors

rust-bors Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 48beb0f (48beb0fedb77a7ebf93b8a3b81bb05446f2c00d5)
Base parent: 7c329d6 (7c329d6c76e11ca40c5673818ab0439c1be8962c)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (48beb0f): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@bors rollup=never rustc-perf
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.2%] 10
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -2.6%, secondary -0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.7% [1.0%, 4.8%] 3
Improvements ✅
(primary)
-2.6% [-4.4%, -0.8%] 2
Improvements ✅
(secondary)
-1.7% [-5.6%, -0.5%] 5
All ❌✅ (primary) -2.6% [-4.4%, -0.8%] 2

Cycles

Results (primary 0.1%, secondary 6.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.2% [0.5%, 2.0%] 6
Regressions ❌
(secondary)
8.2% [0.4%, 19.8%] 20
Improvements ✅
(primary)
-1.2% [-2.0%, -0.5%] 5
Improvements ✅
(secondary)
-3.3% [-5.0%, -1.2%] 3
All ❌✅ (primary) 0.1% [-2.0%, 2.0%] 11

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 491.018s -> 491.074s (0.01%)
Artifact size: 390.29 MiB -> 391.01 MiB (0.18%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 3, 2026
@ZuseZ4

ZuseZ4 commented Aug 4, 2026

Copy link
Copy Markdown
Member

One more location to try is #158693 (comment)

@panstromek GPU support unfortunately requires us to compile the same file 3 times, two of those for the same cpu target. So it's preferable to cache those checks where sensible.
Other than that, many-assoc-items cancels out precisely 1.0059 × (1−0.0054)=1.00046814, as well as derive `+/- 0.16%). Not sure about include-blob; maybe the last location I linked has an impact there? It also just had a huge improvement (33%), maybe that perturbed the significance numbers? There's also another 20% improvement coming up: #160453

@panstromek

panstromek commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Yea, this looks great, thanks for looking into this so quickly. Detailed results show that the query hits are exactly inverse, too: before, after, same with dep graph sizes.

include-blob is probably noise, that one is bimodal, and it flips flops between two states pretty often, I think we can ignore that one. I wasn't sure whether the derive is relevant in the original, too (it's 300 structs), but good to see it improved (and I see now that it has a bunch of new query hits in the original, so it was probably relevant as well).

@ZuseZ4

ZuseZ4 commented Aug 4, 2026

Copy link
Copy Markdown
Member

perfect, then I guess all relevant locations are covered
@bors r+ rollup=iffy Perf positive, but long queue

@rust-bors

rust-bors Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit e04a81f has been approved by ZuseZ4

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 10. This pull request will be tested once the tree is reopened.

Reason for tree closure: manually handling queue due to backlog

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 4, 2026
…uwer

Rollup of 10 perf-sensitive pull requests

Successful merges:

 - #157281 (perf: skip irrelevant foreign impls when building the specialization graph)
 - #159403 (Next steps for FnDef binder changes (instantiate most FnDef binders))
 - #159763 (Optimize crate resolution for large workspace)
 - #160033 (Speed up `EverInitializedPlaces`)
 - #160268 (perf: store the fulfillment engine inline in ObligationCtxt)
 - #160317 (perf: Cache already-checked types in the privacy visitor)
 - #160399 (interpret: skip deref-projection validity checks when they are not needed)
 - #160451 (Deduplicate target and host filesearch)
 - #160453 (Add fast path to `escape_string_symbol`)
 - #160454 (Add offload guard flags to typeck to prevent perf regressions)
@rust-bors
rust-bors Bot merged commit d1cef67 into rust-lang:main Aug 4, 2026
14 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 4, 2026
rust-timer added a commit that referenced this pull request Aug 4, 2026
Rollup merge of #160454 - Sa4dUs:offload-fix-perf, r=ZuseZ4

Add offload guard flags to typeck to prevent perf regressions

Fixes perf regression in #158693

r? @ZuseZ4
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

Verifying that actual perf results after merge match expected results
@rust-timer build d41deaa

@rust-timer

This comment has been minimized.

WhySoBad pushed a commit to WhySoBad/miri that referenced this pull request Aug 5, 2026
…uwer

Rollup of 10 perf-sensitive pull requests

Successful merges:

 - rust-lang/rust#157281 (perf: skip irrelevant foreign impls when building the specialization graph)
 - rust-lang/rust#159403 (Next steps for FnDef binder changes (instantiate most FnDef binders))
 - rust-lang/rust#159763 (Optimize crate resolution for large workspace)
 - rust-lang/rust#160033 (Speed up `EverInitializedPlaces`)
 - rust-lang/rust#160268 (perf: store the fulfillment engine inline in ObligationCtxt)
 - rust-lang/rust#160317 (perf: Cache already-checked types in the privacy visitor)
 - rust-lang/rust#160399 (interpret: skip deref-projection validity checks when they are not needed)
 - rust-lang/rust#160451 (Deduplicate target and host filesearch)
 - rust-lang/rust#160453 (Add fast path to `escape_string_symbol`)
 - rust-lang/rust#160454 (Add offload guard flags to typeck to prevent perf regressions)
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (d41deaa): comparison URL.

Overall result: ✅ improvements - no action needed

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.

@bors rollup=never rustc-perf
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.5%, -0.2%] 10
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.5%, secondary 0.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.5% [0.4%, 0.6%] 4
Regressions ❌
(secondary)
2.2% [0.6%, 5.0%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.0% [-1.2%, -0.8%] 3
All ❌✅ (primary) 0.5% [0.4%, 0.6%] 4

Cycles

Results (primary 0.4%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.3% [0.5%, 2.5%] 6
Regressions ❌
(secondary)
1.1% [0.4%, 2.6%] 8
Improvements ✅
(primary)
-0.7% [-1.0%, -0.4%] 5
Improvements ✅
(secondary)
-1.2% [-2.7%, -0.4%] 6
All ❌✅ (primary) 0.4% [-1.0%, 2.5%] 11

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 489.577s -> 489.898s (0.07%)
Artifact size: 390.24 MiB -> 390.29 MiB (0.01%)

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

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants