shader: masks with lanes elsewhere in one host wave, for the wave-wide form refused at them #146
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/vktory6--VKtory!146
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-146"
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?
@Flezzonkeys on GitHub · 2026-12-01 21:35 UTC · original
Flezzonkeys:wavewide-mask-numbers→main· +208 −5 · 5 files · 1 commits · openWhat
Part of the TASKS item "Wave-wide regions with per-path descriptors": one of the five game shaders that keep per-lane branches the console runs wave-wide,
CS_RaytracingResolve52ab310c, now translates wave-wide.Its wave-wide form was refused at a lane mask with lanes outside EXEC read as data (
MASK_ELSEWHERE). Two things were missing:emitnever gave the wave-wide form the second try thattranslatealready gives a per-lane form refused this way (with_mask_ops_on_numbers). Two other store variants ofCS_RaytracingResolve(4b4661fd, ecd67a43) only needed that.s_cselect_b32 s0, exec_lo, 0ANDed with a compare, around 0x5b0c).mask_dwordtakes such a mask as the ballot of every lane only with two exchanging host waves. With one host wave that is the console wave,all_lanesis always true and says nothing, so it refused, and it named no block, sowidenstopped with "a branch around it cannot be".The change, only for a wave-wide form refused with
MASK_ELSEWHERE, as two more tries in this order:with_mask_ops_on_numbers), so a program the per-lane second try already handles comes out as before;lower::with_one_wave_masks: where one host wave is the console wave (no exchange, no halves, a fixed wave of the console's size, a compute group of whole waves, no thread count), a mask made in a block every lane runs (all_lane_blocks, branches taken wave-wide count) is the ballot of every lane, if every lane computes its bit from what every lane ran: the mask's atoms areUniform,Opaque,Constant, orLanecompares in such blocks. Not a phi, as the mask or inside it. Where it doesn't hold, the block is named forwiden.The reference
No vkd3d-proton counterpart (it doesn't translate console ISA). The reference inside the translator is the existing two-host-wave case in
mask_dword(exchange,all_lanes), and how the wave sum and a fetch-inactivev_permlanealready decide "every lane runs this block" for one host wave (all_lane_blocks). The order of tries followstranslate/emit_with_retries: each second try only for programs refused for it, "so no program that translated without it changes".Evidence
CS_TraceShadowRaysprograms that translated fine before, and a test with the mask read after a per-lane join translated where it must not. Details indocs/learnings/distshadow.md.wave64_tests.rs, a mask of the lanes outside EXEC made in a branch, counted there and after the join. Refused per lane and wave-wide without the second try; with it, the console's counts on the card. Whole crate: 345 passed, 15 card runs, none skipped. Linux tests and clippy (Linux and xwin) clean.TRANSLATOR_VERSION14.31c20c7+ this commit + my local stuff that doesn't touch the translator, Series X, free roam, 193+ stats windows): "pipeline with a program whose lane branches stayed per lane" lists 4 shaders (0ae69044, 2da4beb3, aab1b3c7, e4a9f58e). The run before on the same PC listed 5, with 52ab310c. No device loss, no new loud errors.Checklist (docs/AGENTS.md)
docs/TASKS.mdnot edited, the related item named above (rule 29)with_mask_ops_on_numbers, not an environment switch)unsafeblock has a// SAFETY:comment (rule 36): no newunsafeTRANSLATOR_VERSIONbumped (rule 27)@TheRifai on GitHub · 2026-12-02 16:06 UTC · original
Extra evidence for the TASKS "Wave-wide regions with per-path descriptors" row that this PR addresses, from current main
bc86e65(RX 9070 XT / RADV 26.3.1, GE-Proton11-16, Series X 3840x2160, housert3, warm store, 75 s, no validation):VKB_STRICT=1aborts at start on exactly this rule-32 kind:pipeline with a program whose lane branches stayed per lane ... the wave-wide form refused at them. Exit status 1, no frames rendered.e4a9f58e…,aab1b3c7…,2da4beb3…,52ab310c…,0ae69044…), two lines each.So the kind is not merely theoretical on the reference card, and strict mode cannot get past it even for a first frame. Evidence:
/home/shlong/Documents/VKtory-capture/hunt-{base,strict,val}/.@vktory6 on GitHub · 2026-12-02 20:01 UTC · original
Thanks for the patience on this one. The GPU check passed on the main of that time: whole-store DXIL diff with 0 failures, per-lane pipelines down from 10 to 8 as intended, card tests passing, and the prison and boat picture gates passing (boat SSIM 0.76).
Since then #180 (two console lanes a thread for wave64 groups on 32-lane hosts) has landed, and it rewrote the code this PR builds on.
Lower'sexchange,localandhalves, and themadeblock inmask_dword's refusal path, are gone, andemitno longer hashalves(its wide-form match isOk((shader, _))). A merge of main into your branch conflicts in emit/lower.rs and emit/mod.rs, and the result does not build. I tried resolving it and stopped: the remaining parts are your design decisions, not mechanical ones.Could you rebase onto current main? Pointers from our attempt:
ONE_WAVE_MASKSand main'sNO_PAIRS) and both runner functions.self.halves.is_none(), the pair form now plays that role.self.pairs.is_none(), together withhost_max_wave() >= self.s.wave_size, keeps "one host wave is the console wave" true also underwithout_pairs(32-lane waves, one console lane a thread). Please check that against your proof. On a 32-lane host the pair form computes masks per half and combines them, so the "every lane computes its bit" argument needs restating there, or the path excluded.TRANSLATOR_VERSIONbecomes whatever main's next number is when it lands (15 or 16, depending on #206).After the rebase we rerun the whole-store diff, the card tests and the two gates (they are cheap for us) and merge.
The translator's direction, including the wave model on 32-lane hosts and per-lane pipelines, is being discussed in https://github.com/vktory6/VKtory/discussions/270.
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.