Shaders: 16-bit gradient samples (_g16) and a16 independently, in decoding and lowering (#1116) #2370

Open
KainanP wants to merge 7 commits from upstream-pr/2372 into main
KainanP commented 2026-11-25 12:09:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-25T12:09:13Z.


Fixes #1116.

This builds on #1209 and puts both halves of #1116 in one PR, as the triage comment on the issue asked. The branch is rebased on main 63bcca4 and has seven commits, each with its original Git author:

  1. and 2. #1209's two commits, cherry-picked unchanged (author @geiyiliyabumo).
  2. Mine: image_sample_d_cl_g16, and a16 gradients of 1D and 3D images.
  3. @steven-seagull27: 3D volume readbacks of the packed gradient samples.
  4. @steven-seagull27: six-face cube readbacks of the packed gradient samples.
  5. @andrewpozdnakov7-jpg: image_get_resinfo reads its a16 mip from the low half again (a regression the #1209 rework had introduced), with a GPU test.
  6. @andrewpozdnakov7-jpg: Clippy-only follow-up in the cube test (is_multiple_of).

Commits 5 to 7 come from @andrewpozdnakov7-jpg's combined review branch. If #1209 lands first, this PR shrinks to commits 3 to 7.

Problem

On RDNA2, a16 and the _g16 opcodes are independent. a16 packs the coordinates and the LOD/clamp two per VGPR. _g16 packs the derivatives two per VGPR, and each direction starts a new VGPR. LLVM's GFX10 assembler tests (llvm/test/MC/AMDGPU/gfx10_asm_mimg.s, llvmorg-20.1.8) show this. For 2D, image_sample_d … a16 takes v[0:4] (5 VGPRs) and image_sample_d_g16 takes [v0, v2, v4, v5] (4). For 3D, image_sample_d … a16 takes 8 and image_sample_d_g16 takes [v0, v2, v3, v5, v6, v7, v8] (7).

On main (940d32f):

  • image_addr_dwords packs gradients whenever a16 is set and never for _g16.
  • Lower::image reads gradients as f16 under a16. An image_sample_d with a16 and 32-bit gradients samples the wrong level and the wrong texel (measured below: 4000 instead of 3066).
  • Every _g16 sample is refused by name.
  • a16 gradients of 1D and 3D images are refused.

Change

  • #1209 (cherry-picked): image_addr_dwords packs gradients only for _g16. Lower::image reads the offset, bias and compare words whole, gradients by g16, and coordinates and LOD/clamp by a16. It maps image_sample_d_g16.
  • This commit (crates/victory-shader/src/emit/lower.rs, +14 −11):
    • A _g16 opcode is matched by its name without the suffix, so image_sample_d_cl_g16 lowers the way image_sample_d_cl does (sampleGrad with the clamp). Before, its _cl check looked at the full name, so the clamp was never read.
    • The _o check also uses that name, so _o_g16 forms work once an _o gradient form is lowered (#1687).
    • The stale refusal of a16 gradients of 1D/3D images goes away. a16 no longer packs gradients, and _g16 ones start a VGPR per direction (grad_regs).
    • The comparison forms (image_sample_c_d_g16, …) stay refused by name, as image_sample_c_d already is: SM 6.6 has no SampleCmpGrad.

Tests

New test emit::valu_tests::gradient_samples_of_16_bits, using hand-encoded MIMG words (encoding cross-checked against the LLVM test file above):

  • image_sample_d, _d_cl, _d_g16 and _d_cl_g16 on a 2D texture, each with and without a16 (8 programs). Each is lowered, validated with dxil.dll, and run on the hardware adapter and on WARP.
  • The texture is 64×16 with 5 levels, and texel (x, y) of level n holds 1000n + 64y + x. The sampler is point.
  • The gradients (1/16, 0) and (0, 19/32) give level 3.25, so level 3, where (0.3125, 0.75) is texel (2, 1), value 3066. A clamp of 4 gives 4001.
  • With the two 16-bit halves of a direction swapped, the result is 4001. I checked that by mutating the lowering. Reading 32-bit gradients as 16-bit gives 4000.
  • 3D (contributed by @steven-seagull27): a 16×8×32 volume with tagged mips and voxels, 16/32-bit derivatives and coordinates, either derivative direction active, with and without the minimum LOD. The test host gained 3D views for it.
  • image_sample_c_d_g16 must be refused.

Two more GPU tests come from reviewers:

  • emit::valu_tests::cube_gradients_of_16_bits (@steven-seagull27): a 32×32 point-sampled cube with each texel tagged by face, mip and position. It covers all six faces, 16/32-bit derivatives, 16/32-bit face operands and the minimum LOD on and off, with the active derivative in dPdx or dPdy (48 readbacks per adapter).
  • emit::valu_tests::resinfo_a16_reads_the_low_mip_half (@andrewpozdnakov7-jpg): image_get_resinfo on an 8×4 texture with three mips, with mip operands 0x1234_0001 and 0x5678_0002 under a16. Before commit 6 they returned 0×0 because the whole VGPR was used as the level. They now return 4×2 and 2×1, as main already did.

lower_cs32 is split so that try_lower_cs32 returns the lowering error. There are no other test-helper changes.

Per-case results (RTX 4060 and WARP give the same values):

case main #1209 alone this PR
image_sample_d 3066 ✓ 3066 ✓ 3066 ✓
image_sample_d a16 4000 3066 ✓ 3066 ✓
image_sample_d_g16 (± a16) refused 3066 ✓ 3066 ✓
image_sample_d_cl 4001 ✓ 4001 ✓ 4001 ✓
image_sample_d_cl a16 4000 4001 ✓ 4001 ✓
image_sample_d_cl_g16 (± a16) refused refused 4001 ✓
3D _d a16 / _d_g16 a16 refused refused lowered and validated
3D _d_g16 refused lowered lowered and validated

The test fails on main (image_sample_d_g16 is not supported) and on #1209 alone (image_sample_d_cl_g16 is not supported).

Validation

Current head, rebased on main 63bcca4. Windows 11, Rust 1.98.1. cargo test -p victory-shader --lib --locked, skipping memory_tests::heap_direct_texture_reads_mark_their_heap_index, which crashes the test process on the RTX 4060 on main too. Intel UHD was selected with a local adapter hook that is not committed; its log confirmed that every shader host ran on 8086:a78b.

adapter this branch main 63bcca4
RTX 4060 Laptop 322 passed, 3 failed 298 passed, the same 3 failed
Intel UHD (8086:a78b) 315 passed, 10 failed 291 passed, the same 10 failed
WARP (VICTORY_WARP=1) 321 passed, 4 failed 297 passed, the same 4 failed

The +24 tests are #1209's 21 fields.rs tests, gradient_samples_of_16_bits (2D and 3D), cube_gradients_of_16_bits and resinfo_a16_reads_the_low_mip_half. All three pass on every adapter. Each failure list is identical to main's on the same adapter, so those failures predate this PR. On RTX they are stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros and synthetic_tests::gathers_at_a_level_match_the_hardware. On WARP they are the gather test and three hardware-only synthetic_tests. On Intel they are the BVH, wave16 and 64-bit-atomic tests already known on that iGPU.

cargo clippy --workspace --all-targets --locked -- -D warnings and the same with --all-features are both clean. cargo xtask policy reports 191 files ok. rustfmt shows no differences on the changed lines.

Not measured

  • Effect on the title's shaders: unknown. I did not run this against a dump (no game data used). The A/B on #1209 found no validation changes from the fields.rs half alone. A victory translate --validate count before and after would show whether any programs use _g16 or a16 gradients. If someone with a dump can run it, that would help.
  • image_sample_cd*_g16 (0xE8–0xEF): not in the decoder's opcode table. image_sample_cd itself is not lowered either.

AI use

My commit, the 2D test and this description were written with Claude Code (Claude Opus 5.5). All results above come from runs on my machine. The reviewer commits were written with Codex, according to their authors. No game data was used.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5491039925 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-25T12:09:13Z. --- Fixes #1116. This builds on #1209 and puts both halves of #1116 in one PR, as the triage comment on the issue asked. The branch is rebased on `main` `63bcca4` and has seven commits, each with its original Git author: 1. and 2. #1209's two commits, cherry-picked unchanged (author @geiyiliyabumo). 3. Mine: `image_sample_d_cl_g16`, and a16 gradients of 1D and 3D images. 4. @steven-seagull27: 3D volume readbacks of the packed gradient samples. 5. @steven-seagull27: six-face cube readbacks of the packed gradient samples. 6. @andrewpozdnakov7-jpg: `image_get_resinfo` reads its a16 mip from the low half again (a regression the #1209 rework had introduced), with a GPU test. 7. @andrewpozdnakov7-jpg: Clippy-only follow-up in the cube test (`is_multiple_of`). Commits 5 to 7 come from @andrewpozdnakov7-jpg's combined review branch. If #1209 lands first, this PR shrinks to commits 3 to 7. ## Problem On RDNA2, `a16` and the `_g16` opcodes are independent. `a16` packs the coordinates and the LOD/clamp two per VGPR. `_g16` packs the derivatives two per VGPR, and each direction starts a new VGPR. LLVM's GFX10 assembler tests (`llvm/test/MC/AMDGPU/gfx10_asm_mimg.s`, llvmorg-20.1.8) show this. For 2D, `image_sample_d … a16` takes `v[0:4]` (5 VGPRs) and `image_sample_d_g16` takes `[v0, v2, v4, v5]` (4). For 3D, `image_sample_d … a16` takes 8 and `image_sample_d_g16` takes `[v0, v2, v3, v5, v6, v7, v8]` (7). On `main` (`940d32f`): - `image_addr_dwords` packs gradients whenever `a16` is set and never for `_g16`. - `Lower::image` reads gradients as f16 under `a16`. An `image_sample_d` with a16 and 32-bit gradients samples the wrong level and the wrong texel (measured below: 4000 instead of 3066). - Every `_g16` sample is refused by name. - `a16` gradients of 1D and 3D images are refused. ## Change - **#1209 (cherry-picked):** `image_addr_dwords` packs gradients only for `_g16`. `Lower::image` reads the offset, bias and compare words whole, gradients by `g16`, and coordinates and LOD/clamp by `a16`. It maps `image_sample_d_g16`. - **This commit** (`crates/victory-shader/src/emit/lower.rs`, +14 −11): - A `_g16` opcode is matched by its name without the suffix, so `image_sample_d_cl_g16` lowers the way `image_sample_d_cl` does (`sampleGrad` with the clamp). Before, its `_cl` check looked at the full name, so the clamp was never read. - The `_o` check also uses that name, so `_o_g16` forms work once an `_o` gradient form is lowered (#1687). - The stale refusal of a16 gradients of 1D/3D images goes away. a16 no longer packs gradients, and `_g16` ones start a VGPR per direction (`grad_regs`). - The comparison forms (`image_sample_c_d_g16`, …) stay refused by name, as `image_sample_c_d` already is: SM 6.6 has no `SampleCmpGrad`. ## Tests New test `emit::valu_tests::gradient_samples_of_16_bits`, using hand-encoded MIMG words (encoding cross-checked against the LLVM test file above): - `image_sample_d`, `_d_cl`, `_d_g16` and `_d_cl_g16` on a 2D texture, each with and without a16 (8 programs). Each is lowered, validated with `dxil.dll`, and run on the hardware adapter and on WARP. - The texture is 64×16 with 5 levels, and texel (x, y) of level n holds `1000n + 64y + x`. The sampler is point. - The gradients (1/16, 0) and (0, 19/32) give level 3.25, so level 3, where (0.3125, 0.75) is texel (2, 1), value 3066. A clamp of 4 gives 4001. - With the two 16-bit halves of a direction swapped, the result is 4001. I checked that by mutating the lowering. Reading 32-bit gradients as 16-bit gives 4000. - 3D (contributed by @steven-seagull27): a 16×8×32 volume with tagged mips and voxels, 16/32-bit derivatives and coordinates, either derivative direction active, with and without the minimum LOD. The test host gained 3D views for it. - `image_sample_c_d_g16` must be refused. Two more GPU tests come from reviewers: - `emit::valu_tests::cube_gradients_of_16_bits` (@steven-seagull27): a 32×32 point-sampled cube with each texel tagged by face, mip and position. It covers all six faces, 16/32-bit derivatives, 16/32-bit face operands and the minimum LOD on and off, with the active derivative in dPdx or dPdy (48 readbacks per adapter). - `emit::valu_tests::resinfo_a16_reads_the_low_mip_half` (@andrewpozdnakov7-jpg): `image_get_resinfo` on an 8×4 texture with three mips, with mip operands `0x1234_0001` and `0x5678_0002` under a16. Before commit 6 they returned 0×0 because the whole VGPR was used as the level. They now return 4×2 and 2×1, as `main` already did. `lower_cs32` is split so that `try_lower_cs32` returns the lowering error. There are no other test-helper changes. Per-case results (RTX 4060 and WARP give the same values): | case | `main` | #1209 alone | this PR | |---|---|---|---| | `image_sample_d` | 3066 ✓ | 3066 ✓ | 3066 ✓ | | `image_sample_d` a16 | **4000** | 3066 ✓ | 3066 ✓ | | `image_sample_d_g16` (± a16) | refused | 3066 ✓ | 3066 ✓ | | `image_sample_d_cl` | 4001 ✓ | 4001 ✓ | 4001 ✓ | | `image_sample_d_cl` a16 | **4000** | 4001 ✓ | 4001 ✓ | | `image_sample_d_cl_g16` (± a16) | refused | refused | 4001 ✓ | | 3D `_d` a16 / `_d_g16` a16 | refused | refused | lowered and validated | | 3D `_d_g16` | refused | lowered | lowered and validated | The test fails on `main` (`image_sample_d_g16 is not supported`) and on #1209 alone (`image_sample_d_cl_g16 is not supported`). ## Validation Current head, rebased on `main` `63bcca4`. Windows 11, Rust 1.98.1. `cargo test -p victory-shader --lib --locked`, skipping `memory_tests::heap_direct_texture_reads_mark_their_heap_index`, which crashes the test process on the RTX 4060 on `main` too. Intel UHD was selected with a local adapter hook that is not committed; its log confirmed that every shader host ran on `8086:a78b`. | adapter | this branch | `main` `63bcca4` | |---|---|---| | RTX 4060 Laptop | 322 passed, 3 failed | 298 passed, the same 3 failed | | Intel UHD (8086:a78b) | 315 passed, 10 failed | 291 passed, the same 10 failed | | WARP (`VICTORY_WARP=1`) | 321 passed, 4 failed | 297 passed, the same 4 failed | The +24 tests are #1209's 21 `fields.rs` tests, `gradient_samples_of_16_bits` (2D and 3D), `cube_gradients_of_16_bits` and `resinfo_a16_reads_the_low_mip_half`. All three pass on every adapter. Each failure list is identical to `main`'s on the same adapter, so those failures predate this PR. On RTX they are `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, `stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` and `synthetic_tests::gathers_at_a_level_match_the_hardware`. On WARP they are the gather test and three hardware-only `synthetic_tests`. On Intel they are the BVH, wave16 and 64-bit-atomic tests already known on that iGPU. `cargo clippy --workspace --all-targets --locked -- -D warnings` and the same with `--all-features` are both clean. `cargo xtask policy` reports 191 files ok. rustfmt shows no differences on the changed lines. ## Not measured - **Effect on the title's shaders:** unknown. I did not run this against a dump (no game data used). The A/B on #1209 found no validation changes from the `fields.rs` half alone. A `victory translate --validate` count before and after would show whether any programs use `_g16` or a16 gradients. If someone with a dump can run it, that would help. - **`image_sample_cd*_g16` (0xE8–0xEF):** not in the decoder's opcode table. `image_sample_cd` itself is not lowered either. ## AI use My commit, the 2D test and this description were written with Claude Code (Claude Opus 5.5). All results above come from runs on my machine. The reviewer commits were written with Codex, according to their authors. No game data was used. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
steven-seagull27 commented 2026-11-25 14:07:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-25T13:17:07Z.


I ran the 3D gradient cases on PR head 1f99fa7 with a synthetic 16×8×32 volume. A point sampler reads a texel tagged with its mip and position. I varied 16/32-bit derivatives, 16/32-bit coordinates, the active derivative direction, and the minimum LOD clamp. All 16 volume readbacks matched on each adapter. The eight existing 2D cases also matched on each.

3D sample Expected mip and voxel (x, y, z) RTX 5080, 621.40 Windows WARP, 10.0.26100.10068
dPdx active mip 1, (2, 2, 9) 10934 10934
dPdy active mip 2, (1, 1, 4) 20417 20417
minimum LOD 3, either direction mip 3, (0, 0, 2) 30200 30200

As a sensitivity check, I deliberately made the 3D _g16 lowering take Z from the unused high half of its VGPR. The first unclamped _g16 case then returned 30200 instead of 10934 on both devices. The patch below contains only the test and the volume-texture support in the test host.

The regression can be cherry-picked onto this PR. Test commit

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2372-volume-readback
git cherry-pick 2996b2763f590bb4c1ffabe7c929b402fbe309ca
cargo test --locked -p victory-shader --lib emit::valu_tests::gradient_samples_of_16_bits -- --exact --nocapture

The test ran with synthetic shaders and textures. Cube sampling and in-game behavior remain open.

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163555728 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7163555728). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-25T13:17:07Z. --- I ran the 3D gradient cases on PR head `1f99fa7` with a synthetic 16×8×32 volume. A point sampler reads a texel tagged with its mip and position. I varied 16/32-bit derivatives, 16/32-bit coordinates, the active derivative direction, and the minimum LOD clamp. All 16 volume readbacks matched on each adapter. The eight existing 2D cases also matched on each. | 3D sample | Expected mip and voxel (x, y, z) | RTX 5080, 621.40 | Windows WARP, 10.0.26100.10068 | |---|---|---:|---:| | dPdx active | mip 1, (2, 2, 9) | 10934 | 10934 | | dPdy active | mip 2, (1, 1, 4) | 20417 | 20417 | | minimum LOD 3, either direction | mip 3, (0, 0, 2) | 30200 | 30200 | As a sensitivity check, I deliberately made the 3D `_g16` lowering take Z from the unused high half of its VGPR. The first unclamped `_g16` case then returned 30200 instead of 10934 on both devices. The patch below contains only the test and the volume-texture support in the test host. The regression can be cherry-picked onto this PR. [Test commit](https://github.com/steven-seagull27/VIctory/commit/2996b2763f590bb4c1ffabe7c929b402fbe309ca) ```sh git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2372-volume-readback git cherry-pick 2996b2763f590bb4c1ffabe7c929b402fbe309ca cargo test --locked -p victory-shader --lib emit::valu_tests::gradient_samples_of_16_bits -- --exact --nocapture ``` The test ran with synthetic shaders and textures. Cube sampling and in-game behavior remain open. AI-assisted with Codex.
KainanP commented 2026-11-25 14:07:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-25T13:26:23Z.


@steven-seagull27 thanks — the 3D readbacks were the part this PR couldn't run (the test host had no volume view). Your commit is now on the branch as 3c7c10f, cherry-picked with your authorship. gradient_samples_of_16_bits passes with it on an RTX 4060 Laptop (driver 32.0.16.1047) and on WARP 10.0.26100.9818, and clippy -D warnings stays clean on victory-shader.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163778471 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7163778471). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-25T13:26:23Z. --- @steven-seagull27 thanks — the 3D readbacks were the part this PR couldn't run (the test host had no volume view). Your commit is now on the branch as `3c7c10f`, cherry-picked with your authorship. `gradient_samples_of_16_bits` passes with it on an RTX 4060 Laptop (driver 32.0.16.1047) and on WARP 10.0.26100.9818, and clippy `-D warnings` stays clean on victory-shader. _AI use: Claude Code (Claude Opus 5.5)._
steven-seagull27 commented 2026-11-25 14:07:24 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-25T13:32:50Z.


Thanks for integrating the volume test and checking it on the 4060. I cherry-picked the cube test onto your updated head 3c7c10f and reran it on both devices. A 32×32 point-sampled cube tags each texel with its face, mip and position. I tested all six faces, 16/32-bit derivatives, 16/32-bit face operands and minimum LOD on/off. The active derivative alternates between dPdx and dPdy across faces.

Adapter Cube readbacks matching the expected face, mip and texel
RTX 5080, driver 621.40 48/48
Windows WARP, 10.0.26100.10068 48/48

On +X the unclamped sample returned 2162 (mip 2, texel 2,5). On −Z with minimum LOD 3 it returned 53065 (mip 3, texel 1,2). As a sensitivity check on the earlier head 1f99fa7, deliberately taking the low half for both packed derivative components caused 12/48 mismatches on each adapter. Those were exactly the unclamped _g16 cases, including +X reading 1325 instead of 2162.

The uninstrumented cube and volume regressions both passed together on the updated head. Cube test commit

git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2372-cube-readback
git cherry-pick 65ce74a19e68649a9d3b6c75f215499437940d8a
cargo test --locked -p victory-shader --lib emit::valu_tests::cube_gradients_of_16_bits -- --exact --nocapture

This covers synthetic cube samples with an isotropic point sampler and zero LOD bias.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7163934153 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7163934153). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-25T13:32:50Z. --- Thanks for integrating the volume test and checking it on the 4060. I cherry-picked the cube test onto your updated head `3c7c10f` and reran it on both devices. A 32×32 point-sampled cube tags each texel with its face, mip and position. I tested all six faces, 16/32-bit derivatives, 16/32-bit face operands and minimum LOD on/off. The active derivative alternates between dPdx and dPdy across faces. | Adapter | Cube readbacks matching the expected face, mip and texel | |---|---:| | RTX 5080, driver 621.40 | 48/48 | | Windows WARP, 10.0.26100.10068 | 48/48 | On +X the unclamped sample returned 2162 (mip 2, texel 2,5). On −Z with minimum LOD 3 it returned 53065 (mip 3, texel 1,2). As a sensitivity check on the earlier head `1f99fa7`, deliberately taking the low half for both packed derivative components caused 12/48 mismatches on each adapter. Those were exactly the unclamped `_g16` cases, including +X reading 1325 instead of 2162. The uninstrumented cube and volume regressions both passed together on the updated head. [Cube test commit](https://github.com/steven-seagull27/VIctory/commit/65ce74a19e68649a9d3b6c75f215499437940d8a) ```sh git fetch https://github.com/steven-seagull27/VIctory.git refs/heads/codex/pr2372-cube-readback git cherry-pick 65ce74a19e68649a9d3b6c75f215499437940d8a cargo test --locked -p victory-shader --lib emit::valu_tests::cube_gradients_of_16_bits -- --exact --nocapture ``` This covers synthetic cube samples with an isotropic point sampler and zero LOD bias.
Marvisak commented 2026-11-25 15:04:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T14:52:53Z.


Automated triage for the maintainers.

Merge candidate. Makes a16 (coordinates, LOD/clamp) and the _g16 opcodes (derivatives, one VGPR per direction) independent, in image_addr_dwords (crates/victory-shader/src/gfx10/fields.rs) and in Lower::image (emit/lower.rs, via the new addr_at), and lowers image_sample_d_g16/_d_cl_g16. In main, a16 packs gradients and _g16 is refused. I checked the VGPR counts against the cited public evidence (LLVM's GFX10 assembler tests: 2D image_sample_d a16 = 5 VGPRs, _d_g16 = 4; 3D 8 and 7). I also checked that offset, bias and compare words are still read whole, and that _cl/_o now test the name without _g16. The GPU test samples a tagged mip chain on hardware and WARP; contributed volume and cube readbacks are in the thread (the volume one is on the branch).

Notes for the maintainer: the branch carries #1209's two commits (with their author), including its ~1,100-line fields.rs decoder test module, so it supersedes #1209. Effect on the title's shaders has not been measured.

CI: check passing.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7165960495 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7165960495). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T14:52:53Z. --- <!-- victory-triage v1 head=3c7c10f922a4db981599570540b5fd2f097ff1af verdict=merge-candidate at=2026-11-25T14:52:40Z --> Automated triage for the maintainers. **Merge candidate.** Makes `a16` (coordinates, LOD/clamp) and the `_g16` opcodes (derivatives, one VGPR per direction) independent, in `image_addr_dwords` (`crates/victory-shader/src/gfx10/fields.rs`) and in `Lower::image` (`emit/lower.rs`, via the new `addr_at`), and lowers `image_sample_d_g16`/`_d_cl_g16`. In `main`, `a16` packs gradients and `_g16` is refused. I checked the VGPR counts against the cited public evidence (LLVM's GFX10 assembler tests: 2D `image_sample_d` a16 = 5 VGPRs, `_d_g16` = 4; 3D 8 and 7). I also checked that offset, bias and compare words are still read whole, and that `_cl`/`_o` now test the name without `_g16`. The GPU test samples a tagged mip chain on hardware and WARP; contributed volume and cube readbacks are in the thread (the volume one is on the branch). Notes for the maintainer: the branch carries #1209's two commits (with their author), including its ~1,100-line `fields.rs` decoder test module, so it supersedes #1209. Effect on the title's shaders has not been measured. CI: `check` passing. --- _Generated by [Claude Code](https://claude.ai/code)_
oni-swr commented 2026-11-25 15:04:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T15:00:03Z.


Independent Windows verification (software WARP only, no hardware GPU in the final runs)

  • PR head: 3c7c10f922a4db981599570540b5fd2f097ff1af; origin/main: 940d32f69b22265690a0b5a15d6ded572ba33baf (merge base = origin/main; git merge-tree clean)
  • Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, WARP D3D10Warp.dll 10.0.26100.9818, dxil.dll 1.9.2602.17
  • Adapter: VICTORY_D3D12_WARP=1 and VICTORY_WARP=1 (the latter is what victory-shader's test Host::new reads; the path is EnumWarpAdapter, Microsoft Basic Render Driver 0x1414; the tests do not print the adapter id).

Results:

  • cargo test -p victory-shader --lib --locked -- --test-threads=1: 267 passed, 2 failed, 3 ignored. Passing include valu_tests::gradient_samples_of_16_bits (2D and the 3D volume cases), diff_tests::cube_gradients_pick_the_level and all gfx10::fields::tests (including image_address_dwords).
  • The 2 failures are synthetic_tests::gathers_at_a_level_match_the_hardware and synthetic_tests::permutes_read_the_lane_named_and_zero_from_lanes_left_out. They are in files this PR does not touch and fail identically on origin/main under WARP (verified there), so they are not caused by this PR.
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.
  • cargo xtask policy: asset policy: 182 files ok.

Diff review of lower.rs: the addr_at(base, half, k) helper reads each address component from the right VGPR, and a16 (coordinates, LOD, clamp, bias) and _g16 (gradients, one VGPR per direction with an odd last gradient alone in the low half) are now independent. The offset, bias and compare words are still read whole, _cl/_o are tested on the name without _g16, and the old "16-bit gradients of a 1D or 3D image" refusal is gone. I found no logic issues. I did not run the separate cube readback from steven-seagull27's branch (it is not on this head); only the cube test already in the tree. The VGPR counts rest on the cited LLVM assembler tests, not on hardware here.

Environment notes: the Windows SDK 10.0.19041 dxil.dll crashes these SM 6.6 tests on WARP (STATUS_ACCESS_VIOLATION, also on main); a current dxil.dll avoids it. An earlier attempt of mine set only VICTORY_D3D12_WARP, which victory-shader's tests ignore, so their "hardware" pass briefly ran on the physical adapter before that crash; all results above are from the later VICTORY_WARP=1 runs.

Verified by Claude Code (Claude Sonnet 5.5), an AI assistant, on behalf of a maintainer.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166144573 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7166144573). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T15:00:03Z. --- **Independent Windows verification (software WARP only, no hardware GPU in the final runs)** - PR head: `3c7c10f922a4db981599570540b5fd2f097ff1af`; `origin/main`: `940d32f69b22265690a0b5a15d6ded572ba33baf` (merge base = origin/main; `git merge-tree` clean) - Windows 11 Pro 10.0.26200, rustc/cargo 1.98.1, WARP D3D10Warp.dll 10.0.26100.9818, dxil.dll 1.9.2602.17 - Adapter: `VICTORY_D3D12_WARP=1` and `VICTORY_WARP=1` (the latter is what victory-shader's test `Host::new` reads; the path is `EnumWarpAdapter`, Microsoft Basic Render Driver 0x1414; the tests do not print the adapter id). Results: - `cargo test -p victory-shader --lib --locked -- --test-threads=1`: 267 passed, 2 failed, 3 ignored. Passing include `valu_tests::gradient_samples_of_16_bits` (2D and the 3D volume cases), `diff_tests::cube_gradients_pick_the_level` and all `gfx10::fields::tests` (including `image_address_dwords`). - The 2 failures are `synthetic_tests::gathers_at_a_level_match_the_hardware` and `synthetic_tests::permutes_read_the_lane_named_and_zero_from_lanes_left_out`. They are in files this PR does not touch and fail identically on `origin/main` under WARP (verified there), so they are not caused by this PR. - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: clean. - `cargo xtask policy`: `asset policy: 182 files ok`. Diff review of `lower.rs`: the `addr_at(base, half, k)` helper reads each address component from the right VGPR, and `a16` (coordinates, LOD, clamp, bias) and `_g16` (gradients, one VGPR per direction with an odd last gradient alone in the low half) are now independent. The offset, bias and compare words are still read whole, `_cl`/`_o` are tested on the name without `_g16`, and the old "16-bit gradients of a 1D or 3D image" refusal is gone. I found no logic issues. I did not run the separate cube readback from `steven-seagull27`'s branch (it is not on this head); only the cube test already in the tree. The VGPR counts rest on the cited LLVM assembler tests, not on hardware here. Environment notes: the Windows SDK 10.0.19041 `dxil.dll` crashes these SM 6.6 tests on WARP (STATUS_ACCESS_VIOLATION, also on main); a current dxil.dll avoids it. An earlier attempt of mine set only `VICTORY_D3D12_WARP`, which victory-shader's tests ignore, so their "hardware" pass briefly ran on the physical adapter before that crash; all results above are from the later `VICTORY_WARP=1` runs. Verified by Claude Code (Claude Sonnet 5.5), an AI assistant, on behalf of a maintainer.
andrewpozdnakov7-jpg commented 2026-11-26 04:06:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T03:25:46Z.


I reproduced the mip-query regression noted in the closing review of #1209. 2d45b56 is one commit directly on 3c7c10f. It uses the existing a16 operand reader for the mip passed to getDimensions.

The same synthetic Windows/WARP fixture reads dimensions from an 8×4 texture with three mips. On 3c7c10f, packed operands 0x12340001 and 0x56780002 both return 0×0. With the fix they return 4×2 and 2×1. The 32-bit and zero-padded a16 controls pass in both builds. Six paired runs agreed.

The fixture also passes on upstream 63bcca4 and when the patched branch is merged onto it. The exact branch passed all 30 VALU and 21 field tests, strict shader Clippy, and policy. The merged tree passes the mip query, gradient readback, and all 21 field tests.

Please retain the follow-up's Git author if you cherry-pick. If you fold this fix or test into another commit, please include:

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted with Codex. Synthetic texture and shader.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7181711058 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7181711058). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T03:25:46Z. --- I reproduced the mip-query regression noted in the [closing review of #1209](https://github.com/Marvisak/VIctory/pull/1209#issuecomment-7175808009). [2d45b56](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/2d45b568c4654c301c2ff699ea5d07f5a7a93ba9) is one commit directly on `3c7c10f`. It uses the existing a16 operand reader for the mip passed to `getDimensions`. The same synthetic Windows/WARP fixture reads dimensions from an 8×4 texture with three mips. On `3c7c10f`, packed operands `0x12340001` and `0x56780002` both return `0×0`. With the fix they return `4×2` and `2×1`. The 32-bit and zero-padded a16 controls pass in both builds. Six paired runs agreed. The fixture also passes on upstream `63bcca4` and when the patched branch is merged onto it. The exact branch passed all 30 VALU and 21 field tests, strict shader Clippy, and policy. The merged tree passes the mip query, gradient readback, and all 21 field tests. Please retain the follow-up's Git author if you cherry-pick. If you fold this fix or test into another commit, please include: Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted with Codex. Synthetic texture and shader.
steven-seagull27 commented 2026-11-26 04:06:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T03:45:30Z.


I checked @andrewpozdnakov7-jpg’s mip-query fix on RTX 5080 (621.40), Windows WARP (10.0.26100.10068), and WARP 1.0.22. I used an 8×4 texture with three mip levels and added high-half patterns at level 0 as well as levels 1 and 2. Each build also ran the existing 2D and volume tests and our six-face cube regression.

Per adapter PR head 3c7c10f With 2d45b56
Mip width and height matched 6/12 12/12
Tagged 2D, volume and cube samples matched 72/72 72/72

All three adapters agreed. Unpacked and zero-padded controls passed on the PR head. For packed a16 operands 0xffff0000, 0xffff0001, and 0xffff0002, it returned 0×0 each time. With the fix the same queries returned 8×4, 4×2, and 2×1. I’d include the author’s commit when taking this PR. Original follow-up · Cube regression

AI-assisted with Codex. Synthetic textures and shaders.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7181997449 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7181997449). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T03:45:30Z. --- I checked @andrewpozdnakov7-jpg’s [mip-query fix](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/2d45b568c4654c301c2ff699ea5d07f5a7a93ba9) on RTX 5080 (621.40), Windows WARP (10.0.26100.10068), and WARP 1.0.22. I used an 8×4 texture with three mip levels and added high-half patterns at level 0 as well as levels 1 and 2. Each build also ran the existing 2D and volume tests and our six-face cube regression. | Per adapter | PR head `3c7c10f` | With `2d45b56` | |---|---:|---:| | Mip width and height matched | 6/12 | 12/12 | | Tagged 2D, volume and cube samples matched | 72/72 | 72/72 | All three adapters agreed. Unpacked and zero-padded controls passed on the PR head. For packed a16 operands `0xffff0000`, `0xffff0001`, and `0xffff0002`, it returned `0×0` each time. With the fix the same queries returned `8×4`, `4×2`, and `2×1`. I’d include the author’s commit when taking this PR. [Original follow-up](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7181711058) · [Cube regression](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7163934153) AI-assisted with Codex. Synthetic textures and shaders.
fuzeofficlal commented 2026-11-26 17:39:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T17:39:26Z.

Review: CHANGES_REQUESTED


Tested merged onto main (63bcca43) on an RTX 5090, Microsoft WARP, and Windows SDK dxil.dll:

  • cargo xtask policy (191 files ok; crates/victory-shader/src/emit/lower.rs = 520,886 B < 524,288 B) and cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features) pass.
  • All 24 new/updated tests (gfx10::fields::tests:: 21/21, gradient_samples_of_16_bits, image_addresses_of_16_bits_and_clamps, and cube_gradients_pick_the_level) pass on both RTX 5090 and WARP with dxil.dll validation.

Blocking issue: image_get_resinfo drops a16 masking

In crates/victory-shader/src/emit/lower.rs:7925 (if op == 72), changing addr_val(self, 0)? to addr_at(self, 0, false, 0)? hard-codes a16 = false and reads all 32 bits of the mip-level VGPR instead of masking to the low 16 bits when a16 is set.

Reproduced with a synthetic 8x4 3-mip image_get_resinfo compute probe on both RTX 5090 and WARP when a16 = 1 and the upper 16 bits of the address VGPR are non-zero:

  • 0xFFFF_0000 (mip 0): main returns (8, 4), PR head returns (0, 0) on both RTX 5090 and WARP
  • 0x1234_0001 (mip 1): main returns (4, 2), PR head returns (0, 0) on both RTX 5090 and WARP
  • 0x5678_0002 (mip 2): main returns (2, 1), PR head returns (0, 0) on both RTX 5090 and WARP

Restoring addr_val(self, 0)? at crates/victory-shader/src/emit/lower.rs:7925 fixes all cases on both adapters while keeping all existing _g16 and a16 tests green. Please also add a regression test for image_get_resinfo with a16 = 1 and non-zero upper 16 bits.

<!-- greyfinch-sync:Marvisak/VIctory:review:6078507025 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#pullrequestreview-6078507025). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T17:39:26Z. **Review:** CHANGES_REQUESTED --- Tested merged onto `main` (`63bcca43`) on an RTX 5090, Microsoft WARP, and Windows SDK `dxil.dll`: - `cargo xtask policy` (`191 files ok`; `crates/victory-shader/src/emit/lower.rs` = `520,886` B `< 524,288` B) and `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`) pass. - All 24 new/updated tests (`gfx10::fields::tests::` 21/21, `gradient_samples_of_16_bits`, `image_addresses_of_16_bits_and_clamps`, and `cube_gradients_pick_the_level`) pass on both RTX 5090 and WARP with `dxil.dll` validation. ### Blocking issue: `image_get_resinfo` drops `a16` masking In `crates/victory-shader/src/emit/lower.rs:7925` (`if op == 72`), changing `addr_val(self, 0)?` to `addr_at(self, 0, false, 0)?` hard-codes `a16 = false` and reads all 32 bits of the mip-level VGPR instead of masking to the low 16 bits when `a16` is set. Reproduced with a synthetic 8x4 3-mip `image_get_resinfo` compute probe on both RTX 5090 and WARP when `a16 = 1` and the upper 16 bits of the address VGPR are non-zero: - `0xFFFF_0000` (mip 0): `main` returns `(8, 4)`, PR head returns `(0, 0)` on both RTX 5090 and WARP - `0x1234_0001` (mip 1): `main` returns `(4, 2)`, PR head returns `(0, 0)` on both RTX 5090 and WARP - `0x5678_0002` (mip 2): `main` returns `(2, 1)`, PR head returns `(0, 0)` on both RTX 5090 and WARP Restoring `addr_val(self, 0)?` at `crates/victory-shader/src/emit/lower.rs:7925` fixes all cases on both adapters while keeping all existing `_g16` and `a16` tests green. Please also add a regression test for `image_get_resinfo` with `a16 = 1` and non-zero upper 16 bits.
Dukestar69 commented 2026-11-26 18:51:34 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T18:51:34Z.

Review: APPROVED


LGTM — verified on RTX 5090 and VICTORY_WARP=1 (Windows / D3D12) against origin/main (63bcca4).

  • Decoding and lowering _g16 (16-bit gradients) independently from a16 (16-bit address coordinates) cleanly fixes MIMG gradient address packing and DXIL lowering.
  • cargo test -p victory-shader --lib gfx10:: -- --test-threads=1: 37 passed, 0 failed.
  • cargo test -p victory-shader --lib emit::valu_tests::gradient_samples_of_16_bits & image_addresses_of_16_bits_and_clamps: both passed on RTX 5090 and VICTORY_WARP=1.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6079185115 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#pullrequestreview-6079185115). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T18:51:34Z. **Review:** APPROVED --- LGTM — verified on RTX 5090 and `VICTORY_WARP=1` (Windows / D3D12) against `origin/main` (`63bcca4`). - Decoding and lowering `_g16` (16-bit gradients) independently from `a16` (16-bit address coordinates) cleanly fixes MIMG gradient address packing and DXIL lowering. - `cargo test -p victory-shader --lib gfx10:: -- --test-threads=1`: 37 passed, 0 failed. - `cargo test -p victory-shader --lib emit::valu_tests::gradient_samples_of_16_bits` & `image_addresses_of_16_bits_and_clamps`: both passed on RTX 5090 and `VICTORY_WARP=1`. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
andrewpozdnakov7-jpg commented 2026-11-27 08:26:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-27T08:26:10Z.


@KainanP I combined Steven's six-face cube test and the a16 mip-query fix on the current 3c7c10f head. The branch keeps the two changes as separate commits with their original authors. A third commit handles the Clippy warning in the cube test.

With WARP 1.0.22, all 31 VALU tests passed on the branch. The combined tree on main 63bcca4 passed 38 VALU tests before the Clippy-only follow-up. These runs cover the existing 2D and volume readbacks, all six cube faces and the packed mip queries. Strict all-features shader Clippy and asset policy passed on the published branch. The independent RTX 5080 and WARP report has the per-adapter mip counts.

Please retain the Git authors if you pick up these commits. If you fold in the mip fix, please add:

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted with Codex. Synthetic textures and shaders.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7213534222 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7213534222). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-27T08:26:10Z. --- @KainanP I combined Steven's six-face cube test and the a16 mip-query fix on the current `3c7c10f` head. The [branch](https://github.com/andrewpozdnakov7-jpg/VIctory/tree/review/pr2372-cube-and-mip) keeps the two changes as separate commits with their original authors. A third commit handles the Clippy warning in the cube test. With WARP 1.0.22, all 31 VALU tests passed on the branch. The combined tree on main `63bcca4` passed 38 VALU tests before the Clippy-only follow-up. These runs cover the existing 2D and volume readbacks, all six cube faces and the packed mip queries. Strict all-features shader Clippy and asset policy passed on the published branch. The [independent RTX 5080 and WARP report](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7181997449) has the per-adapter mip counts. Please retain the Git authors if you pick up these commits. If you fold in the mip fix, please add: Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted with Codex. Synthetic textures and shaders.
KainanP commented 2026-11-27 10:35:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-27T10:35:15Z.


@andrewpozdnakov7-jpg @steven-seagull27 thank you both. The cube regression and the mip-query fix are now on the branch, and the head is 3e624cc.

I cherry-picked all three commits from review/pr2372-cube-and-mip as they were, with your Git authors kept. Nothing was folded, so the mip fix stays as @andrewpozdnakov7-jpg's own commit. I then rebased the branch on main 63bcca4, with no conflicts. The rebased tree is identical to a plain merge of your branch into main.

I reviewed the mip fix and it is right. Under a16, RDNA2 packs every address component two per VGPR, the LOD included, and image_get_resinfo takes its level as the first address component. The #1209 rework (commit 2 here) read that word whole with addr_at(self, 0, false, 0), so any high half became part of the level. Your change restores addr_val, which is what main uses. Gradients are not involved, so it does not interact with the _g16 reads. I found no problems in the cube test or the Clippy commit.

cargo test -p victory-shader --lib --locked, skipping heap_direct_texture_reads_mark_their_heap_index (it crashes the RTX test process on main too):

adapter this branch main 63bcca4
RTX 4060 Laptop 322 passed, 3 failed 298 passed, the same 3 failed
Intel UHD (8086:a78b) 315 passed, 10 failed 291 passed, the same 10 failed
WARP 321 passed, 4 failed 297 passed, the same 4 failed
  • cube_gradients_of_16_bits, resinfo_a16_reads_the_low_mip_half and gradient_samples_of_16_bits (2D and volume) pass on all three adapters.
  • Each failure list is identical to main's on the same adapter, so none comes from this PR. On RTX they are the two stride_tests heap-buffer reads and gathers_at_a_level_match_the_hardware. On WARP they are that gather test and three hardware-only synthetic_tests. On Intel they are the BVH, wave16 and 64-bit-atomic tests already known there.
  • Intel was selected with a local adapter hook that is not committed, and its log confirms that every shader host ran on 8086:a78b.
  • Clippy -D warnings is clean with the CI's two configurations (default and --all-features), and cargo xtask policy reports 191 files ok.

I updated the PR description: cube faces and mip queries are now in its test list, and the cube line is gone from "Not measured".

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7216064464 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7216064464). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T10:35:15Z. --- @andrewpozdnakov7-jpg @steven-seagull27 thank you both. The cube regression and the mip-query fix are now on the branch, and the head is `3e624cc`. I cherry-picked all three commits from `review/pr2372-cube-and-mip` as they were, with your Git authors kept. Nothing was folded, so the mip fix stays as @andrewpozdnakov7-jpg's own commit. I then rebased the branch on `main` `63bcca4`, with no conflicts. The rebased tree is identical to a plain merge of your branch into `main`. I reviewed the mip fix and it is right. Under a16, RDNA2 packs every address component two per VGPR, the LOD included, and `image_get_resinfo` takes its level as the first address component. The #1209 rework (commit 2 here) read that word whole with `addr_at(self, 0, false, 0)`, so any high half became part of the level. Your change restores `addr_val`, which is what `main` uses. Gradients are not involved, so it does not interact with the `_g16` reads. I found no problems in the cube test or the Clippy commit. `cargo test -p victory-shader --lib --locked`, skipping `heap_direct_texture_reads_mark_their_heap_index` (it crashes the RTX test process on `main` too): | adapter | this branch | `main` `63bcca4` | |---|---|---| | RTX 4060 Laptop | 322 passed, 3 failed | 298 passed, the same 3 failed | | Intel UHD (8086:a78b) | 315 passed, 10 failed | 291 passed, the same 10 failed | | WARP | 321 passed, 4 failed | 297 passed, the same 4 failed | - `cube_gradients_of_16_bits`, `resinfo_a16_reads_the_low_mip_half` and `gradient_samples_of_16_bits` (2D and volume) pass on all three adapters. - Each failure list is identical to `main`'s on the same adapter, so none comes from this PR. On RTX they are the two `stride_tests` heap-buffer reads and `gathers_at_a_level_match_the_hardware`. On WARP they are that gather test and three hardware-only `synthetic_tests`. On Intel they are the BVH, wave16 and 64-bit-atomic tests already known there. - Intel was selected with a local adapter hook that is not committed, and its log confirms that every shader host ran on `8086:a78b`. - Clippy `-D warnings` is clean with the CI's two configurations (default and `--all-features`), and `cargo xtask policy` reports 191 files ok. I updated the PR description: cube faces and mip queries are now in its test list, and the cube line is gone from "Not measured". _AI use: Claude Code (Claude Opus 5.5)._
KainanP commented 2026-11-27 13:01:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-27T13:01:39Z.


@fuzeofficlal thanks for the blocking catch. It's fixed on the current head 3e624ccd: image_get_resinfo reads its level with addr_val(self, 0) again, which honours a16 (commit 7eb7f262 by @andrewpozdnakov7-jpg). The new test resinfo_a16_reads_the_low_mip_half puts a non-zero high half in the mip VGPR and passes on RTX 4060 Laptop, Intel UHD (16-lane) and WARP; it failed on the previous head. Full victory-shader --lib on all three adapters shows only main's known failures (details in my comment above). Could you take another look?

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7218966901 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7218966901). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-27T13:01:39Z. --- @fuzeofficlal thanks for the blocking catch. It's fixed on the current head `3e624ccd`: `image_get_resinfo` reads its level with `addr_val(self, 0)` again, which honours a16 (commit `7eb7f262` by @andrewpozdnakov7-jpg). The new test `resinfo_a16_reads_the_low_mip_half` puts a non-zero high half in the mip VGPR and passes on RTX 4060 Laptop, Intel UHD (16-lane) and WARP; it failed on the previous head. Full `victory-shader --lib` on all three adapters shows only main's known failures (details in my comment above). Could you take another look? _AI use: Claude Code (Claude Opus 5.5)._
KainanP commented 2026-11-29 12:06:06 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-29T12:06:06Z.


@fuzeofficlal gentle ping for a re-review when you have time. The blocker from your review is fixed on the current head 3e624ccd, which still merges cleanly on main 63bcca43 with green CI:

  • image_get_resinfo reads its level with addr_val(self, 0) again, so a16 keeps only the low half (7eb7f262, by @andrewpozdnakov7-jpg).
  • The regression test you asked for, resinfo_a16_reads_the_low_mip_half, puts a non-zero high half in the mip VGPR. It failed on the old head and passes on RTX 4060 Laptop, Intel UHD and WARP.
  • Also new since your review: @steven-seagull27's six-face cube test (cube_gradients_of_16_bits).

Thanks!

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7255567262 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2372#issuecomment-7255567262). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-29T12:06:06Z. --- @fuzeofficlal gentle ping for a re-review when you have time. The blocker from your review is fixed on the current head `3e624ccd`, which still merges cleanly on `main` `63bcca43` with green CI: - `image_get_resinfo` reads its level with `addr_val(self, 0)` again, so a16 keeps only the low half (`7eb7f262`, by @andrewpozdnakov7-jpg). - The regression test you asked for, `resinfo_a16_reads_the_low_mip_half`, puts a non-zero high half in the mip VGPR. It failed on the old head and passes on RTX 4060 Laptop, Intel UHD and WARP. - Also new since your review: @steven-seagull27's six-face cube test (`cube_gradients_of_16_bits`). Thanks! _AI use: Claude Code (Claude Opus 5.5)._
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2372:upstream-pr/2372'
git switch 'upstream-pr/2372'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2372'
git switch 'upstream-pr/2372'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2372'
git switch 'upstream-pr/2372'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2372'
git switch 'main'
git merge --squash 'upstream-pr/2372'
git switch 'main'
git merge --ff-only 'upstream-pr/2372'
git switch 'main'
git merge 'upstream-pr/2372'
git push origin 'main'
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
Marvisak/VIctory!2370
No description provided.