Skip to content

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

Open
Bullet18x wants to merge 1 commit into
Marvisak:mainfrom
Bullet18x:fix/gather-test-raw-view
Open

Bullet18x wants to merge 1 commit into
Marvisak:mainfrom
Bullet18x:fix/gather-test-raw-view

Conversation

@Bullet18x

Copy link
Copy Markdown

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 (GPU+shader: back structured buffer views with raw descriptors for NVIDIA rawBufferLoad #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

…raw view

gathers_at_a_level_match_the_hardware reads each lane's record (offset,
u, v, level) by byte offset through a structured view (stride 16). On
NVIDIA a raw load through a structured descriptor multiplies the offset by
the stride (Marvisak#2178), so every lane read zeros and every lane failed with the
gather of (0, 0) at level 0, [0, 1, 0, 0], including the native gather the
test compares against: it looked like a gather bug, and is none.

The records go through a raw view, as Marvisak#2178 does for stride_tests. On an
RTX 5090 the test then passes on the hardware and on WARP; the gathers
were right all along.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@steven-seagull27

Copy link
Copy Markdown

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

@JAEdotUK

Copy link
Copy Markdown

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.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally: merged into main 940d32f, 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).

@welisonzika14-jpg

Copy link
Copy Markdown

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

qtLkz commented Nov 25, 2026

Copy link
Copy Markdown

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:

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 (#2317 (comment)). #2357 is a third PR on the same failures. Only one of the three should land.

AI-assisted (Claude).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants