Skip to content

Feed query values under state lock - #162515

Open
aerooneqq wants to merge 5 commits into
rust-lang:mainfrom
aerooneqq:query-feeding-value-ice
Open

aerooneqq wants to merge 5 commits into
rust-lang:mainfrom
aerooneqq:query-feeding-value-ice

Conversation

@aerooneqq

@aerooneqq aerooneqq commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

Fixes #162316.

The issue did not reproduced during ~100k launches locally. No significant perf changes on random benchmarks locally, but worth perf run anyway. Explanation can be found in comment.

No llms used.

@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 Sep 9, 2026
@rustbot

rustbot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

r? @mejrs

rustbot has assigned @mejrs.
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, query-system
  • compiler, query-system expanded to 76 candidates
  • Random selection from 22 candidates

@aerooneqq
aerooneqq force-pushed the query-feeding-value-ice branch from 69509ff to 5c2931a Compare September 9, 2026 09:17
@rustbot

This comment has been minimized.

@petrochenkov

Copy link
Copy Markdown
Contributor

@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 Sep 9, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 9, 2026
@rust-bors

rust-bors Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 176a6a0 (176a6a0804d5fc03409482239ff18cbbb04c3eee)
Base parent: 1edd55d (1edd55dcfcd573872c727fa3e086369a71661ee0)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (176a6a0): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@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.2% [0.1%, 0.3%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.5%, secondary -1.3%)

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

mean range count
Regressions ❌
(primary)
1.9% [0.6%, 3.1%] 2
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 2
Improvements ✅
(primary)
-0.9% [-1.2%, -0.5%] 2
Improvements ✅
(secondary)
-3.6% [-3.8%, -3.4%] 2
All ❌✅ (primary) 0.5% [-1.2%, 3.1%] 4

Cycles

Results (primary -0.6%, secondary -1.1%)

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

mean range count
Regressions ❌
(primary)
0.6% [0.5%, 0.7%] 3
Regressions ❌
(secondary)
4.3% [3.7%, 5.1%] 4
Improvements ✅
(primary)
-0.9% [-2.6%, -0.4%] 14
Improvements ✅
(secondary)
-3.8% [-6.6%, -2.3%] 8
All ❌✅ (primary) -0.6% [-2.6%, 0.7%] 17

Binary size

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

Bootstrap: 481.679s -> 480.794s (-0.18%)
Artifact size: 403.98 MiB -> 403.35 MiB (-0.16%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 9, 2026
@Zoxc

Zoxc commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

We should indeed check the cache under the lock. Not sure about the with_feed_task call inside the lock, normally we don't hold these locks during tasks.

@aerooneqq

Copy link
Copy Markdown
Contributor Author

Not sure about the with_feed_task call inside the lock, normally we don't hold these locks during tasks.

I put it inside the lock so it won't be executed more than once if several threads will be feeding the same query and key. As far as I understand when executing query in incremental mode, in execute_job_incr we access with_task without lock, but query system guarantees that there will be only one execution for query and key, however we don't have this guarantee while feeding.

@Zoxc

Zoxc commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

I looked into it a bit more and there's probably too much code being executed in the lock.

We probably want to instead create a QueryJob to hold while executing, like try_execute_query does for regular queries. That may have some interactions with query cycle detection. We could also skip the first try_get_cached check and only check inside the look, as I expect the first one to not be hot enough to bother.

@mejrs

mejrs commented Sep 12, 2026

Copy link
Copy Markdown
Member

r? petrochenkov

@rustbot rustbot assigned petrochenkov and unassigned mejrs Sep 12, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

Waiting on author to respond to #162515 (comment).
@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 13, 2026
@rustbot

rustbot commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 13, 2026
@aerooneqq
aerooneqq force-pushed the query-feeding-value-ice branch from 5c2931a to 370fe51 Compare September 29, 2026 15:20
@rustbot rustbot added the A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) label Sep 29, 2026
@rustbot

This comment has been minimized.

@aerooneqq
aerooneqq force-pushed the query-feeding-value-ice branch from 370fe51 to 38ecc8e Compare October 20, 2026 15:24
rust-bors Bot pushed a commit that referenced this pull request Nov 16, 2026
@rust-bors

rust-bors Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 4ffc080 (4ffc0801c48139e5dd4fe0ebe8ab180da86174a5)
Base parent: 5fb8a16 (5fb8a16f5f8244f9fbfe696487a9da223168a6c7)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (4ffc080): comparison URL.

Overall result: ❌✅ regressions and improvements - 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 @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@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.3% [0.2%, 0.5%] 24
Regressions ❌
(secondary)
0.3% [0.1%, 0.4%] 49
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.5%, -0.0%] 9
All ❌✅ (primary) 0.3% [0.2%, 0.5%] 24

Max RSS (memory usage)

Results (primary 2.5%, secondary 7.1%)

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

mean range count
Regressions ❌
(primary)
2.5% [2.5%, 2.5%] 1
Regressions ❌
(secondary)
7.1% [7.1%, 7.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.5% [2.5%, 2.5%] 1

Cycles

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

Binary size

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

Bootstrap: 466.4s -> 468.117s (0.37%)
Artifact size: 406.11 MiB -> 406.49 MiB (0.09%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 16, 2026
@aerooneqq
aerooneqq force-pushed the query-feeding-value-ice branch from 52e8ba4 to aab6b00 Compare November 24, 2026 09:23
@rustbot

rustbot commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@aerooneqq

Copy link
Copy Markdown
Contributor Author

@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 Nov 24, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: dfff334 (dfff3346c19356df064339ef4316a8158a76837e)
Base parent: 058c701 (058c701055c4b6f60f622d616afc0349911c38c3)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (dfff334): comparison URL.

Overall result: ❌✅ regressions and improvements - 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 @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@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.3% [0.1%, 0.8%] 31
Regressions ❌
(secondary)
0.3% [0.0%, 0.4%] 47
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.5%, -0.2%] 4
All ❌✅ (primary) 0.3% [0.1%, 0.8%] 31

Max RSS (memory usage)

Results (primary -3.2%, secondary 3.9%)

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)
3.9% [3.9%, 3.9%] 1
Improvements ✅
(primary)
-3.2% [-3.2%, -3.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -3.2% [-3.2%, -3.2%] 1

Cycles

Results (primary 2.5%, secondary 2.7%)

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

mean range count
Regressions ❌
(primary)
2.5% [1.9%, 3.0%] 3
Regressions ❌
(secondary)
2.7% [2.7%, 2.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.5% [1.9%, 3.0%] 3

Binary size

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

Bootstrap: 462.461s -> 465.152s (0.58%)
Artifact size: 405.65 MiB -> 406.73 MiB (0.26%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 24, 2026
@aerooneqq

Copy link
Copy Markdown
Contributor Author

@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 Nov 27, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
@rust-bors

rust-bors Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 545d7ba (545d7ba06294d4c87bc981589f088d8e3cf81e71)
Base parent: b8794ab (b8794ab3b96cbe1cd0698ecec35b7ffcedc9e995)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (545d7ba): 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 @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@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.3% [0.1%, 0.5%] 21
Regressions ❌
(secondary)
0.3% [0.1%, 0.4%] 35
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.1%, 0.5%] 21

Max RSS (memory usage)

Results (primary 2.7%, secondary 0.5%)

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

mean range count
Regressions ❌
(primary)
2.7% [1.9%, 3.5%] 2
Regressions ❌
(secondary)
0.5% [0.4%, 0.7%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.7% [1.9%, 3.5%] 2

Cycles

Results (primary 2.1%, secondary 0.6%)

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

mean range count
Regressions ❌
(primary)
2.1% [2.1%, 2.1%] 1
Regressions ❌
(secondary)
1.4% [0.4%, 2.2%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.7% [-2.8%, -0.7%] 2
All ❌✅ (primary) 2.1% [2.1%, 2.1%] 1

Binary size

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

Bootstrap: 461.156s -> 463.389s (0.48%)
Artifact size: 405.64 MiB -> 406.01 MiB (0.09%)

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

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

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

Flaky failure in query feeding on the parallel compiler: caller raced calls to put()

7 participants