Shader tests: bind a structured view as the raw view the host makes #2320
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2322"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T10:39:53Z.
Shader tests: bind a structured view as the raw view the host makes
The dispatch harness built a structured SRV (StructureByteStride) for
View::BufferwithStride::Structured, whilevictory-gpubinds everytitle buffer as a raw byte-address SRV and carries the element size in the
view-stride table; the lowered code multiplies by that stride itself
("Buffer views at computed heap indices"). A driver that honours the
descriptor's stride then scales the byte index a second time: on an
RTX 5070 Ti,
a_heap_buffer_read_by_element_takes_the_views_stridereadelement 3·lane+1 instead of lane (12-byte elements), which is index ×
stride/4, and ran off the buffer into zeros after element 31 (#2317). AMD
and WARP returned the byte address as written, which is why the test passes
on the card here.
Bind the raw view, as production does, and keep the typed arms unchanged.
The new test pins the raw descriptor so a structured one cannot come back.
249 passed, 3 ignored, clippy
-D warningsclean on Windows 10 19045 /RX 7800 XT with SM 6.6 through the Agility runtime for the test binaries.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T10:44:21Z.
Review: APPROVED
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 (Blackwell) and WARP:emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stridenow passes (fixing#2317)! (The remainingstride_testsfailure on RTX 5090 is the separate pre-existing#1835a_heap_buffer_read_where_no_buffer_view_is_reads_zeros.)cargo test -p victory-shader stride_tests: 5/6 passed on RTX 5090 (target test passing), 6/6 passed on WARP.cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:53:59Z.
Review: APPROVED
Tested locally: merged into main
940d32f69b,cargo test -p victory-shader --lockedon macOS arm64 — 144 passed, 0 failed, 2 ignored (Windows-gated hardware execution tests not run here). Approving — test-only: structured view bound as the raw view the host takes.Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-25T11:10:26Z.
Confirmed the translated shader fix on native Windows. I compared the parent
940d32f6and this head68470471using the existing 12-byte element-stride test. Each cell below is the number of incorrect values in a completed 32-lane readback.On the RTX the first three lanes changed from
101, 104, 107to the expected200, 201, 202. Both new descriptor unit tests also passed.One follow-up for the differential suite:
translated_compute_matches_pcsends its original DXC-compiled HLSL through this samedispatchhelper. I tested that path with an independentStructuredBuffer<uint4>shader reading the second word of 32 records. The parent returned all 32 expected values on both adapters. On this head, a check immediately before SRV creation found a raw view of 128 dwords with stride 0, where the shader declares 32 records with stride 16. The probe stopped there on each adapter, so there is no native readback for that cell.I tried AlanQiang0418’s
dispatch_pcsplit from #1887 on top of this head. Both adapters then returned200…231from the native shader and the translated test. Keeping that split would let this fix land without weakening the native reference that other shader PRs are compared against. These are synthetic Windows shader tests. Existing implementation in #1887Imported from Marvisak/VIctory. Originally posted by welisonzika14-jpg on 2026-11-25T11:37:55Z.
RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC. No game files, unit tests only. Head
6847047merged ontomain940d32f,cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.victory-shadermaina_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardwarepass on this card with it. The one left isa_heap_buffer_read_where_no_buffer_view_is_reads_zeros, the view heap cap (#1744).victory-gpuis the same asmain(141 ok, the 2 heap cap tests fail). No new failures.This matches what I saw with the same test-host change by hand yesterday (in #1762). #2323 fixes only the gather test of the two, so the two overlap.
Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:17:59Z.
Automated triage for the maintainers.
Needs work. The diagnosis is right: the translated code reads heap buffers by byte address, so a structured descriptor makes NVIDIA apply the stride twice (#2317). But
buffer_view_descinemit/host.rschangesStride::Structuredfor every caller ofHost::dispatch, including the native PC reference indiff_tests::translated_compute_matches_pc. That shader is compiled with DXC and declaresStructuredBuffer<S> structured : register(t2); with this change it gets a raw SRV with stride 0. Binding a raw view to a structured declaration is undefined, so the reference other shader PRs are compared against becomes unreliable (a commenter here reports the same). Please either keep the structured descriptor for the PC-side dispatch (for example thedispatch_pcsplit from #1887), or change only the fixtures whose translated code reads raw; #2357 does the latter for both failing tests without touching the harness. CI: passing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Calvix2k on 2026-11-25T16:08:31Z.
Closing in favour of #2357, as the triage proposes: it fixes both failing tests by changing only the fixtures whose translated code reads raw, without binding a raw view to the
StructuredBufferthe PC-side reference indiff_tests::translated_compute_matches_pcdeclares. That is the safer split, and it is green. The diagnosis here stands and #2357 carries it.Pull request closed