Shaders: a compute shader samples at level 0, not with derivatives (735 programs) #2027

Closed
github-bot wants to merge 2 commits from github-bot/gh-2027 into main AGit
Owner

@⁠fiestorra on GitHub · 2026-11-25 03:29 UTC · original
fiestorra:fix/compute-sample-level → main · +27 −2 · 1 files · 2 commits · closed without merging

A compute shader has no derivatives to sample with: 735 programs, all Cs, all refused for it — and sampleLevel at level 0 fixes them

The next class after #1987, and this time the reason was in the run I had already made: the validator's note: line said

Function: main: error: Entry function performs some operation that is incompatible with the shader stage or other entry properties.
Function: main: error: Function uses features incompatible with the shader stage (cs) of the entry function.

735 programs, every one of them a compute shader (735 x Cs, no other stage). I dumped three of them (VICTORY_EMIT_DUMP) and disassembled with dxc -dumpbin:

billboard_nobump:CS_RaytracingResolve_a56bfb9c_Wrapped   Cs   threads (32,1,1), wave 32
  dx.op.sample (implicit)   3
  dx.op.sampleLevel       129
  dx.op.sampleCmpLevelZero  +
cloth_default:CS_RaytracingResolve_b1139868_Wrapped      Cs   threads (32,1,1)
  dx.op.sample (implicit)   3
  dx.op.sampleLevel       130

Three implicit dx.op.sample next to hundreds of explicit ones, in a stage that has no neighbours to take derivatives from. dx.op.sample is not a legal operation for cs — no shader model makes it one without the mesh/amplification derivatives feature — and the console's image_sample in that stage has no derivatives either: level 0 is what the instruction means there.

So the lowering now asks the stage: a compute program samples at level 0 with sampleLevel (62) and keeps sample (60) everywhere the implicit form is legal. The choice is sample_op(compute), and the test pins the pair.

Measured on the offline census over the same local 1.0.2.1 archive (26,503 containers), validator SDK 10.0.26100 dxil.dll 1.9:

build incompatible with the shader stage validated
main 940d32f 735 23,918
this branch 0 24,653
this branch + #2016 0 25,520

25,520 is 1,602 more programs than main: the 868 vertex programs of #1987 and these 735, minus the one that was in both classes.

One caveat worth stating, because it is the difference between "valid" and "right": the console program samples with whatever filter and coordinate the shader computed, and level 0 is the honest reading of "implicit level in a stage with no derivatives". If a title's compute shader relied on something else — a derivative register the console keeps per lane — this would change what it samples. That is worth a picture comparison on the raytracing resolve passes, which are the ones in this class, and I have not run the title to look at them.

Recipe: cargo test -p victory-shader --locked --lib 249 passed, 3 ignored; cargo test --workspace --locked 26 suites with the one failure main also has in a session without a desktop; clippy --workspace --all-targets with and without --all-features clean under -D warnings; rustfmt --check with the same 19 hunks main already has in lower.rs and no others.

No game data is involved: program names, counts, operation names and thread-group sizes.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 03:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027) `fiestorra:fix/compute-sample-level` → `main` · +27 −2 · 1 files · 2 commits · closed without merging **A compute shader has no derivatives to sample with: 735 programs, all `Cs`, all refused for it — and `sampleLevel` at level 0 fixes them** The next class after #1987, and this time the reason was in the run I had already made: the validator's `note:` line said ``` Function: main: error: Entry function performs some operation that is incompatible with the shader stage or other entry properties. Function: main: error: Function uses features incompatible with the shader stage (cs) of the entry function. ``` 735 programs, **every one of them a compute shader** (`735 x Cs`, no other stage). I dumped three of them (`VICTORY_EMIT_DUMP`) and disassembled with `dxc -dumpbin`: ``` billboard_nobump:CS_RaytracingResolve_a56bfb9c_Wrapped Cs threads (32,1,1), wave 32 dx.op.sample (implicit) 3 dx.op.sampleLevel 129 dx.op.sampleCmpLevelZero + cloth_default:CS_RaytracingResolve_b1139868_Wrapped Cs threads (32,1,1) dx.op.sample (implicit) 3 dx.op.sampleLevel 130 ``` Three implicit `dx.op.sample` next to hundreds of explicit ones, in a stage that has no neighbours to take derivatives from. `dx.op.sample` is not a legal operation for `cs` — no shader model makes it one without the mesh/amplification derivatives feature — and the console's `image_sample` in that stage has no derivatives either: level 0 is what the instruction means there. So the lowering now asks the stage: a compute program samples at level 0 with `sampleLevel` (62) and keeps `sample` (60) everywhere the implicit form is legal. The choice is `sample_op(compute)`, and the test pins the pair. Measured on the offline census over the same local 1.0.2.1 archive (26,503 containers), validator SDK 10.0.26100 `dxil.dll` 1.9: | build | `incompatible with the shader stage` | validated | |---|---|---| | `main` `940d32f` | 735 | 23,918 | | this branch | **0** | **24,653** | | this branch + #2016 | **0** | **25,520** | 25,520 is 1,602 more programs than `main`: the 868 vertex programs of #1987 and these 735, minus the one that was in both classes. One caveat worth stating, because it is the difference between "valid" and "right": the console program samples with whatever filter and coordinate the shader computed, and level 0 is the honest reading of "implicit level in a stage with no derivatives". If a title's compute shader relied on something else — a derivative register the console keeps per lane — this would change what it samples. That is worth a picture comparison on the raytracing resolve passes, which are the ones in this class, and I have not run the title to look at them. Recipe: `cargo test -p victory-shader --locked --lib` **249 passed, 3 ignored**; `cargo test --workspace --locked` 26 suites with the one failure `main` also has in a session without a desktop; `clippy --workspace --all-targets` with and without `--all-features` clean under `-D warnings`; `rustfmt --check` with the same 19 hunks `main` already has in `lower.rs` and no others. No game data is involved: program names, counts, operation names and thread-group sizes. Written with an AI assistant.
`dx.op.sample` takes derivatives, and a compute shader has none: the
validator refuses the module with "Function uses features incompatible with
the shader stage (cs) of the entry function". Measured on the offline census
over a local 1.0.2.1 shader archive (26,503 containers), validator SDK
10.0.26100 dxil.dll 1.9, the class is 735 programs, every one of them a
compute shader, and the ones dumped all carry three uses of the implicit
`sample` next to hundreds of explicit `sampleLevel`:

  billboard_nobump:CS_RaytracingResolve_a56bfb9c_Wrapped   Cs
  cloth_default:CS_RaytracingResolve_b1139868_Wrapped       Cs
  threads (32,1,1), wave 32, no shader flags declared

The console's `image_sample` in that stage has no derivatives to take either,
so level 0 is what it means; emitting `sampleLevel` with 0 keeps the meaning
and makes the module valid.

Census before and after, same archive, same validator:

  before   incompatibles 735, validated 23,918
  after    incompatibles   0, validated 24,653
  stacked on #2016 (the vertex UAV flags): 25,520 validated, from 23,918 on main.

The choice of operation is `sample_op`, which is also what the test pins:
`("sampleLevel.f32", 62)` for a compute stage, `("sample.f32", 60)` elsewhere.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:52:00 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-25 03:30 UTC · original

Triage verdict — Split the overlapping flag change and verify sampling semantics (6a16a66)

Evidence

Checks and limits

  • The reported census gain establishes validator acceptance. The added sample_op test checks an opcode pair; it does not emit a container or distinguish actual mip selection. I reviewed the source and existing evidence without rerunning the census or a GPU test.

Next step

  • Isolate the sampling change from the UAV flag fix and keep any useful diagnostic change separately. For a sampling regression, closed #1409 has a compute_image_sample_reads_level_zero fixture worth adapting. Use distinct mip contents and compare the intended result against the derivative-preserving path on a supported compute group. If mip 0 is a compatibility fallback, document the exact condition for using it.

This verification was AI-assisted.

**@⁠jeremygold02** on GitHub · 2026-11-25 03:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7151985651) **Triage verdict — Split the overlapping flag change and verify sampling semantics** (`6a16a66`) **Evidence** - The diff includes #2016’s UAV stage/feature flag changes and validator-note output alongside the level-zero lowering. The [same-validator comparison](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2016) shows why #1989 is the stronger standalone flag fix. - [SM 6.6 supports derivative-dependent sampling in compute with eligible thread-group shapes](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Derivatives.html). #1065 takes the validator-version and PSV0 route to preserve those derivatives. A rejected container under the current emitter does not by itself establish that the guest instruction should always sample mip 0. **Checks and limits** - The reported census gain establishes validator acceptance. The added `sample_op` test checks an opcode pair; it does not emit a container or distinguish actual mip selection. I reviewed the source and existing evidence without rerunning the census or a GPU test. **Next step** - Isolate the sampling change from the UAV flag fix and keep any useful diagnostic change separately. For a sampling regression, closed #1409 has a [`compute_image_sample_reads_level_zero` fixture](https://git.gtahub.st/github/Marvisak--VIctory/pulls/1409/files) worth adapting. Use distinct mip contents and compare the intended result against the derivative-preserving path on a supported compute group. If mip 0 is a compatibility fallback, document the exact condition for using it. This verification was AI-assisted.
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 03:34 UTC · original

Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at 6a16a66. victory-shader: 246 passed, 3 failed, 3 ignored; the new a_compute_shader_samples_at_level_zero passes. The 3 are #1744's NVIDIA failures on main. Same as main on this hardware. Not run: a title.

Overlap, from reading: #1237 (quad-lane gradients to sampleGrad) and #1065 (validator 1.8 compute derivatives) fix the same 735 compute programs, and wildheathen compared the two on 70564ae in #1237. #1409 made the same level-0 change outside pixel shaders, and triage closed it as going against main's deliberate implicit-LOD samples in compute. Level 0 and the console's quad derivatives give the same result only where the coordinates move about one texel per lane. They differ where a program minifies, such as a downsample.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-25 03:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7152046850) Ran on Windows 11 with an RTX 3070 (Ampere, driver 616.56), debug build, at `6a16a66`. `victory-shader`: 246 passed, 3 failed, 3 ignored; the new `a_compute_shader_samples_at_level_zero` passes. The 3 are #1744's NVIDIA failures on `main`. Same as `main` on this hardware. Not run: a title. Overlap, from reading: #1237 (quad-lane gradients to `sampleGrad`) and #1065 (validator 1.8 compute derivatives) fix the same 735 compute programs, and wildheathen compared the two on `70564ae` in #1237. #1409 made the same level-0 change outside pixel shaders, and triage closed it as going against `main`'s deliberate implicit-LOD samples in compute. Level 0 and the console's quad derivatives give the same result only where the coordinates move about one texel per lane. They differ where a program minifies, such as a downsample. AI-assisted (Claude Code).
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 03:35 UTC · original

Checked both fixes against the title itself: identical to main for the first 70 s, and that is the expected answer

Validation fixes are easy to ship without ever asking whether they change the executable, so I ran the title with both branches merged (this one and #2016), on this machine, in the same scenario I always use: session 1 (interactive desktop), RTX 4090, driver 32.0.16.2124, release build, empty cache, 70 s:

main 940d32f these two fixes
host view heap capped at 1000000 1 1
title slot past the host heap 310,720 310,720
no host texture … 2560x1440 format 115 1 1
host GPU device removed 2 2
last frame presented 64 64
Flags must match usage 0 0
incompatible with the shader stage 0 0

Identical, line for line. That is what I expected and it is worth saying why: the run dies at frame 64, before the title reaches the passes that use the 735 compute programs and the 868 vertex programs, so neither fix can show up in this window. The values on the two validator lines were already 0 because the runtime path does not validate at all — the fixes matter to translate --validate and to any report that counts validated programs, and they will matter to the title only once the heap cap (#1779), the texture ladder (#1630) and the removal (#1832) stop it from dying at frame 64.

So: no regression in what the title does today, and no improvement either. I would rather write that down than let a green check on the census imply the game changed.

The caveat from the pull request stands and is the one thing I still owe: the level-0 sampling in sampleLevel for compute is the honest reading of an implicit sample in a stage with no derivatives, but nothing here proves the raytracing resolve passes look the same — they are past the point this run reaches. A picture comparison over those passes needs a build that boots further, which is the #1779 + #1630 + #1832 chain.

No game data is involved: counts and warnings.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 03:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7152054219) **Checked both fixes against the title itself: identical to `main` for the first 70 s, and that is the expected answer** Validation fixes are easy to ship without ever asking whether they change the executable, so I ran the title with both branches merged (this one and #2016), on this machine, in the same scenario I always use: session 1 (interactive desktop), RTX 4090, driver `32.0.16.2124`, release build, empty cache, 70 s: | | `main` `940d32f` | these two fixes | |---|---|---| | `host view heap capped at 1000000` | 1 | 1 | | `title slot past the host heap` | 310,720 | 310,720 | | `no host texture … 2560x1440 format 115` | 1 | 1 | | host GPU device removed | 2 | 2 | | last frame presented | 64 | 64 | | `Flags must match usage` | 0 | 0 | | `incompatible with the shader stage` | 0 | 0 | **Identical, line for line.** That is what I expected and it is worth saying why: the run dies at frame 64, before the title reaches the passes that use the 735 compute programs and the 868 vertex programs, so neither fix can show up in this window. The values on the two validator lines were already 0 because the runtime path does not validate at all — the fixes matter to `translate --validate` and to any report that counts validated programs, and they will matter to the title only once the heap cap (#1779), the texture ladder (#1630) and the removal (#1832) stop it from dying at frame 64. So: **no regression in what the title does today**, and no improvement either. I would rather write that down than let a green check on the census imply the game changed. The caveat from the pull request stands and is the one thing I still owe: the level-0 sampling in `sampleLevel` for compute is the honest reading of an implicit sample in a stage with no derivatives, but nothing here proves the raytracing resolve passes look the same — they are past the point this run reaches. A picture comparison over those passes needs a build that boots further, which is the #1779 + #1630 + #1832 chain. No game data is involved: counts and warnings. Written with an AI assistant.
Author
Owner

@⁠BaggyALPHA on GitHub · 2026-11-25 03:54 UTC · original

Independent synthetic comparison on Windows, RTX 3080 and WARP. I tested each head separately on upstream 940d32f. The same plain compute image_sample read a 32×32 texture whose texels encode their mip number. Each column below is the readback for constant coordinates, then quad coordinate spacings of 1/16 and 1/4, respectively.

Tree DXC 1.7 validator DXC 1.8 validator Mip readbacks on both backends
Upstream Accepted Rejected, incompatible stage 0, 1, 3
With #1065 (e198449) Rejected, container requires validator 1.8 Accepted 0, 1, 3
With #2027 (6a16a66) Accepted Accepted 0, 0, 0

Both runtime adapters created the pipelines and returned the same values across all 32 lanes, in two runs per tree. This shows the level-zero path changes observable host sampling for the same synthetic input, while the 1.8 metadata change preserves the existing host readback. Microsoft documents quad-based compute derivatives in Shader Model 6.6. The test does not establish which result matches the console for this instruction. All inputs were synthetic. No game files were used.

AI-assisted (OpenAI Codex).

**@⁠BaggyALPHA** on GitHub · 2026-11-25 03:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7152357563) Independent synthetic comparison on Windows, RTX 3080 and WARP. I tested each head separately on upstream `940d32f`. The same plain compute `image_sample` read a 32×32 texture whose texels encode their mip number. Each column below is the readback for constant coordinates, then quad coordinate spacings of 1/16 and 1/4, respectively. | Tree | DXC 1.7 validator | DXC 1.8 validator | Mip readbacks on both backends | | --- | --- | --- | --- | | Upstream | Accepted | Rejected, incompatible stage | 0, 1, 3 | | With #1065 (`e198449`) | Rejected, container requires validator 1.8 | Accepted | 0, 1, 3 | | With #2027 (`6a16a66`) | Accepted | Accepted | 0, 0, 0 | Both runtime adapters created the pipelines and returned the same values across all 32 lanes, in two runs per tree. This shows the level-zero path changes observable host sampling for the same synthetic input, while the 1.8 metadata change preserves the existing host readback. Microsoft documents quad-based compute derivatives in [Shader Model 6.6](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Derivatives.html). The test does not establish which result matches the console for this instruction. All inputs were synthetic. No game files were used. AI-assisted (OpenAI Codex).
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 03:55 UTC · original

Corpus measurement on the real shaders.rpf (1.0.2.1), victory translate … --validate --list --jobs 10, Windows 10 / RX 7800 XT, SDK dxil.dll 1.7 (default_path's pick here), release build of this head 6a16a66:

build validated incompatible with the shader stage Flags must match usage
main 940d32f 23,918 736 lines (735 programs) 868 lines (867 programs)
this head 25,520 0 0

+1,602 = 735 compute (this PR) + 867 vertex (the UAV flag commit that is also in this branch). Worth stating in the body: the branch carries two commits — 3d6a54f "a vertex shader that declares a UAV says so…" (#2016) and 6a16a66 the compute change — so merging this lands both, and #2016 becomes redundant. That is fine, but reviewers should know, and the two flag PRs are #1989/#2016 with the mesh caveat on #2016's predicate (Dathinel's fixture).

One good sign for the compute half on an older validator: these modules still validate with the SDK 1.7 dxil.dll, so the change does not declare a newer validator version — a 1.7-only machine does not lose the 735 to “validator version not supported”.

**@⁠Calvix2k** on GitHub · 2026-11-25 03:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7152360783) Corpus measurement on the real `shaders.rpf` (1.0.2.1), `victory translate … --validate --list --jobs 10`, Windows 10 / RX 7800 XT, SDK `dxil.dll` 1.7 (`default_path`'s pick here), release build of this head `6a16a66`: | build | validated | `incompatible with the shader stage` | `Flags must match usage` | |---|---|---|---| | `main 940d32f` | 23,918 | 736 lines (735 programs) | 868 lines (867 programs) | | this head | **25,520** | **0** | **0** | +1,602 = **735 compute (this PR) + 867 vertex (the UAV flag commit that is also in this branch)**. Worth stating in the body: the branch carries two commits — `3d6a54f` "a vertex shader that declares a UAV says so…" (#2016) and `6a16a66` the compute change — so merging this lands both, and #2016 becomes redundant. That is fine, but reviewers should know, and the two flag PRs are #1989/#2016 with the mesh caveat on #2016's predicate (Dathinel's fixture). One good sign for the compute half on an older validator: these modules still validate with the SDK 1.7 `dxil.dll`, so the change does not declare a newer validator version — a 1.7-only machine does not lose the 735 to “validator version not supported”.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-25 04:41 UTC · original

Rebased so this pull request no longer carries #2016's commit, and measured alone: 23,918 → 24,653

When I opened this I had stacked it on #2016 (the vertex UAV flags), so the branch contained that commit and the two could not be merged in either order without a resolution in apps/victory/src/translate.rs. That was my convenience, not the repository's: the change here has nothing to do with the UAV flag, and being stacked made two otherwise-independent pull requests into a sequence.

It is now rebased onto main 940d32f alone, with only its own commit, and measured on its own over the same archive (26,503 containers, validator SDK 10.0.26100 dxil.dll 1.9):

build incompatible with the shader stage validated
main 940d32f 735 23,918
this, alone 0 24,653

and with #2016 also applied the pair reaches 25,520, which is the number I quoted before — the arithmetic was right, only the dependency was wrong.

Re-checked after the rebase: cargo test -p victory-shader --locked --lib 248 passed, 3 ignored; clippy --workspace --all-targets with -D warnings clean; rustfmt --check on lower.rs shows the same 19 hunks main already has and no others.

No game data is involved: counts and error text.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-25 04:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7153075520) **Rebased so this pull request no longer carries #2016's commit, and measured alone: 23,918 → 24,653** When I opened this I had stacked it on #2016 (the vertex UAV flags), so the branch contained that commit and the two could not be merged in either order without a resolution in `apps/victory/src/translate.rs`. That was my convenience, not the repository's: the change here has nothing to do with the UAV flag, and being stacked made two otherwise-independent pull requests into a sequence. It is now rebased onto `main` `940d32f` alone, with only its own commit, and measured on its own over the same archive (26,503 containers, validator SDK 10.0.26100 `dxil.dll` 1.9): | build | `incompatible with the shader stage` | validated | |---|---|---| | `main` `940d32f` | 735 | 23,918 | | this, alone | **0** | **24,653** | and with #2016 also applied the pair reaches 25,520, which is the number I quoted before — the arithmetic was right, only the dependency was wrong. Re-checked after the rebase: `cargo test -p victory-shader --locked --lib` **248 passed, 3 ignored**; `clippy --workspace --all-targets` with `-D warnings` clean; `rustfmt --check` on `lower.rs` shows the same **19 hunks `main` already has** and no others. No game data is involved: counts and error text. Written with an AI assistant.
Author
Owner

@⁠zed6000 on GitHub · 2026-11-25 04:54 UTC · original

Measured offline on the title's shaders (the method in #1247): merged onto main 940d32f (a clean merge) and compared program by program (victory translate --validate --list, shaders.rpf 1.0.2.1, dxil.dll 1.8.2502).

Build Change vs 940d32f cargo test -p victory-shader --lib (RX 7900 XTX)
+ this PR (34d0b4e) +735, 0 lost 248 passed, 0 failed
+ #1065 (e198449) +735, 0 lost 250 passed, 0 failed

It is the same 735 programs in both cases: all of main's "Entry function performs some operation that is incompatible with the shader stage" rejections. The two PRs merge cleanly with each other, but they are alternatives that reach the result in different ways:

  • #1065 keeps the implicit-derivative samples and declares validator 1.8, which allows derivatives in compute.
  • This PR samples those compute programs at level 0.

The offline counts can't tell which one renders as the console does. Where those samples relied on derivative-based mip selection, level 0 would always read the top mip. The choice probably comes down to that behaviour, or to the host-runtime question raised on #1065, rather than to the counts. Offline counts only; no program names or data.

**@⁠zed6000** on GitHub · 2026-11-25 04:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7153271658) Measured offline on the title's shaders (the method in #1247): merged onto main `940d32f` (a clean merge) and compared program by program (`victory translate --validate --list`, `shaders.rpf` 1.0.2.1, dxil.dll 1.8.2502). | Build | Change vs `940d32f` | `cargo test -p victory-shader --lib` (RX 7900 XTX) | |---|---|---| | + this PR (`34d0b4e`) | +735, 0 lost | 248 passed, 0 failed | | + #1065 (`e198449`) | +735, 0 lost | 250 passed, 0 failed | **It is the same 735 programs in both cases:** all of main's "Entry function performs some operation that is incompatible with the shader stage" rejections. The two PRs merge cleanly with each other, but they are alternatives that reach the result in different ways: - **#1065** keeps the implicit-derivative samples and declares validator 1.8, which allows derivatives in compute. - **This PR** samples those compute programs at level 0. The offline counts can't tell which one renders as the console does. Where those samples relied on derivative-based mip selection, level 0 would always read the top mip. The choice probably comes down to that behaviour, or to the host-runtime question raised on #1065, rather than to the counts. Offline counts only; no program names or data.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 09:17 UTC · original · edited 2026-11-26 01:20 UTC

Automated triage for the maintainers.

Proposed close (unchanged). The new commit only adds the missing closing brace of the test before a_compute_shader_samples_at_level_zero in crates/victory-shader/src/emit/lower.rs. The change itself is the same: sample_op makes every implicit-LOD image_sample in a compute shader into sampleLevel at level 0. That changes what those programs sample. The synthetic mip test on this PR showed mips 1 and 3 read as 0. The new test only pins sample_op's return values, not sampling behaviour.

What would change this verdict: evidence that the console's image_sample in a compute stage reads level 0 (an ISA reference or a hardware measurement), not evidence that the validator accepts the module.

This PR will be closed in 48 hours unless the author pushes a change that addresses this or a maintainer removes the label.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 09:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7158137546) · edited 2026-11-26 01:20 UTC <!-- victory-triage v1 head=57fd3caa84c0ee706d6fedd248e145dd8df88ae5 verdict=proposed-close at=2026-11-26T01:20:34Z --> Automated triage for the maintainers. **Proposed close (unchanged).** The new commit only adds the missing closing brace of the test before `a_compute_shader_samples_at_level_zero` in `crates/victory-shader/src/emit/lower.rs`. The change itself is the same: `sample_op` makes every implicit-LOD `image_sample` in a compute shader into `sampleLevel` at level 0. That changes what those programs sample. The synthetic mip test on this PR showed mips 1 and 3 read as 0. The new test only pins `sample_op`'s return values, not sampling behaviour. What would change this verdict: evidence that the console's `image_sample` in a compute stage reads level 0 (an ISA reference or a hardware measurement), not evidence that the validator accepts the module. This PR will be closed in 48 hours unless the author pushes a change that addresses this or a maintainer removes the label. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠wwwwwwww3333333 on GitHub · 2026-11-26 03:06 UTC · original

For the choice between this, #1065 and #1237: #2999 adds a GPU test that tells them apart, an [8, 8, 1] group whose lane quads (the console's) give level 1 and whose 2x2 tiles give level 3. On an RX 6750 XT, main, #1065 and #1237 read 3. #2999 reads 1 on every lane, on hardware and WARP, wave32 and wave64. This PR samples level 0 by design, so it would read 0 there (I did not run it with this test). I have not run the shader census on #2999.

**@⁠wwwwwwww3333333** on GitHub · 2026-11-26 03:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7181406442) For the choice between this, #1065 and #1237: #2999 adds a GPU test that tells them apart, an `[8, 8, 1]` group whose lane quads (the console's) give level 1 and whose 2x2 tiles give level 3. On an RX 6750 XT, main, #1065 and #1237 read 3. #2999 reads 1 on every lane, on hardware and WARP, wave32 and wave64. This PR samples level 0 by design, so it would read 0 there (I did not run it with this test). I have not run the shader census on #2999.
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-25 03:57 UTC · original · approved these changes

Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-shader --lib a_compute_shader_samples_at_level_zero — passed
  • cargo clippy -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean fix lowering compute shader samples at level 0 instead of implicit derivatives, plus matching shader feature flags. Looks good.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 03:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#pullrequestreview-6051648700) · **approved these changes** Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, Rust 1.98.1 MSVC): - `cargo test -p victory-shader --lib a_compute_shader_samples_at_level_zero` — passed - `cargo clippy -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean fix lowering compute shader samples at level 0 instead of implicit derivatives, plus matching shader feature flags. Looks good. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 04:04 UTC · original · approved these changes

Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, cargo test -p victory-shader --locked.

146 passed / 0 failed / 2 ignored. Compute shader samples at level 0, not with derivatives (+2 tests; references 735 affected programs) — fixes a real-world translation regression class; mixed apps+shader, apps half Windows-only.

**@⁠catminou4** on GitHub · 2026-11-25 04:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#pullrequestreview-6051698186) · **approved these changes** Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f69b, `cargo test -p victory-shader --locked`. 146 passed / 0 failed / 2 ignored. Compute shader samples at level 0, not with derivatives (+2 tests; references 735 affected programs) — fixes a real-world translation regression class; mixed apps+shader, apps half Windows-only.
Author
Owner

@⁠fiestorra on GitHub · 2026-11-26 12:23 UTC · original

Accepted: without ISA evidence this is a semantic guess, and I am measuring it

The verdict is fair. What the PR has is "the validator refuses sample.f32 in a compute stage with functions incompatible with the shader stage (cs), and 735 programs of the pack hit it" — that says a choice must be made, not which one. Choosing level 0 is a guess, and if the console's instruction is image_sample_l with its own LOD operand, sampleLevel at 0 is worse than the guess: it is wrong data.

The measurement I am running before touching this again: take the containers of the programs that fail, decode the image instruction's opcode field with our own decoder (gfx10/opcodes.rs has image_sample 0x20, _l 0x24, _lz 0x27 and the rest), and count which one those programs actually carry.

  • If they carry _l, the lowering must use the LOD the instruction names, not zero, and this PR is the wrong shape: it would become a lowering that passes the LOD operand through, which is a different change.
  • If they carry _lz, then level 0 is what the console asks for and the evidence is the instruction encoding itself, with the count of programs, not the validator's verdict.
  • If they carry plain image_sample in a compute stage, the ISA question becomes why the title has an instruction the hardware cannot run there, and I would not push a lowering until that is answered.

Until one of those is measured, this branch stays as it is and the 48-hour close should take it. I would rather have it closed than merged on a guess.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-26 12:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7191944249) **Accepted: without ISA evidence this is a semantic guess, and I am measuring it** The verdict is fair. What the PR has is "the validator refuses `sample.f32` in a compute stage with *functions incompatible with the shader stage (cs)*, and 735 programs of the pack hit it" — that says a choice must be made, not which one. Choosing level 0 is a guess, and if the console's instruction is `image_sample_l` with its own LOD operand, `sampleLevel` at 0 is worse than the guess: it is wrong data. The measurement I am running before touching this again: take the containers of the programs that fail, decode the image instruction's opcode field with our own decoder (`gfx10/opcodes.rs` has `image_sample` 0x20, `_l` 0x24, `_lz` 0x27 and the rest), and count which one those programs actually carry. - If they carry `_l`, the lowering must use the LOD the instruction names, not zero, and this PR is the wrong shape: it would become a lowering that passes the LOD operand through, which is a different change. - If they carry `_lz`, then level 0 is what the console asks for and the evidence is the instruction encoding itself, with the count of programs, not the validator's verdict. - If they carry plain `image_sample` in a compute stage, the ISA question becomes why the title has an instruction the hardware cannot run there, and I would not push a lowering until that is answered. Until one of those is measured, this branch stays as it is and the 48-hour close should take it. I would rather have it closed than merged on a guess. Written with an AI assistant.
github-bot closed this pull request 2026-11-26 13:36:04 +00:00
Author
Owner

@⁠fiestorra on GitHub · 2026-11-26 13:32 UTC · original

Closing it: the pack names its LOD explicitly, and this would guess for 1,838 instructions

I measured what I said I would, and the answer is that this branch should not land.

Decoding every container of the title's shader pack and counting the image-sample instruction each program actually carries, per stage:

stage image_sample _l _lz _c_lz
compute 1,838 20,392 88,254 4,717
pixel 91,531 20,593 73,942 10,356
vertex 0 212 2,144 10
mesh 0 1,818 17,484 0

So the compute programs are not short of LOD information: the overwhelming majority carry _l (an explicit LOD operand) or _lz (level zero), and the lowering already maps both to sampleLevel. What this branch changes is the 1,838 plain image_sample instructions, and it changes them to level 0 on a guess. The count is the counter-argument: 1,838 is small enough to be a decoder gap or dead code and far too large to be safe to reinterpret silently.

Three outcomes were possible when I started; the data points away from the one this branch assumed. If the plain form is a decoding gap (a variant our table does not carry), the fix is in the decoder and those instructions never reach the lowering. If it is what the console compiler emitted, the hardware has no derivative source there either, and what it does is an ISA question — not something to settle by making the validator accept the module.

I would rather close this than merge a semantic change on 1,838 instructions. The measurement that would reopen it: an ISA reference or a hardware test showing what plain image_sample reads in a compute stage.

Thanks for holding it — the 48-hour close was the right call.

Written with an AI assistant.

**@⁠fiestorra** on GitHub · 2026-11-26 13:32 UTC · [original](https://github.com/Marvisak/VIctory/pull/2027#issuecomment-7193484937) **Closing it: the pack names its LOD explicitly, and this would guess for 1,838 instructions** I measured what I said I would, and the answer is that this branch should not land. Decoding every container of the title's shader pack and counting the image-sample instruction each program actually carries, per stage: | stage | `image_sample` | `_l` | `_lz` | `_c_lz` | |---|---|---|---|---| | compute | **1,838** | 20,392 | 88,254 | 4,717 | | pixel | 91,531 | 20,593 | 73,942 | 10,356 | | vertex | 0 | 212 | 2,144 | 10 | | mesh | 0 | 1,818 | 17,484 | 0 | So the compute programs are not short of LOD information: the overwhelming majority carry `_l` (an explicit LOD operand) or `_lz` (level zero), and the lowering already maps both to `sampleLevel`. What this branch changes is the **1,838 plain `image_sample`** instructions, and it changes them to level 0 on a guess. The count is the counter-argument: 1,838 is small enough to be a decoder gap or dead code and far too large to be safe to reinterpret silently. Three outcomes were possible when I started; the data points away from the one this branch assumed. If the plain form is a decoding gap (a variant our table does not carry), the fix is in the decoder and those instructions never reach the lowering. If it is what the console compiler emitted, the hardware has no derivative source there either, and what it does is an ISA question — not something to settle by making the validator accept the module. I would rather close this than merge a semantic change on 1,838 instructions. The measurement that would reopen it: an ISA reference or a hardware test showing what plain `image_sample` reads in a compute stage. Thanks for holding it — the 48-hour close was the right call. Written with an AI assistant.

Pull request closed

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!2027
No description provided.