Shader cache: precompile tells from its own call whether it translated (#32) #192

Open
HamudL wants to merge 3 commits from upstream-pr/192 into main
HamudL commented 2026-11-26 11:05:35 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by HamudL on 2026-11-26T11:05:35Z.


Closes #32.

precompile compared the global miss counter before and after its call. With translate --warm on several threads (four by default), another thread's miss in between made a cache hit count as "translated now", so the warm-up's split between translated and cached was wrong.

cached_ran now returns whether its own call ran the converter: a miss, an entry of an earlier build that was translated again with refresh, or an entry that did not read back. cached and cached_by keep their signatures.

New test each_call_tells_whether_it_translated: another call's miss between two calls for the same container leaves the second a hit, and entries of an earlier build are served or refreshed as expected.

Checked: cargo clippy -p victory-gpu --all-targets [--all-features] --target x86_64-pc-windows-msvc -- -D warnings is clean. The shader-cache tests (all 4, the new one included) pass on Linux in a copy of the module with the D3D12 calls stubbed out, since victory-gpu itself only builds on Windows.

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6625277755 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/192). Originally posted by [HamudL](https://github.com/HamudL) on 2026-11-26T11:05:35Z. --- Closes #32. `precompile` compared the global miss counter before and after its call. With `translate --warm` on several threads (four by default), another thread's miss in between made a cache hit count as "translated now", so the warm-up's split between translated and cached was wrong. `cached_ran` now returns whether its own call ran the converter: a miss, an entry of an earlier build that was translated again with `refresh`, or an entry that did not read back. `cached` and `cached_by` keep their signatures. New test `each_call_tells_whether_it_translated`: another call's miss between two calls for the same container leaves the second a hit, and entries of an earlier build are served or refreshed as expected. Checked: `cargo clippy -p victory-gpu --all-targets [--all-features] --target x86_64-pc-windows-msvc -- -D warnings` is clean. The shader-cache tests (all 4, the new one included) pass on Linux in a copy of the module with the D3D12 calls stubbed out, since victory-gpu itself only builds on Windows.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/192:upstream-pr/192'
git switch 'upstream-pr/192'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/192'
git switch 'upstream-pr/192'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/192'
git switch 'upstream-pr/192'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/192'
git switch 'main'
git merge --squash 'upstream-pr/192'
git switch 'main'
git merge --ff-only 'upstream-pr/192'
git switch 'main'
git merge 'upstream-pr/192'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
avatarmanz/VIctory-7900XTX!192
No description provided.