Shader cache: the host max wave is part of the key #379

Closed
github-bot wants to merge 1 commit from gh-pr/379/head into gh-pr/379/base
Owner

@⁠Melow-code on GitHub · 2026-11-25 00:10 UTC · original
fix/shader-cache-host-max-wave → main · +98 −26 · 2 files · 1 commits · closed without merging

The shader cache key covered our executable, the loop limit, which group barriers wait, the wave-form switches and the clean-up passes — but not the host GPU's maximum wave size, which the device creation sets and the lowering reads. A cache built on an AMD GPU (64-lane waves) served its wave64 translations to an NVIDIA GPU (32-lane waves): the driver refused the PSO, or the shader ran with wrong lane semantics. Reported upstream in VIctory #1844, written with Claude Code; this fix was developed with DeepSeek V4 Pro (OpenCode).

The key now carries the host max wave too, 0 before a device exists. The parts of the key moved into a pure key_bytes, so a test can cover them without a device: the same settings make one key, a changed loop limit another, a changed view-heap null slot another, and 32, 64 and 0 lanes three keys. The host max wave also has its own accessor in the emit of victory-shader, next to the loop limit and the other settings the cache keys on. Rebased on main after the view-heap clamp of #31714de landed: key_bytes carries that limit too.

Verification

  • cargo test --locked -p victory-shader --lib on Linux: 171 passed, two ignored.
  • The new the_key_covers_the_host_max_wave covers the key bytes without a device: the same settings make one key, a changed loop limit another, a changed view-heap null slot another, and 32, 64 and 0 lanes three keys.

The victory-gpu crate is Windows-gated; its build and the GPU cache run need a Windows host, outside this run.

Assisted-by: DeepSeek V4 Pro (OpenCode)

**@⁠Melow-code** on GitHub · 2026-11-25 00:10 UTC · [original](https://github.com/fxceless/victory-fork/pull/379) `fix/shader-cache-host-max-wave` → `main` · +98 −26 · 2 files · 1 commits · closed without merging The shader cache key covered our executable, the loop limit, which group barriers wait, the wave-form switches and the clean-up passes — but not the host GPU's maximum wave size, which the device creation sets and the lowering reads. A cache built on an AMD GPU (64-lane waves) served its wave64 translations to an NVIDIA GPU (32-lane waves): the driver refused the PSO, or the shader ran with wrong lane semantics. Reported upstream in [VIctory #1844](https://github.com/Marvisak/VIctory/issues/1844), written with Claude Code; this fix was developed with DeepSeek V4 Pro (OpenCode). The key now carries the host max wave too, `0` before a device exists. The parts of the key moved into a pure `key_bytes`, so a test can cover them without a device: the same settings make one key, a changed loop limit another, a changed view-heap null slot another, and 32, 64 and 0 lanes three keys. The host max wave also has its own accessor in the emit of `victory-shader`, next to the loop limit and the other settings the cache keys on. Rebased on `main` after the view-heap clamp of #31714de landed: `key_bytes` carries that limit too. ## Verification - `cargo test --locked -p victory-shader --lib` on Linux: 171 passed, two ignored. - The new `the_key_covers_the_host_max_wave` covers the key bytes without a device: the same settings make one key, a changed loop limit another, a changed view-heap null slot another, and 32, 64 and 0 lanes three keys. The `victory-gpu` crate is Windows-gated; its build and the GPU cache run need a Windows host, outside this run. Assisted-by: DeepSeek V4 Pro (OpenCode)
A shader cache built on an AMD GPU (64-lane waves) served its wave64
translations to an NVIDIA GPU (32-lane waves): the driver refused the
PSO, or the shader ran with wrong lane semantics. The key covered our
executable, the loop limit, which group barriers wait, the wave form
switches and the clean-up passes, but not the maximum wave size of the host GPU, which the device
creation sets and the lowering reads
(`host_max_wave` in issue 1844).

The key now carries the host max wave too, `0` before a device exists.
The parts of the key moved into a pure `key_bytes`, so a test can cover them
without a device: the same settings make one key, a changed loop limit
another, and 32, 64 and 0 lanes three keys.

The host max wave now also has its own accessor in the emit of
`victory-shader`, next to the loop limit and the other settings the
cache keys on.

Claude Code wrote the issue report. DeepSeek V4 Pro (OpenCode) wrote
this fix.

Assisted-by: DeepSeek V4 Pro (OpenCode)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:42:02 +00:00
github-bot closed this pull request 2026-11-26 03:42:02 +00:00
Author
Owner

@⁠Melow-code on GitHub · 2026-11-25 12:02 UTC · original

Superseded by upstream's own fix: translation_fingerprint in the shader crate now includes host_max_wave and view_heap_limit, and the cache key works per lookup, so a translation made before the device said its wave size is never filed under the later key. Closing this one — the maintainer's solution is the better shape. Thanks for the review.

**@⁠Melow-code** on GitHub · 2026-11-25 12:02 UTC · [original](https://github.com/fxceless/victory-fork/pull/379#issuecomment-7161845825) Superseded by upstream's own fix: `translation_fingerprint` in the shader crate now includes `host_max_wave` and `view_heap_limit`, and the cache key works per lookup, so a translation made before the device said its wave size is never filed under the later key. Closing this one — the maintainer's solution is the better shape. Thanks for the review.
Author
Owner

@⁠Melow-code on GitHub · 2026-11-25 12:03 UTC · original

Superseded upstream: main now keys the cache on translation_fingerprint(), which carries host_max_wave() and view_heap_limit() and is worked out per lookup, so a translation made before the device said its wave size is never filed under the later key. That covers this PR's fix in the maintainer's own shape (8dd30ab). Closing this one — no rebase needed, the bug is closed in main.

**@⁠Melow-code** on GitHub · 2026-11-25 12:03 UTC · [original](https://github.com/fxceless/victory-fork/pull/379#issuecomment-7161855984) Superseded upstream: main now keys the cache on `translation_fingerprint()`, which carries `host_max_wave()` and `view_heap_limit()` and is worked out per lookup, so a translation made before the device said its wave size is never filed under the later key. That covers this PR's fix in the maintainer's own shape (8dd30ab). Closing this one — no rebase needed, the bug is closed in main.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.