Shaders: lower partial-channel image_store #332
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!332
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-332"
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?
@tarcisioads on GitHub · 2026-11-24 02:21 UTC · original
tarcisioads:shader/image-store-partial-dmask→main· +106 −9 · 1 files · 1 commits · openSupport partial-channel
image_store(dmask != 0xF,dmask != 0) incrates/victory-shader/src/emit/lower.rs:v[reg..]registers (for both 32-bit andd16packed f16), pad missing channels with0.0f(self.s.m.f32(0)), and pass0xFas thewriteMaskargument ofdx.op.textureStore.f32(matching RDNA2MIMG DMASKsemantics and the DXIL validator's typed-UAV rule).image_storewithdmask == 0explicitly ("an image store with no channels").partial_channel_image_store_lowerscovering0x0refusal, 32-bit partial masks (0x1,0x3,0x5), andd16partial mask (0x7, encoded at word 1 bit 31) withunorm = 1(word 0 bit 12), verifyingSFI0RESOURCE_HEAPemission.Verification
cargo test -p victory-shader(119 passed, 0 failed, 1 ignored benchmark on macOS; Windowsdxil.dllvalidation not run)cargo xtask policy(ok)@r4tedx on GitHub · 2026-11-24 03:14 UTC · original
Review note: the partial mask is passed through to DXIL (
args.push(self.s.m.i8(*dmask))), and the DXIL validator rejects that for a typed UAV. Adding validation to this PR's own fixture (dxil.dll from the Windows SDK, RTX 5070 machine) fails on the first store, mask1, withThe console's rule for the channels left out is in the RDNA 2 ISA (MIMG
DMASK): "Writes: defines which components are written with data from VGPRs (missing components get 0). Enabled components come from consecutive VGPRs." So the DXIL store needs mask0xFwith zeros in the channels the dmask leaves out, and the data VGPRs are the enabled channels in order (fordmask = 0x5, red is in VGPRn and blue in VGPRn+1). #160 does it that way.D3D12 only checks the container hash, so a driver may still take the module; that is why the test passes without the validator.
From the documents and synthetic tests only; I have no copy of the title and have not run this on console hardware.
@tarcisioads on GitHub · 2026-11-24 11:18 UTC · original
Rebased onto
main(ffe310e) and addressed @r4tedx's DXIL validator feedback ina5b0dcb:dmaskwith0.0f(self.s.m.f32(0)) and pass0xFas thewriteMaskofdx.op.textureStore.f32.cargo test -p victory-shader(97 passed, 0 failed on macOS;dxil.dllvalidation still needs Windows).@fuzeofficlal on GitHub · 2026-11-24 14:20 UTC · original
I retested
a5b0dcbon Windows with Microsoft’s DXIL validator and a 1×1 RGBA32F UAV initialized to[7, 8, 9, 10]. Both shaders validated and produced the same results on the default hardware adapter and explicit WARP.dmask=0x9, f32:[1.5, 0, 0, -2.25]dmask=0xb, d16:[1.5, -2, 0, 4]Test commit checks all channels against a nonzero starting texel to distinguish clearing from leaving a channel untouched. It also corrects the existing lowering test’s d16 selector to bit 31 of MIMG word 1. Bit 15 of word 0 controls R128. The changes are confined to tests and the test harness.
victory-shader --libpassed 122 tests with one ignored, and Clippy and the asset check passed.@DrDarkDK on GitHub · 2026-11-24 15:01 UTC · original
I extended the initialized RGBA32F readback from
a5541cdwithdmask=0x0and0x1, then ran the same inputs on this PR (a5b0dcb) and the #920 branch (f1c423f). The starting texel was[7, 8, 9, 10].0x0[1.5, 0, 0, 0][7, 8, 9, 10]0x1[1.5, 0, 0, 0][1.5, 0, 0, 0]The results were identical for f32 and packed d16 on native Windows, RTX 4070 Ti and WARP. All compared shaders passed DXIL validation.
On #332, the shared zero-mask normalization changes
0x0to0x1before store lowering. The #920 branch preserves zero for stores and emits no write. A native RDNA2 readback would settle which behavior to carry forward.AI-assisted with Codex.
@tarcisioads on GitHub · 2026-11-24 15:43 UTC · original
Updated
shader/image-store-partial-dmasksoimage_storewithdmask == 0is treated as a no-op (returnsOk(())without emittingdx.op.textureStore.f32, matching RDNA2IMAGE_STOREDMASK = 0semantics), instead of being normalized todmask = 1. Addeddmask = 0x0topartial_channel_image_store_lowers;cargo test -p victory-shader(97 passed, 0 failed on macOS).@Marvisak on GitHub · 2026-11-25 00:28 UTC · original · edited 2026-11-25 22:22 UTC
Automated triage for the maintainers.
Needs rebase.
mainhas moved since the last triage, and this PR no longer merges cleanly into it (conflict incrates/victory-shader/src/emit/lower.rs). It will be reviewed again once it is rebased onto currentmain.Previous verdict for this head: merge candidate.
Generated by Claude Code
@tarcisioads on GitHub · 2026-11-25 00:35 UTC · original
Addressed all three triage points:
0.0fpadding and0xFwriteMask.d16at word 1 bit 31,unormat word 0 bit 12) and added assertions on the emittedSFI0RESOURCE_HEAPflag anddmask == 0refusal.dmask == 0to refuse ("an image store with no channels") rather than no-op.cargo test -p victory-shader(119 passed, 0 failed on macOS).@Machad3x on GitHub · 2026-11-25 22:02 UTC · original
Hardware result: tested at head
0915bf5c. One host: RTX 3080 Ti, driver 621.24, Windows 11, a fork stacking open PRs, Series X mode. Cherry-picked together with #2816 and #2831: the shader tests pass apart from one failure the stack had before (a view heap cap test), and one 7-minute run in play had no device removal. Offline refused containers across the three went from 214 to 213 (not attributed to one PR). On the stack, the added test needed the stack's extraPartsfields.Ran with AI assistance (Claude Code).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.