Shaders: LDS sub-dword writes, typed buffers at offsets and of some channels, typed loads by index #1957
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1959"
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 RaghavVijayanand on 2026-11-25T01:45:24Z.
Buffer and LDS gaps in the translator, in four commits. Each builds and passes tests.
0b35b7f) already reads and writes LDS bytes and halves, but writes them with an atomic AND then OR, noted there as a shortcut. When several lanes write the same byte, that merges their bits. The write is now a compare-exchange loop on the dword, so neighbouring bytes are never clobbered and exactly one lane's value lands, as on the console. Main's read path is kept.index + offset / element size.tbuffer_load_format_*by index: reads at byteindex * stride + offset, through main's bindless-stride conversions (a root view's built descriptor takes its stride from dword 1, and a heap descriptor from the view-stride table).Tests: the new
emit/buffer_lds_tests.rs(8 tests) and aView::FormatUavin the test host. Every program is hand-assembled, validated with dxil.dll, run on the default hardware adapter and WARP, and checked against a CPU model.A new test,
typed_format_loads_by_index_from_the_heap_take_the_views_stride, covers the heap path. Each change was broken by hand to confirm the tests fail: AND-then-OR instead of compare-exchange, the offset ignored, kept channels zeroed, the index multiply dropped, and typed loads left out of the view-stride table.Rebased onto current main (
940d32f). On this machine, 5 tests fail on main itself, with or without this change:descriptor::host::tests::dynamic_slots_are_held_until_released,memory::tests::lists_share_a_table_and_copies_keep_their_views, the twostride_tests::a_heap_buffer_read_*tests, andsynthetic_tests::gathers_at_a_level_match_the_hardware. Everything else passes, and clippy passes with-D warnings, with and without--all-features.Imported from Marvisak/VIctory. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T01:45:33Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
[PR #1959] Shaders: LDS bytes and halves, typed buffers at offsets and of some channelsto [PR #1959] Shaders: LDS sub-dword writes, typed buffers at offsets and of some channels, typed loads by indexImported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:19:37Z.
Automated triage for the maintainers.
This pull request no longer merges cleanly into
main(conflicts incrates/victory-shader/src/emit/lower.rs). It will be reviewed once it is rebased onto the currentmain. The earlier verdict (needs work) was for an older state ofmain.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T03:14:11Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.144 passed / 0 failed / 2 ignored. LDS bytes and halves, typed buffers at offsets and of some channels — sub-dword LDS/buffer access completeness; relates to the LDS sub-dword cluster (#632/#116/#101/#571/#996) and #2003's MUBUF d16.
Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T11:01:53Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
40770f94ontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by RaghavVijayanand on 2026-11-26T11:25:49Z.
Rebased onto
main63bcca4. Merged with whatmaingained since:main's bounds guard from #1949. A write past the allocation is dropped, and of lanes writing the same byte, one value wins.main'styped_hhandle (made once per store, for the d16 integer-view path) together with this branch's byte-offset element and partial-channel merge.Each commit builds. Locally (RTX 5060 Laptop): the buffer/LDS/typed tests pass (14 of 15), and clippy is clean.
typed_stores_of_some_channels_keep_the_othersfails on the RTX with "dispatch failed: The parameter is incorrect". That is the same NVIDIA 1M-view-heap-cap failure thatmain's ownstride_tests::a_heap_buffer_*hit there. On WARP it passes along with those two (VICTORY_WARP=1). Before the rebase it passed on the RTX as well.Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-27T03:26:52Z.
RDNA1 run (AMD RX 5700 XT, Navi 10, driver 32.0.21045.29003, Windows 11 26200; from the batch in #3410). Head
a5bb542merged onto main63bcca4.typed_stores_of_some_channels_keep_the_othersremoves the device on the RX 5700 XT. It fails within half a second, every run:The cause looks like the test, not the lowering. The
_d16_xystore reads main's view-stride table (t255, space 1,VIEW_STRIDES) to tell an integer view from a float one, and the test runs with no root views (run(&shader, &views, &[], …)). So the shader reads through an unset root SRV at address 0. WARP tolerates that and passes; this card page-faults. That may also be your RTX 5060's "The parameter is incorrect" since the rebase, which is when the d16 integer-view path came in. I haven't checked it on NVIDIA.How I narrowed it down, one store per run on the hardware adapter:
buffer_store_format_xand_xy, at element offsets 0–3: pass._xyzwith all lanes, and under the half-lane EXEC mask: pass._d16_xyat offsets 0, 1 and 3: device removed, at every offset and in both formats. Its DXIL is the only one with arawBufferLoadfromt255.Giving the test the table, as
stride_testsdoes, fixes it:With that, the test passes 5 of 5 on the RX 5700 XT, run alone with a pause between runs. The full
victory-shader --libsuite passes: 311 passed, 0 failed, 3 ignored. The host side is fine as it is:draw.rsbinds the stride table whenever a shader declaresVIEW_STRIDES.AI use: Claude Code (Claude Opus 5.5).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.