Shader tests: the test host's structured buffer views are raw (#1835) #1887
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!1887
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1887/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?
@carlos-seiffert on GitHub · 2026-11-25 00:04 UTC · original
carlos-seiffert:fix/test-host-structured-views-are-raw→main· +63 −10 · 3 files · 4 commits · closed without mergingTest-host part of #1835:
a_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardwarefail on NVIDIA. The heap cap failure there is #1779's. This PR does not fix the runtime; see "What stays open".Cause
The test host's
Stride::Structuredmade a structured SRV (DXGI_FORMAT_UNKNOWNwith aStructureByteStride), and the translated shader reads it with a byte-addressed load, taking the element size from the stride table. WARP ignores the view's stride for that load; NVIDIA applies it a second time, so the hardware run reads the wrong elements ([101, 104, 107, ...]).Change (test-only,
crates/victory-shader/src/emit)Stride::Structuredmakes a raw view for translated shaders, the form the runtime'sraw_view_at/raw_pair_atuse.dispatch_pcbinds the declared structured view for the original PC bytecode indiff_tests::translated_compute_matches_pc(commit by @AlanQiang0418).Stride::StructuredDescmakes the structured view as the runtime makes it today from a title's structured descriptor (descriptor::host::buffer_srvkeepsStructureByteStride). The by-element read runs through both. The newa_heap_buffer_read_by_element_through_the_runtimes_structured_viewpasses on WARP and fails on NVIDIA hardware until the runtime makes such views raw, so the raw test host does not hide that bug.What stays open
The runtime still hands NVIDIA structured views for title buffers read by translated byte-addressed loads. #2178 makes those views raw in
buffer_srv/buffer_uav.StructuredDescreproduces the runtime's view inside the test host, so it does not go green when the runtime is fixed: it describes the runtime only until then. If #2178 lands, theStructuredDesctest should go with it, and I'll drop it here on rebase.On the RTX 2060 the two are complementary: #2178 alone leaves
gathers_at_a_level_match_the_hardwarefailing, and #2178 + #1887 passes it (numbers on #2178).Results
RTX 2060 6 GB (Turing), driver 621.40, Windows 11 26300, on
mainccfb029,cargo test -p victory-shader -- --test-threads=1(hardware, then WARP):main(measured at70564aeandd763582)VICTORY_WARP=1cargo clippy -p victory-shader --all-targetsis clean.translated_compute_matches_pcskips here (no console compiler); its native PC path was checked by @AlanQiang0418 on an RTX 5080.🤖 Generated with Claude Code
@Mericas77 on GitHub · 2026-11-25 00:23 UTC · original
Tested
bb5acbaon an NVIDIA host: RTX 4070 12 GB, driver 621.01, Windows 11 (build 26300), debug build, base70564ae.cargo test -p victory-shader --locked --no-fail-fast70564aeWith this PR,
a_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardwarepass on this card. The gather test fails onmainfor the same reason as the stride test: it reads its input records (offset, u, v, level) from aStride::Structured(16)buffer, so on NVIDIA the gather runs on the wrong coordinates. The remaining failure isa_heap_buffer_read_where_no_buffer_view_is_reads_zeros, which comes from the view heap cap (#1779).One caveat about the premise: "the GPU host makes them raw" is not true at
70564ae.buffer_srv/buffer_uavinvictory-gpu/src/descriptor/host.rspass the title's structured desc (DXGI_FORMAT_UNKNOWN+StructureByteStride) through unchanged, and only #1762 makes them raw. On this card, #1762'sraw_reads_of_structured_views_are_rightfails againstmain's runtime (wrong data from dword 16 on) and passes with #1762.So merged alone, this PR would turn these two tests green on NVIDIA while the runtime still reads structured views wrong in-game. I'd suggest landing it with #1762 or after it. The two merge cleanly, and with both applied the results are as above.
@AlanQiang0418 on GitHub · 2026-11-25 00:27 UTC · original
The translated gather and indexed-buffer tests both pass on my RTX 5080 with this change. There is a separate caller that needs the original structured SRV:
translated_compute_matches_pcalso dispatches native PC bytecode, and that HLSL declaresStructuredBuffer<S>at t2.I compiled the existing “sizes from descriptors” and “sizes for scalar loads” cases with PC DXC and checked each lane's four output words against the CPU expectation on driver 621.14. I kept the HLSL, input bytes, constants and dispatch dimensions fixed.
bb5acbaFor example, word 2 of “sizes from descriptors” on RTX was
0xC0with the raw view and the expected0x78with the structured view.Follow-up commit for this PR keeps your raw view for translated shaders and binds a real structured descriptor for the original PC reference dispatch. The legacy gather, indexed read, and shader all-targets Clippy pass with the follow-up. I ran the two native PC cases independently; the full console-versus-PC suite skipped locally because the console compiler is unavailable.
@carlos-seiffert on GitHub · 2026-11-25 00:59 UTC · original
Thanks @Mericas77 for the RTX 4070 run, and @AlanQiang0418 for catching the native PC reference and for the fix. I've taken your commit as is (9ae875d, authorship kept): translated shaders keep the raw view, and
dispatch_pcbinds the declared structured view for the original PC bytecode. The other native PC dispatch indiff_tests(cube_gradients_pick_the_level) binds no buffer views, so it needs nothing.Re-run on the RTX 2060 (driver 621.40) with both commits:
cargo test -p victory-shader -- --test-threads=1is still 208 passed, 1 failed (the heap cap, #1779), andcargo clippy -p victory-shader --all-targetsis clean. Here tootranslated_compute_matches_pcskips internally (no console compiler), so its native PC path is covered only by your run.🤖 Generated with Claude Code
@Marvisak on GitHub · 2026-11-25 08:19 UTC · original · edited 2026-11-25 11:21 UTC
Automated triage for the maintainers.
Merge candidate. This is a test-only change in
crates/victory-shader/src/emit. Inhost.rs(dispatch_with_views),Stride::Structurednow makes a raw view for translated shaders.dispatch_pckeeps the declared structured view for the original PC bytecode indiff_tests::translated_compute_matches_pc. The newStride::StructuredDescbuilds a view the waydescriptor::host::buffer_srvinvictory-gpudoes today, keepingStructureByteStride.On your reply: this takes the second route from the previous review. The corrected description no longer claims that the runtime makes every view raw.
a_heap_buffer_read_by_element_through_the_runtimes_structured_viewruns the same read asa_heap_buffer_read_by_element_takes_the_views_stridethrough the runtime's current structured view, so the raw test host no longer hides #1835.One thing for the maintainer to know: that new test is expected to fail on NVIDIA hardware, and it will keep failing after the runtime is fixed, because it builds its own view. It should be removed when #2178 (open) or another runtime fix lands, as the description says. CI: passing (
check).Generated by Claude Code
@carlos-seiffert on GitHub · 2026-11-25 09:39 UTC · original
The triage is right: I wrote that the runtime makes every buffer view raw, and
buffer_srvdoes not. Since #1762 is closed, I took the second route:5f3cb18addsStride::StructuredDesc, a structured view asbuffer_srvmakes it today, and runs the by-element read through it as well. On the RTX 2060 that test fails on hardware with the same[101, 104, 107, ...]and passes on WARP, so the raw test host no longer hides the runtime bug. The description is corrected and says what stays open.🤖 Generated with Claude Code
@steven-seagull27 on GitHub · 2026-11-25 12:45 UTC · original
I added a Windows-SDK-only regression for the native PC path in AlanQiang0418’s
dispatch_pcfix. It compiles a smallStructuredBuffer<uint4>compute shader and reads the second word of 32 distinct records throughStride::Structured(16). It runs withVICTORY_CONSOLE_DXCunset, so contributors can exercise the native reference on a machine where the full translated-versus-PC comparison skips. The commit is based directly on0172e6b. Regression test,57c170f200…231200…231I also checked the assertions in local controls on both adapters. Appending a 33rd valid record failed the count check. Changing only record 17’s second word from 217 to 317 failed the payload check. The committed test uses the original 32 records.
To pick it onto this branch:
To reproduce with the Windows SDK’s
dxc.exeinstalled:A completed device run prints
native PC readback matched 32 records with a 16-byte stride.@Marvisak on GitHub · 2026-11-25 22:03 UTC · original
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because it breaks the differential test. Merged onto
mainand run with the console compiler set (VICTORY_CONSOLE_DXC),emit::diff_tests::translated_compute_matches_pcfails in three cases ("buffers and root views", "sizes from descriptors", "sizes for scalar loads");mainpasses them. Table-bound structured buffers with a used-resource stride are read through structured handles (sizes in elements, structured loads), and those need the structured view the runtime binds, so the fixtures cannot all be raw. Without the console compiler that test is skipped, which is probably why it passed for the testers here. The NVIDIA symptom of #1835 belongs to the runtime's view creation invictory-gpu.If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed