Keep the shader cache warm across emitter test edits #1908

Open
github-bot wants to merge 4 commits from github-bot/gh-1908 into main AGit
Owner

@⁠necrobytes on GitHub · 2026-11-25 00:38 UTC · original
necrobytes:fix/shader-cache-test-sources → main · +80 −12 · 13 files · 4 commits · open

Editing one of the Windows emitter tests sends the next build to an empty shader cache. I reproduced this on main by warming the cache with two synthetic compute shaders, applying only the test additions from #1877, and rebuilding. Both shaders missed, and both compiled to exactly the same DXIL as before.

This marks the nine standalone emitter test modules with a leading #![cfg(test)]. The translator fingerprint skips Rust sources with that explicit guard. Removing the guard puts the file back in the fingerprint, including when its name still ends in _tests.rs. Adopting this change causes one cache rebuild because the build script itself is part of the fingerprint.

I repeated the check in separate release processes on Linux with Rust 1.98.1.

Change after warming the cache Cache hits DXIL for the two shaders
Apply the test additions from #1877 2/2 Both byte-for-byte identical
Change production compute workgroup lowering 0/2 Both changed
Restore the original lowering 2/2 Both matched the original output

The new regression edits a copy of the real valu_tests.rs, changes a translator source, and removes the test guard. It fails at the test-only edit assertion when the build script hashes every source as on main.

  • cargo test --locked -p victory-shader on Linux passed 145 tests, including the new regression. Two existing tests were marked ignored.
  • Workspace Clippy passed for x86_64-pc-windows-msvc with all targets and warnings denied, both with default features and with --all-features. The repository asset-policy check passed.

Tracked as NEW-47. Claim in #1633

Implemented and tested with Codex.

**@⁠necrobytes** on GitHub · 2026-11-25 00:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/1908) `necrobytes:fix/shader-cache-test-sources` → `main` · +80 −12 · 13 files · 4 commits · open Editing one of the Windows emitter tests sends the next build to an empty shader cache. I reproduced this on `main` by warming the cache with two synthetic compute shaders, applying only the test additions from #1877, and rebuilding. Both shaders missed, and both compiled to exactly the same DXIL as before. This marks the nine standalone emitter test modules with a leading `#![cfg(test)]`. The translator fingerprint skips Rust sources with that explicit guard. Removing the guard puts the file back in the fingerprint, including when its name still ends in `_tests.rs`. Adopting this change causes one cache rebuild because the build script itself is part of the fingerprint. I repeated the check in separate release processes on Linux with Rust 1.98.1. | Change after warming the cache | Cache hits | DXIL for the two shaders | | --- | ---: | --- | | Apply the test additions from #1877 | 2/2 | Both byte-for-byte identical | | Change production compute workgroup lowering | 0/2 | Both changed | | Restore the original lowering | 2/2 | Both matched the original output | The new regression edits a copy of the real `valu_tests.rs`, changes a translator source, and removes the test guard. It fails at the test-only edit assertion when the build script hashes every source as on `main`. - `cargo test --locked -p victory-shader` on Linux passed 145 tests, including the new regression. Two existing tests were marked ignored. - Workspace Clippy passed for `x86_64-pc-windows-msvc` with all targets and warnings denied, both with default features and with `--all-features`. The repository asset-policy check passed. Tracked as `NEW-47`. [Claim in #1633](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) Implemented and tested with Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:48:25 +00:00
Author
Owner

@⁠necrobytes on GitHub · 2026-11-25 00:48 UTC · original

I updated this branch to include upstream’s Windows test change, 42363ab, and compared the hosted run on the new PR head (1a0d45c) with the run on that exact base. Both Clippy steps passed. The shader unit suite reported 244 passed, 2 failed, and 3 ignored on both revisions, with the same diagnostics.

  • gathers_at_a_level_match_the_hardware got [66, 67, 35, 34] for lane 4 and expected [65, 66, 34, 33].
  • permutes_read_the_lane_named_and_zero_from_lanes_left_out reported hardware: no pipeline for a wave of 32.

The hosted workspace run stopped before the new integration test. I ran that test separately on the final PR head on Linux and as a Windows executable under Wine 11.21. It passed on both. I also repeated the release cache probe on that head. The test-only change kept both cache hits, and the production edit recompiled both shaders. PR run · Base run

**@⁠necrobytes** on GitHub · 2026-11-25 00:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1908#issuecomment-7148898284) I updated this branch to include upstream’s Windows test change, `42363ab`, and compared the hosted run on the new PR head (`1a0d45c`) with the run on that exact base. Both Clippy steps passed. The shader unit suite reported 244 passed, 2 failed, and 3 ignored on both revisions, with the same diagnostics. - `gathers_at_a_level_match_the_hardware` got `[66, 67, 35, 34]` for lane 4 and expected `[65, 66, 34, 33]`. - `permutes_read_the_lane_named_and_zero_from_lanes_left_out` reported `hardware: no pipeline for a wave of 32`. The hosted workspace run stopped before the new integration test. I ran that test separately on the final PR head on Linux and as a Windows executable under Wine 11.21. It passed on both. I also repeated the release cache probe on that head. The test-only change kept both cache hits, and the production edit recompiled both shaders. [PR run](https://github.com/Marvisak/VIctory/actions/runs/45520421209) · [Base run](https://github.com/Marvisak/VIctory/actions/runs/45520251168)
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 08:20 UTC · original · edited 2026-11-25 20:20 UTC

Automated triage for the maintainers.

Needs work: this needs the maintainer's decision (unchanged). The new head 8f9e528 is only a merge of main into the branch. The PR's own diff is byte-for-byte the same as the previously triaged head 32a7b7b, so the earlier reading stands.

crates/victory-shader/build.rs moves the hashing into source_hash, which skips src/**.rs files that begin with #[cfg(test)]. The nine emit/*_tests.rs modules get that guard, and tests/source_hash.rs checks three cases: a test-only edit keeps the hash, a translator edit changes it, and removing the guard puts the file back in the hash. tempfile becomes a dev-dependency (Cargo.toml, Cargo.lock). By my reading the logic is sound, but changes to the build script and to dependencies are left to the maintainer by policy.

The open questions for the maintainer are the same:

  • Is a leading #[cfg(test)] the convention wanted for keeping the shader cache warm?
  • Should the test use tempfile or std::env::temp_dir()?

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 08:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/1908#issuecomment-7156898623) · edited 2026-11-25 20:20 UTC <!-- victory-triage v1 head=8f9e5281ac66d6e7e24ccd07200299e677a03977 verdict=needs-work at=2026-11-25T20:18:54Z --> Automated triage for the maintainers. **Needs work: this needs the maintainer's decision (unchanged).** The new head `8f9e528` is only a merge of `main` into the branch. The PR's own diff is byte-for-byte the same as the previously triaged head `32a7b7b`, so the earlier reading stands. `crates/victory-shader/build.rs` moves the hashing into `source_hash`, which skips `src/**.rs` files that begin with `#[cfg(test)]`. The nine `emit/*_tests.rs` modules get that guard, and `tests/source_hash.rs` checks three cases: a test-only edit keeps the hash, a translator edit changes it, and removing the guard puts the file back in the hash. `tempfile` becomes a dev-dependency (`Cargo.toml`, `Cargo.lock`). By my reading the logic is sound, but changes to the build script and to dependencies are left to the maintainer by policy. The open questions for the maintainer are the same: - Is a leading `#[cfg(test)]` the convention wanted for keeping the shader cache warm? - Should the test use `tempfile` or `std::env::temp_dir()`? CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 11:32 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 32a7b7b6 onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 11:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/1908#issuecomment-7161173788) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 32a7b7b6 onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1908/head:github-bot/gh-1908'
git switch 'github-bot/gh-1908'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1908'
git switch 'github-bot/gh-1908'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1908'
git switch 'github-bot/gh-1908'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1908'
git switch 'main'
git merge --squash 'github-bot/gh-1908'
git switch 'main'
git merge --ff-only 'github-bot/gh-1908'
git switch 'main'
git merge 'github-bot/gh-1908'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1908
No description provided.