GPU: the "shader does not translate" warning names where its value was made #1578

Open
github-bot wants to merge 2 commits from github-bot/gh-1578 into main AGit
Owner

@⁠ThomasSAMP on GitHub · 2026-11-24 19:26 UTC · original
ThomasSAMP:shader/runtime-refusal-origin → main · +315 −44 · 5 files · 2 commits · open

Depends on: #1425 (this branch is stacked on it; the diff to review is the last commit, 8631598).

What

When the runtime cannot translate a shader, it logs it once with shader does not translate; its pipelines' draws are dropped ... error=, and testers rank dropped draws from that line (#293, #1317). For a refusal that comes from a missing value, the error names only the instruction that needed the value. #1425 found the instruction that made it, but only for victory translate. This brings that origin to the runtime:

  • emit::translate_traced returns a Refusal (from #1425) instead of a ShaderError. Refusal now implements Display: the error, then (made by <instruction> at <offset>) when there is an origin.
  • shader_cache::host_shader translates through it, so the warning reads, for example, ... a cross-lane operation outside compute is not supported (made by v_writelane_b32 at 0x52c).
  • emit::translate, ShaderError and the shader cache's encoding are unchanged. Translation errors are not stored in the cache, so no cache entry changes.

Tests

  • New test emit::tests::a_refusal_says_where_its_missing_value_was_made. A synthetic compute program reads an s_memtime timestamp and branches on it. It goes through emit_traced, and the test checks that the origin is s_memtime at 0x0, that the refusal is at the branch (0xc), and that the text is the error followed by (made by s_memtime at 0x0). It also checks that without an origin the text is the error's own. Like #604's test, it tolerates timestamps lowering one day.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean.
  • cargo test --workspace --locked: 345 passed, 0 failed, 6 ignored.
  • cargo xtask policy: 154 files ok. git diff --check: clean.
  • Machine: Windows 11 Pro (build 26300), AMD Radeon RX 9070 XT (driver 32.0.32029.2010) and WARP, Rust 1.98.1.
  • Side note: frame::tests::waits_end_on_ticks_and_count_frames failed consistently while the machine was fully loaded (a CPU-bound job on every core: ticks [10, 12, 13, 14]). It passed once the load was gone. It counts real 5 ms ticks, so it looks timing-sensitive rather than broken.

No game data in the diff or the tests.

AI-assisted: written with Claude Code (Claude Opus 5.5) and reviewed by me.

🤖 Generated with Claude Code

**@⁠ThomasSAMP** on GitHub · 2026-11-24 19:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1578) `ThomasSAMP:shader/runtime-refusal-origin` → `main` · +315 −44 · 5 files · 2 commits · open Depends on: #1425 (this branch is stacked on it; the diff to review is the last commit, `8631598`). ## What When the runtime cannot translate a shader, it logs it once with `shader does not translate; its pipelines' draws are dropped ... error=`, and testers rank dropped draws from that line (#293, #1317). For a refusal that comes from a missing value, the error names only the instruction that needed the value. #1425 found the instruction that made it, but only for `victory translate`. This brings that origin to the runtime: - `emit::translate_traced` returns a `Refusal` (from #1425) instead of a `ShaderError`. `Refusal` now implements `Display`: the error, then ` (made by <instruction> at <offset>)` when there is an origin. - `shader_cache::host_shader` translates through it, so the warning reads, for example, `... a cross-lane operation outside compute is not supported (made by v_writelane_b32 at 0x52c)`. - `emit::translate`, `ShaderError` and the shader cache's encoding are unchanged. Translation errors are not stored in the cache, so no cache entry changes. ## Tests - New test `emit::tests::a_refusal_says_where_its_missing_value_was_made`. A synthetic compute program reads an `s_memtime` timestamp and branches on it. It goes through `emit_traced`, and the test checks that the origin is `s_memtime at 0x0`, that the refusal is at the branch (`0xc`), and that the text is the error followed by `(made by s_memtime at 0x0)`. It also checks that without an origin the text is the error's own. Like #604's test, it tolerates timestamps lowering one day. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`: clean. - `cargo test --workspace --locked`: 345 passed, 0 failed, 6 ignored. - `cargo xtask policy`: 154 files ok. `git diff --check`: clean. - Machine: Windows 11 Pro (build 26300), AMD Radeon RX 9070 XT (driver 32.0.32029.2010) and WARP, Rust 1.98.1. - Side note: `frame::tests::waits_end_on_ticks_and_count_frames` failed consistently while the machine was fully loaded (a CPU-bound job on every core: ticks `[10, 12, 13, 14]`). It passed once the load was gone. It counts real 5 ms ticks, so it looks timing-sensitive rather than broken. No game data in the diff or the tests. AI-assisted: written with Claude Code (Claude Opus 5.5) and reviewed by me. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A value the emitter has no DXIL form for is kept as missing and only
stops the program where something with an effect needs it: a branch, an
export, a store. The refusal was reported there, so `translate --list`
named the consumer (an s_cbranch_execz, a v_mul_legacy_f32) rather than
the cause (a v_writelane_b32 spilling an SGPR, a descriptor dword carried
through joins).

Lowering now records, for every missing value, the instruction that made
it: the one whose refusal made it missing, or, when that instruction only
read a missing value, that value's origin. Phis refused on retry keep the
origin of their incoming value, and lane masks whose compare failed keep
theirs. Inputs and lane-mask joins have none.

`emit::emit_traced` returns the refusal with its origin; `emit` and
`ShaderError` are unchanged. `victory translate --list` appends
`from <instruction> at <offset>` to the example of an emit refusal and
prints a `made by` breakdown under each reason. Reason keys and every
count stay the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A shader the runtime cannot translate is logged once with the error,
and testers rank dropped draws by that line (#293). For a refusal that
comes from a missing value the error named only the consumer that needed
it. `emit::translate_traced` returns the refusal with the instruction
that made the value, and `Refusal` displays as the error followed by
`(made by <instruction> at <offset>)`. The shader cache translates
through it, so the warning carries the origin; `translate` is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:37:01 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:31 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-gpu/src/shader_cache.rs, crates/victory-shader/src/emit/lower.rs, crates/victory-shader/src/emit/mod.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:31 UTC · [original](https://github.com/Marvisak/VIctory/pull/1578#issuecomment-7149641756) <!-- victory-triage v1 head=8631598388c20cc07023f80892b59545c9b25b1d verdict=needs-rebase at=2026-11-25T01:31:21Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-gpu/src/shader_cache.rs`, `crates/victory-shader/src/emit/lower.rs`, `crates/victory-shader/src/emit/mod.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • apps/victory/src/translate.rs
  • crates/victory-gpu/src/shader_cache.rs
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/mod.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1578'
git switch 'github-bot/gh-1578'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1578'
git switch 'github-bot/gh-1578'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1578'
git switch 'main'
git merge --squash 'github-bot/gh-1578'
git switch 'main'
git merge --ff-only 'github-bot/gh-1578'
git switch 'main'
git merge 'github-bot/gh-1578'
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!1578
No description provided.