shader: lower ds_append and ds_consume on split wave64 compute waves (#414) #420
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/420"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by Sheffy007 on 2026-11-27T17:31:51Z.
Summary
In world runs on
main(#4 refusal table:3 | 3 | 0 | ds_append or ds_consume in a console wave the host splits), wave64 compute shaders with more than 32 threads per group that executeds_appendords_consumewere refused underOptions::wave32_host.On RDNA2,
ds_append/ds_consumeperforms one atomic add/subtract ofpopcount(EXEC)atLDS[M0 + offset]for the 64-lane console wave and returns that wave-wideoldvalue to every active lane in the console wave.Changes
Lower::wide_appendincrates/victory-shader/src/emit/lower/halves.rsand call it fromLower::ds_gdswhenself.halvesis true:exchange_site(self.cur_ir)?, automatically enablingir::keep_lanes_to_endand single-wavelockstepretries on divergent 64-lane shaders while keeping genuinely divergent multi-wave sites refused withDIVERGENT_EXCHANGE.(lo, hi)viawide_ballot(zeroing missing upper halves when the group size is not a multiple of 64) and computesn = popcount(lo) + popcount(hi).firstbitlow(lo), or32 + firstbitlow(hi)whenlo == 0, gated onn != 0) perform the singleRmw::Add/Rmw::SubonLDS[M0 + offset]and publisholdtoxchg[wave]betweenxchg_barriers so every active lane in both 32-lane host halves receivesoldwhile inactive lanes keepoutside.gfx_refusal_tests::lds_instructions_addressed_by_m0_translateandwave32_tests::a_barrier_block_behind_a_branch_on_an_lds_word_read_after_a_barrier(which now exercisesbarrier_reads'sds_appendwrite-hazard rule directly toDIVERGENT_EXCHANGE).ds_append_and_consume_across_split_host_wavesinsplit_wave_tests.rsverifying both:if (v0 < 40)ds_appendacross lower (32) + upper (8) halves;ds_append+ds_consumewith odd lanes active (console lane 0 inactive in both waves).Verification
cargo test -p victory-hle -p victory -p victory-gpu -p victory-metal -p victory-shader -p xtaskcargo clippy --workspace --all-targets --target x86_64-pc-windows-gnullvm -- -D warningscargo clippy --workspace --all-targets --all-features --target x86_64-pc-windows-gnullvm -- -D warningscargo xtask policycc @Olima34
Closes #414
Refs #4, #258
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T00:37:10Z.
Review: CHANGES_REQUESTED
Thanks for this PR! We're helping the maintainer clear the queue tonight, and main has moved a lot (the preview branch landed as
86cefd22, then a batch of PRs; main is nowa6a58361). This branch now conflicts with main incrates/victory-gpu/src/native/split_wave_tests.rs.Could you merge current
maininto the branch (a merge commit is fine, no need to rebase) and resolve the conflict? It looks like tests appended at the same spot as tests that landed on main; keep both sides. Once GitHub shows it as mergeable and CI is green on the new head, we'll read it through and merge it if it holds up.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T00:46:56Z.
The maintainer is handling this one himself; please follow his lead rather than my review.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-28T02:00:33Z.
Thanks for this PR! An offline check of
b2d0b88f. The current head3062bbf3has the same non-test code.Measured offline on main
86cefd22withexamples/sweep+tools/corpus/compare.sh, on our 21,600-shader world corpus. The PR alone was swept over the 10,319 world shaders that the combination below changes. "Passes/frame" is an estimate from four traced world frames of an earlier preview run: the dropped passes whose only refused shader this PR translates.#420 alone:
In combination with #418 #466 #420 #409 #448 #433 #495 #497 on
86cefd22(a local integration build, plus the pass-trace fix from #509):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.