Shader tests: the gather-at-a-level test reads its records through a raw view (false failure on NVIDIA) #2321

Open
Bullet18x wants to merge 1 commit from upstream-pr/2323 into main
Bullet18x commented 2026-11-25 10:40:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Bullet18x on 2026-11-25T10:40:37Z.


Problem

emit::synthetic_tests::gathers_at_a_level_match_the_hardware fails on NVIDIA, and it looks like a gather bug. It is not one.

The test reads each lane's record (offset, u, v, level) by byte offset through a structured view (Stride::Structured(16)). On NVIDIA a raw load through a structured descriptor multiplies the offset by the stride (the bug #2178 fixes at runtime), so every lane reads zeros. Every lane then returns the gather of (0, 0) at level 0, [0, 1, 0, 0]. So does got(2), the native gather the test checks itself against. RTX 5090, driver 621.40, all 32 lanes:

hardware lane 4  u=0.0624 v=0.0936 level=0  got [0, 1, 0, 0]  want [65, 66, 34, 33]
hardware lane 20 u=0.16   v=0.2044 level=1  got [0, 1, 0, 0]  want [1066, 1067, 1035, 1034]
...

Change

The records go through a raw view (Stride::Raw), as #2178 does for stride_tests. The view's kind is incidental to what the test checks. One line.

Tested

  • RTX 5090: gathers_at_a_level_match_the_hardware passes on the hardware and on WARP. The gathers were right all along.
  • cargo test -p victory-shader --lib on that machine: 237 passed, 10 failed (was 11). The 10 are the two stride_tests (#2178) and 8 that fail only on this Windows build's WARP (10.0.28000), where the hardware matches.
  • cargo clippy -p victory-shader --all-targets --locked -- -D warnings: clean.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6602603164 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2323). Originally posted by [Bullet18x](https://github.com/Bullet18x) on 2026-11-25T10:40:37Z. --- ## Problem `emit::synthetic_tests::gathers_at_a_level_match_the_hardware` fails on NVIDIA, and it looks like a gather bug. It is not one. The test reads each lane's record (offset, u, v, level) by byte offset through a structured view (`Stride::Structured(16)`). On NVIDIA a raw load through a structured descriptor multiplies the offset by the stride (the bug #2178 fixes at runtime), so every lane reads zeros. Every lane then returns the gather of (0, 0) at level 0, `[0, 1, 0, 0]`. So does `got(2)`, the native gather the test checks itself against. RTX 5090, driver 621.40, all 32 lanes: ``` hardware lane 4 u=0.0624 v=0.0936 level=0 got [0, 1, 0, 0] want [65, 66, 34, 33] hardware lane 20 u=0.16 v=0.2044 level=1 got [0, 1, 0, 0] want [1066, 1067, 1035, 1034] ... ``` ## Change The records go through a raw view (`Stride::Raw`), as #2178 does for `stride_tests`. The view's kind is incidental to what the test checks. One line. ## Tested - RTX 5090: `gathers_at_a_level_match_the_hardware` passes on the hardware and on WARP. The gathers were right all along. - `cargo test -p victory-shader --lib` on that machine: 237 passed, 10 failed (was 11). The 10 are the two `stride_tests` (#2178) and 8 that fail only on this Windows build's WARP (10.0.28000), where the hardware matches. - `cargo clippy -p victory-shader --all-targets --locked -- -D warnings`: clean. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
catminou4 commented 2026-11-25 11:04:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:54:00Z.

Review: APPROVED


Tested locally: merged into main 940d32f69b, cargo test -p victory-shader --locked on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — one-line test fix (gather-at-a-level reads its records).

<!-- greyfinch-sync:Marvisak/VIctory:review:6056242153 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2323#pullrequestreview-6056242153). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T10:54:00Z. **Review:** APPROVED --- Tested locally: merged into main 940d32f69b, `cargo test -p victory-shader --locked` on macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — one-line test fix (gather-at-a-level reads its records).
steven-seagull27 commented 2026-11-25 11:05:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-25T10:48:28Z.


Confirmed on an RTX 5080 (driver 621.40). Changing the input view to raw fixed all 64 gather comparisons from my earlier report. The generated gather shader was byte-for-byte identical on the parent and PR. Earlier #1752 readback

I ran the existing test on parent 940d32f and head 9c6e094. I also collected all 32 lanes and ran a separate input check that writes each four-dword record directly to the output immediately after the same record load.

Adapter Input records correct, parent → PR Plain gathers correct, parent → PR Offset gathers correct, parent → PR
RTX 5080 0/32 → 32/32 0/32 → 32/32 0/32 → 32/32
Windows built-in WARP 32/32 → 32/32 32/32 → 32/32 32/32 → 32/32
Microsoft WARP 1.0.22 32/32 → 32/32 32/32 → 32/32 32/32 → 32/32

On the RTX parent, 29 lanes read four zero dwords. The other three lanes (5, 6, 7) each repeated one offset value across all four dwords. Lane 4 is an example of the effect on the result. It gathered [0, 1, 0, 0] on the parent and the expected [65, 66, 34, 33] on the PR. The RTX hardware-only comparison against its native level-zero gather improved from 13/16 to 16/16. Both WARP runs used the expected software device and their respective DLLs.

The original assertions failed on the parent RTX and passed on the PR RTX. Both WARP versions passed the original assertions on both revisions. I ran the existing test on Windows with the following command.

cargo test -p victory-shader --lib --locked emit::synthetic_tests::gathers_at_a_level_match_the_hardware -- --exact --nocapture --test-threads=1
<!-- greyfinch-sync:Marvisak/VIctory:comment:7160199238 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2323#issuecomment-7160199238). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-25T10:48:28Z. --- Confirmed on an RTX 5080 (driver 621.40). Changing the input view to raw fixed all 64 gather comparisons from my earlier report. The generated gather shader was byte-for-byte identical on the parent and PR. [Earlier #1752 readback](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7145928131) I ran the existing test on parent `940d32f` and head `9c6e094`. I also collected all 32 lanes and ran a separate input check that writes each four-dword record directly to the output immediately after the same record load. | Adapter | Input records correct, parent → PR | Plain gathers correct, parent → PR | Offset gathers correct, parent → PR | |---|---:|---:|---:| | RTX 5080 | 0/32 → 32/32 | 0/32 → 32/32 | 0/32 → 32/32 | | Windows built-in WARP | 32/32 → 32/32 | 32/32 → 32/32 | 32/32 → 32/32 | | Microsoft WARP 1.0.22 | 32/32 → 32/32 | 32/32 → 32/32 | 32/32 → 32/32 | On the RTX parent, 29 lanes read four zero dwords. The other three lanes (5, 6, 7) each repeated one offset value across all four dwords. Lane 4 is an example of the effect on the result. It gathered `[0, 1, 0, 0]` on the parent and the expected `[65, 66, 34, 33]` on the PR. The RTX hardware-only comparison against its native level-zero gather improved from 13/16 to 16/16. Both WARP runs used the expected software device and their respective DLLs. The original assertions failed on the parent RTX and passed on the PR RTX. Both WARP versions passed the original assertions on both revisions. I ran the existing test on Windows with the following command. ```powershell cargo test -p victory-shader --lib --locked emit::synthetic_tests::gathers_at_a_level_match_the_hardware -- --exact --nocapture --test-threads=1 ```
JAEdotUK commented 2026-11-25 11:05:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by JAEdotUK on 2026-11-25T10:52:00Z.


Tested PR #2323 on Windows 11 with an AMD Radeon RX 9070 XT. Ran cargo test -p victory-shader --lib --locked -- --test-threads=1 — all 247 tests passed (0 failed) with no regressions on RDNA 4.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7160277402 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2323#issuecomment-7160277402). Originally posted by [JAEdotUK](https://github.com/JAEdotUK) on 2026-11-25T10:52:00Z. --- Tested PR #2323 on Windows 11 with an AMD Radeon RX 9070 XT. Ran cargo test -p victory-shader --lib --locked -- --test-threads=1 — all 247 tests passed (0 failed) with no regressions on RDNA 4.
welisonzika14-jpg commented 2026-11-25 12:03:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by welisonzika14-jpg on 2026-11-25T11:37:56Z.


RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC. No game files, unit tests only. Head 9c6e094 merged onto main 940d32f, cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.

victory-shader: 245 ok, 2 fail (main: 244 ok, 3 fail). gathers_at_a_level_match_the_hardware passes on this card with it. The two left are the stride test and the view heap cap test from #1744. No new failures.

Note: #2322 makes the whole test host's structured views raw, and with it both the gather and the stride test pass here (248 ok, 1 fail). So #2322 looks like it covers this one too.

Written with AI help (Claude/Kiro); the numbers are from runs on my machine.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161297361 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2323#issuecomment-7161297361). Originally posted by [welisonzika14-jpg](https://github.com/welisonzika14-jpg) on 2026-11-25T11:37:56Z. --- RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC. No game files, unit tests only. Head `9c6e094` merged onto `main` `940d32f`, `cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast`. `victory-shader`: 245 ok, 2 fail (`main`: 244 ok, 3 fail). `gathers_at_a_level_match_the_hardware` passes on this card with it. The two left are the stride test and the view heap cap test from #1744. No new failures. Note: #2322 makes the whole test host's structured views raw, and with it both the gather and the stride test pass here (248 ok, 1 fail). So #2322 looks like it covers this one too. Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
qtLkz commented 2026-11-25 13:02:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by qtLkz on 2026-11-25T12:38:23Z.


Tested on an RTX 4070 Ti (NVIDIA driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned), on top of main 940d32f, cargo test -p victory-shader --lib --locked --no-fail-fast:

  • synthetic_tests::gathers_at_a_level_match_the_hardware: now passes, as described
  • the two stride_tests NVIDIA failures from #2317 (a_heap_buffer_read_by_element_takes_the_views_stride, a_heap_buffer_read_where_no_buffer_view_is_reads_zeros) are unchanged, as expected since this PR does not touch them

Result: 245 passed, 2 failed, 3 ignored (on plain 940d32f: 244 passed, 3 failed).

Overlap note: #2322 fixes the same gather failure through the shared test harness, plus both stride tests; on this card it gives 249 passed, 0 failed (https://github.com/Marvisak/VIctory/issues/2317#issuecomment-7162296847). #2357 is a third PR on the same failures. Only one of the three should land.

AI-assisted (Claude).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162650861 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2323#issuecomment-7162650861). Originally posted by [qtLkz](https://github.com/qtLkz) on 2026-11-25T12:38:23Z. --- Tested on an RTX 4070 Ti (NVIDIA driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned), on top of main `940d32f`, `cargo test -p victory-shader --lib --locked --no-fail-fast`: - `synthetic_tests::gathers_at_a_level_match_the_hardware`: now passes, as described - the two `stride_tests` NVIDIA failures from #2317 (`a_heap_buffer_read_by_element_takes_the_views_stride`, `a_heap_buffer_read_where_no_buffer_view_is_reads_zeros`) are unchanged, as expected since this PR does not touch them Result: 245 passed, 2 failed, 3 ignored (on plain `940d32f`: 244 passed, 3 failed). Overlap note: #2322 fixes the same gather failure through the shared test harness, plus both stride tests; on this card it gives 249 passed, 0 failed (https://github.com/Marvisak/VIctory/issues/2317#issuecomment-7162296847). #2357 is a third PR on the same failures. Only one of the three should land. AI-assisted (Claude).
Marvisak commented 2026-11-25 16:09:08 +00:00 (Migrated from github.com)

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


Automated triage for the maintainers.

Proposed close (duplicate). The change is correct: the gather test reads its records by byte address, so a raw view is the right fixture, and the NVIDIA readbacks in the comments confirm it. However, open PR #2357 makes exactly this one-line change in synthetic_tests::gathers_at_a_level_match_the_hardware and also fixes the matching NVIDIA failure in stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride, so only one of them should land. CI: passing.

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


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166623198 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2323#issuecomment-7166623198). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T15:18:03Z. --- <!-- victory-triage v1 head=9c6e094241315666e1e11cb3c6ece627f649f8cd verdict=proposed-close at=2026-11-25T15:19:00Z --> Automated triage for the maintainers. **Proposed close (duplicate).** The change is correct: the gather test reads its records by byte address, so a raw view is the right fixture, and the NVIDIA readbacks in the comments confirm it. However, open PR #2357 makes exactly this one-line change in `synthetic_tests::gathers_at_a_level_match_the_hardware` and also fixes the matching NVIDIA failure in `stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride`, so only one of them should land. CI: passing. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the label. --- _Generated by [Claude Code](https://claude.ai/code)_
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/2323:upstream-pr/2323'
git switch 'upstream-pr/2323'

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/2323'
git switch 'upstream-pr/2323'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2323'
git switch 'upstream-pr/2323'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2323'
git switch 'main'
git merge --squash 'upstream-pr/2323'
git switch 'main'
git merge --ff-only 'upstream-pr/2323'
git switch 'main'
git merge 'upstream-pr/2323'
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!2321
No description provided.