Shader tests: heap buffer views are raw, as the host makes them #2357
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!2357
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2357/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?
@LICObr on GitHub · 2026-11-25 11:35 UTC · original
LICObr:shader-tests/raw-heap-views→main· +5 −2 · 2 files · 1 commits · closed without mergingAddresses parts 2 and 3 of #1835, the test-fixture ones: on NVIDIA,
stride_tests::a_heap_buffer_read_by_element_takes_the_views_strideandsynthetic_tests::gathers_at_a_level_match_the_hardware. Part 1 (HEAP_VIEWSpast NVIDIA's 1,000,000 cap) is a host design question with several open PRs and is not touched here.Problem
A heap buffer read by element has no used-resource entry, so the translator addresses it as the hardware does (
lower.rs, "A heap-indexed buffer read by element"). It computes element × the view's stride from theVIEW_STRIDEStable, plus the offset, and issues a raw byte-address load (raw_view, kind 11). Theoffenreads in the synthetic test take the same raw path.The host's own buffer views are raw:
R32_TYPELESS,StructureByteStride = 0,BUFFER_SRV_FLAG_RAW(descriptor/host.rs). The two tests bound a structured view there instead (Stride::Structured(12)andStride::Structured(16)).A raw load through a structured view is outside what DXIL defines:
[101, 104, 107, …, 131, 0, …]instead of[200, 201, …]: dwords 3, 12, 21, …, then out of bounds.So on NVIDIA the tests failed on the fixture, not on the translation.
Scope: this covers the raw fixtures only. A structured SRV the title creates keeps its stride when the host makes its view (
buffer_srv), and a raw load reaching such a view at runtime is the case still tracked in #1835 (comment).Change
Stride::Raw. The stride still comes from the table only (data: vec![4, 12]), so the stride test checks what it is named for.Verification
cargo clippy -p victory-shader --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings: clean.940d32f): both clippy steps clean,cargo test --workspace --lockedpasses. Run940d32fand pass ondd25e37. That includes the full gather comparison and the lane-0 mismatch from part 3 of #1835.@DrDarkDK on GitHub · 2026-11-25 11:39 UTC · original
I ran the two affected synthetic tests on native Windows with an RTX 4070 Ti (621.01). Both failed on
940d32fand passed ondd25e37.a_heap_buffer_read_by_element_takes_the_views_stride: the parent returned[101, 104, 107, ...]; the PR passed the expected200..231readback.gathers_at_a_level_match_the_hardware: the parent failed at lane 0 with[0, 1, 0, 0]versus[0, 0, 0, 0]. The raw fixture passed the full comparison, including lane 0.One scope clarification for the description:
buffer_srvpreserves an explicit structured SRV’s stride when it creates the host view. This verifies the raw fixtures. The runtime structured-view case is still tracked in #1835.AI-assisted with Codex.
@LICObr on GitHub · 2026-11-25 11:44 UTC · original
Thanks for running it on real NVIDIA hardware, that's exactly the confirmation this needed. Good catch on the scope too: you're right that
buffer_srvkeeps a title-made structured SRV's stride, so "the host makes every heap buffer view raw" was too broad. I've updated the description to say this covers the raw fixtures only, with the runtime structured-view case still tracked in #1835, and added your results (including lane 0) under Verification.@Calvix2k on GitHub · 2026-11-25 12:25 UTC · original
Part 2 of #1835 is already in flight: #2322 (
Shader tests: bind a structured view as the raw view the host makes) makes exactly that change —Stride::Structuredyields a raw byte-address SRV, asvictory-gpubinds title buffers, plus a test that pinsStructureByteStride = 0so a structured descriptor cannot come back.The evidence behind it is in #2317: on the 5070 Ti the failure read
101 + 3·lanewhere the buffer's elements are 12 bytes — element3·lane + 1, i.e.(12·lane + 4) × 12/4, the byte index the DXIL passes scaled by the descriptor's stride a second time. AMD and WARP take the byte index as written, which is why it passes everywhere else.So if #2322 lands first, the
stride_testshalf of this PR disappears in the rebase and only your part 3 remains:synthetic_tests::gathers_at_a_level_match_the_hardware— the RDNA2 rounding the test asserts (the comment in that file says the hardware rounds the exact product to 1/256 of a texel, half up, which WARP does not). That one is worth doing properly, and it is not a fixture question in the same sense: DXIL has no form forimage_gather4_lat a non-zero level, so the expectation has to come from somewhere. Comparing against the same gather at level 0 with pre-multiplied coordinates, or skipping the non-zero-level case with a comment naming the vendor difference, are both defensible; the second is smaller and honest.Not asking you to drop anything — just so neither of us is surprised when one of the two stride patches conflicts with the other. If yours is preferred for some reason, the test I add (
a_structured_test_view_is_bound_as_the_host_binds_it) is the only thing worth carrying over from mine.@qtLkz on GitHub · 2026-11-25 12:30 UTC · original
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 passesstride_tests::a_heap_buffer_read_by_element_takes_the_views_stride: now passesstride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros: still fails on this card,hardware: dispatch failed: invalid parameteratstride_tests.rs:347Result: 246 passed, 1 failed, 3 ignored (on plain
940d32f: 244 passed, 3 failed).For comparison on the same machine, #2322 (which fixes the shared test harness instead of the individual tests) makes all three pass: 249 passed, 0 failed, 3 ignored, see #2317. #2323 also targets the gather test only. These three PRs cover the same NVIDIA false failures, so only one of them should land; on NVIDIA, #2322 is the only one that clears all three.
AI-assisted (Claude).
@Marvisak on GitHub · 2026-11-25 15:33 UTC · original
Automated triage for the maintainers.
Merge candidate (test fixture). Two synthetic tests bound a structured SRV for a buffer that the lowered code reads by byte address, using the stride from
VIEW_STRIDES(lower.rs, "A heap-indexed buffer read by element"). The host makes such views raw (R32_TYPELESS,StructureByteStride: 0,BUFFER_SRV_FLAG_RAWindescriptor/host.rs), so switching both fixtures toStride::Rawmatches the host, and the stride still comes from the table only, so the stride test still tests what it is named for. No translator or host code changes. A contributor confirmed both tests fail before and pass after on an RTX 4070 Ti. Overlap: #2322 does this in the harness instead (and is needs-work because it also changes the PC reference path); #2323 is the gather half alone. One NVIDIA run reports #2322 also clearsa_heap_buffer_read_where_no_buffer_view_is_reads_zeros, which still fails with this PR (the heap-cap issue, #1744). CI: passing.Generated by Claude Code
@Vedoxdev123 on GitHub · 2026-11-25 15:51 UTC · original
Tested on Windows with AMD Ryzen 5 5600X + NVIDIA GeForce RTX 4060:
cargo test -p victory-shader-> 246 passed; 1 failed; 3 ignored (down from 3 failures onmain).emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stridenow passesemit::synthetic_tests::gathers_at_a_level_match_the_hardwarenow passesemit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros(hardware: dispatch failed: The parameter is incorrect.)@fabianocoder on GitHub · 2026-11-25 16:14 UTC · original
Tested on NVIDIA GeForce RTX 3060 12 GB (driver 610.88, Windows 11).
cargo test -p victory-shader --lib --locked -- --test-threads=1940d32f): 244 passed, 3 failed, 3 ignoreddd25e37): 246 passed, 1 failed, 3 ignoredBoth
a_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardwarenow pass on hardware.The remaining failure is
a_heap_buffer_read_where_no_buffer_view_is_reads_zeros(E_INVALIDARG, the HEAP_VIEWS cap from #1835 part 1), which this PR doesn't target@alonso49noob on GitHub · 2026-11-25 17:43 UTC · original
First Blackwell run, and on the current head of
main(13f91ca, 83 commits after the940d32fused above): RTX 5060 8 GB, driver 621.01, Windows 11, Rust 1.98.1.cargo test -p victory-shader --libmain13f91ca[101, 104, 107, …, 131, 0, …]and lane 0[0, 1, 0, 0]main+ this PR (dd25e37) + #2587 (df8ee8e), local mergeThis PR merges cleanly onto
13f91ca. #2587 is included only so the suite gets past the #2571 crash. The one failure left isa_heap_buffer_read_where_no_buffer_view_is_reads_zeros(stride_tests.rs:352), theHEAP_VIEWScap from #1835 part 1, which this PR does not target.Written with AI help (Claude Code); the numbers are from runs on my machine.
@yumaste on GitHub · 2026-11-25 20:23 UTC · original
Verified on Windows 11 with an RTX 5080 Laptop GPU (driver 621.01).
Both targeted shader tests failed on
940d32fand passed with #2357 applied:a_heap_buffer_read_by_element_takes_the_views_stridegathers_at_a_level_match_the_hardwareI used the same local adapter-selection change in both runs and confirmed in the D3D12 logs that the NVIDIA GPU was used. Both tests also passed on WARP with the fix applied.
Test automation and write-up assisted by Codex.
@Marvisak on GitHub · 2026-11-25 22:08 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 the old fixtures are the faithful ones. The heap-indexed read gets its 12-byte stride from the view-stride table, which only a structured view gives, and the gather test's input is a table SRV with a used-resource stride; the runtime keeps such a view structured. Switching the fixtures to raw would make the tests describe a runtime
maindoes not have, and hide the NVIDIA defect they currently show (#1835). The fix belongs in the runtime: raw host views for buffers the translator reads raw, or structured handles in the translation.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