Repository navigation
Conversation
The shader reads a heap buffer by element as the hardware does: element times the view's stride (the host's table) plus the offset, as a raw byte-address load. `a_heap_buffer_read_by_element_takes_the_views_stride` and `gathers_at_a_level_match_the_hardware` bound a structured view there instead (stride 12 and 16). A raw load through a structured view is outside what DXIL defines: WARP and AMD read the byte address, NVIDIA applies the view's stride on top and reads the wrong elements (Marvisak#1835). The host makes every heap buffer view raw (`descriptor/host.rs`), so the tests now bind raw views, and check what runs in the game.
|
I ran the two affected synthetic tests on native Windows with an RTX 4070 Ti (621.01). Both failed on
One scope clarification for the description: AI-assisted with Codex. |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:
- Using
Stride::Rawfor heap buffer views fixesa_heap_buffer_read_by_element_takes_the_views_strideon RTX 5090 (note: overlaps in scope with#2322/#1887). cargo test -p victory-shader a_heap_buffer_read_by_element_takes_the_views_stride: 1/1 passed on RTX 5090, 1/1 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).
|
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 |
catminou4
left a comment
There was a problem hiding this comment.
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 — test-only: heap buffer views raw, as the host makes them.
|
Part 2 of #1835 is already in flight: #2322 ( The evidence behind it is in #2317: on the 5070 Ti the failure read So if #2322 lands first, the
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 ( |
|
Tested on an RTX 4070 Ti (NVIDIA driver 621.01, Windows 11 Pro build 26300, Rust 1.98.1 pinned), on top of main
Result: 246 passed, 1 failed, 3 ignored (on plain 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 (comment). #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). |
|
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 Generated by Claude Code |
|
Tested on Windows with AMD Ryzen 5 5600X + NVIDIA GeForce RTX 4060:
|
|
Tested on NVIDIA GeForce RTX 3060 12 GB (driver 610.88, Windows 11).
Both |
fyernald
left a comment
There was a problem hiding this comment.
The fix is right, and it does what it says on Windows 10 too: Windows 10 Pro 22H2 (19045), RTX 3080 (617.42), main + #486, cargo test -p victory-shader --lib --locked -- --test-threads=1:
victory-shader |
|
|---|---|
| base | 244 passed / 3 failed |
this PR (dd25e37) |
246 / 1 (only a_heap_buffer_read_where_no_buffer_view_is_reads_zeros left: the heap cap) |
| this PR + #2461 | 247 / 0 |
One change before merging: the new comment in stride_tests.rs still says
A raw view, as the host makes every heap buffer view
You agreed in this thread that this is too broad. buffer_srv (crates/victory-gpu/src/descriptor/host.rs) passes the title's own description to CreateShaderResourceView, so a title's structured view stays structured. The PR description was updated, but this comment will outlive it. It also tells the next person looking at FIND-11 (the runtime's structured views on NVIDIA) that the runtime case can't happen. Something like this would match what the code does:
// A raw view, as this fixture's shader reads it (by byte address, the
// stride from the table alone). The runtime keeps a title's structured
// view as it is (`buffer_srv`): that case is #1835 / FIND-11.The synthetic_tests.rs comment ("a raw view, as the host makes") has the same problem, though less strongly worded.
|
First Blackwell run, and on the current head of
This PR merges cleanly onto Written with AI help (Claude Code); the numbers are from runs on my machine. |
|
Verified on Windows 11 with an RTX 5080 Laptop GPU (driver 621.01). Both targeted shader tests failed on
I 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. |
|
Automated triage for the maintainers, second look (a review against current 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 If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution. |
Addresses 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 NVIDIA D3D12 (70564ae): stride_tests & synthetic_tests fail due to HEAP_VIEWS (2M > 1M NVIDIA limit) and Stride::Structured with rawBufferLoad #1835.