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

Closed
Melow-code wants to merge 1 commit from upstream-pr/379 into main
Melow-code commented 2026-11-25 00:10:27 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Melow-code on 2026-11-25T00:10:27Z.


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)

<!-- greyfinch-sync:fxceless/victory-fork:issue:6594077080 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/379). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-25T00:10:27Z. --- 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)
upstream-sync closed this pull request 2026-11-25 12:06:46 +00:00
Melow-code commented 2026-11-25 12:07:05 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Melow-code on 2026-11-25T12:02:47Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7161845825 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/379#issuecomment-7161845825). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-25T12:02:47Z. --- 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 commented 2026-11-25 12:07:05 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Melow-code on 2026-11-25T12:03:14Z.


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.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7161855984 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/379#issuecomment-7161855984). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-25T12:03:14Z. --- 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

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
fxceless/victory-fork!379
No description provided.