shader: lower partial-channel typed and _d16_hi buffer stores #279
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/readmet3xt-lab--foxhound!279
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-279"
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?
@Texbirds on GitHub · 2026-12-01 08:37 UTC · original
Texbirds:pr/typed-buffer-stores→main· +48 −5 · 3 files · 68 commits · closed without mergingSupersedes #238 (rebased onto rewritten
main297f58a, port ofMarvisak/VIctory#3377adapted to FoxHound's raw-view structured buffer lowering).Summary
buffer_store_format_{x,xy,xyz},buffer_store_format_d16_{x,xy,xyz},buffer_store_format_d16_hi_x) via guarded load-modify-store (bufferLoad+bufferStorewith mask0xFandTYPED_UAV_LOADS).VIEW_INTEGER(self.integer_view(src)?) to use an integer handle(10 | u, 0x405)for integer views and float handle(10 | u, 0x409)for float views so untouched channels are preserved bit-exact (including NaN-shaped integer bit patterns)._d16_hihigh-half extraction forbuffer_store_byte_d16_hi,buffer_store_short_d16_hi, andbuffer_store_format_d16_hi_x, and refuses non-zerosoffset/ base offsets on typed stores.narrowpath, and full-width (count == 4) typed buffer stores untouched so already-translated shaders remain unchanged.Testing
cargo run --locked -p xtask -- policy(295 files ok)cargo clippy --locked -p victory-shader --tests -- -D warnings(0 warnings)cargo test --locked -p victory-shader -- buffer_store: 4/4 passed (DXIL validation + hardware RTX 3080 Ti & D3D12 WARP execution covering float/uint partial typed stores,d16_hi_x, and dword-straddlingshort_d16_hi)Checklist from #238
main(297f58a)9d8c9941c1toc5332bab4c@Aniseto on GitHub · 2026-12-01 08:48 UTC · original
Ran the
buffer_storetests atc5332baon an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own
CARGO_TARGET_DIR, no local patches.All four
buffer_storetests pass here, the same count the description reports on an RTX 3080 Ti and WARP. This is a second host for the translator's partial-channel and_d16_histore cases; the description's hardware execution on its own card was not repeated with a title.Not tested: the full workspace suite, clippy, a retail title, a visual check of partial typed stores in a scene, AMD adapters, Wine, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
@bannnned on GitHub · 2026-12-01 10:45 UTC · original · reviewed
I found two issues in targeted tests at this head: an untouched channel changes on the new partial-store path, and an existing full-width store with a zero offset no longer translates.
@ -0,0 +85,4 @@fargs.push(mask_all);self.s.op(self.cur,"bufferStore.f32",@bannnned on GitHub · 2026-12-01 10:45 UTC · original
[P2] Preserve the stored bits of channels outside the write mask
I ran the synthetic
buffer_store_format_xycase on an RTX 5070 Ti with anR8G8B8A8_SNORMUAV. The word changed from0x81800000to0x81813f7f. In addition to the intended X/Y update, the untouched Z byte changed from0x80to0x81. Both bytes load as-1.0, and the typed store writes the canonical encoding. A later raw view can observe the byte change as a result of a store that only targets X/Y.Could we use a format-aware raw update that writes only the intended bytes where supported? The SNORM endpoint would make a regression test for untouched channels. A full-element load/store can also write back stale neighbor values if another invocation updates a different channel between the two operations.
@ -12812,3 +12839,1 @@// of a float format.if count != 4 || *offen || *offset != 0 {return Err("a typed buffer store of some channels or at an offset");if *offen || *offset != 0 || has_base_off {@bannnned on GitHub · 2026-12-01 10:45 UTC · original
[P2] Accept a provably zero scalar offset in existing full-width stores
I tested
buffer_store_format_xyzwwith inline zero and withs6defined bys_mov_b32 s6, 0. The base297f58atranslates both forms. Atc5332ba, the SGPR form is rejected witha typed buffer store at an offset.has_soffsetsees the operand encoding even though the effective address is identical. A pipeline using the SGPR form could lose its draw or dispatch after this change.Could we accept a scalar offset proven to be zero by the translator and add this case alongside
typed_buffer_store_refuses_nonzero_soffset?@readmet3xt-lab on GitHub · 2026-12-01 11:38 UTC · original
Checked: nothing harmful in it, it merges and passes the lint check. Because it changes a run at default settings (or code on the submission path), it is not merged to main directly: it is on the batch being tested for the next release, as one commit with you as its author. Nothing is needed from you now; the result of the run will be posted here.
@Texbirds on GitHub · 2026-12-01 12:01 UTC · original
Thanks @readmet3xt-lab, @Aniseto, and @bannnned!
Pushed
62773bcaddressing @bannnned's review:soffset(P2):has_soffsetnow checksso != self.s.m.i32(0)after lowering the operand, sos_mov_b32 s6, 0is accepted on both full-width and partial typed stores. Addedtyped_buffer_store_accepts_provably_zero_soffsetalongsidetyped_buffer_store_refuses_nonzero_soffset(5/5buffer_storetests pass withdxil.dll, RTX 3080 Ti, and WARP).0xFon typedbufferStore, and the view'sDXGI_FORMATis only known at runtime (the host descriptor heap does not currently carry per-slot format IDs or aliased raw UAVs for typed views). Documented that limitation inbuffer_store.rs; if a title observes raw-aliased0x80SNORM bytes or concurrent cross-channel writes, a follow-up with host-side format metadata + raw aliasing would be the right layer.@Aniseto on GitHub · 2026-12-01 12:16 UTC · original
This is a new response on the same thread as my report at
c5332ba(#279); the head moved to62773bc(provably-zero SGPRsoffseton typed stores), so I am not editing that comment.Ran the
buffer_storetests at62773bcon an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own
CARGO_TARGET_DIR, no local patches.All five
buffer_storetests pass at the new head, one more than the four atc5332ba; the addedtyped_buffer_store_accepts_provably_zero_soffsetcase is included. The description's RTX 3080 Ti and WARP execution was not repeated here, and no title was run.Not tested: the full workspace suite, a retail title, WARP as a separate device, AMD adapters, Wine, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
62773bc070to797e8f649f@readmet3xt-lab on GitHub · 2026-12-01 21:09 UTC · original
Thank you for the update. The new commits are being retested together with the version already in the build.
Pull request closed