Shader tests: bind a structured view as the raw view the host makes #2322
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2322
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2322/head"
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?
@Calvix2k on GitHub · 2026-11-25 10:39 UTC · original
Calvix2k:codex/shader-test-structured-raw-2317→main· +93 −40 · 1 files · 1 commits · closed without mergingShader 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.
The dispatch harness built a structured SRV (StructureByteStride) for `View::Buffer` with `Stride::Structured`, while `victory-gpu` binds every title 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_stride` read element 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 warnings` clean on Windows 10 19045 / RX 7800 XT with SM 6.6 through the Agility runtime for the test binaries.@steven-seagull27 on GitHub · 2026-11-25 11:10 UTC · original
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 #1887@welisonzika14-jpg on GitHub · 2026-11-25 11:37 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 15:17 UTC · original
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
@Calvix2k on GitHub · 2026-11-25 16:08 UTC · original
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