Shaders: wave64 compute on 32-lane hosts, in halves and in the console flow (rebase of #233) #1929
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!1929
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1929/head"
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?
@slatefield on GitHub · 2026-11-25 01:07 UTC · original
slatefield:up-233-rebase→main· +1563 −104 · 18 files · 12 commits · closed without mergingClosed: r4tedx updated #233 itself onto
main940d32f(head7147671), taking thehost_shadertarget point from this rebase and keeping one PR open so the testers' reports stay in one place, which is the right shape. The validation done here that was useful stays in #233's thread: upipibi's RTX 3070 run of thesplit_tests(13 pass; the two whole-mask-read cases are still refused on 32-lane hosts, which is a real limitation of the split form), and the wall of review about the console flow's group barriers inside branches and loops.Nothing else is open from this rebase. The branch
slatefield:up-233-rebasestays on the fork for reference.A console wave64 program that reads masks whole or lanes of the other half now runs on a host without 64-lane waves when its group is one console wave (64 threads or fewer, no LDS). It runs as the console does ("console flow"): - `structure::structure_console` never resolves mask joins from what the lanes arriving know (every lane arrives); `Structured::execs` gives each vector instruction's EXEC bit. - Vector instructions are guarded by EXEC. Branches are the console's s_cbranch_*: EXEC, VCC and mask-operation SCC tests are the console wave's, from both halves' ballots exchanged through group-shared memory between group barriers, which every thread reaches since both halves branch alike. - Masks read whole are the exchanged ballots. v_readlane and v_readfirstlane read the owning half; v_writelane, v_mbcnt and mask bit tests use the console lane. The per-lane form is tried first; a program that needs the console flow is lowered again from the console structure. GPU tests on an RTX 5070 are exact against the console: s_bcnt1 over both halves (64, 48 and 32 threads), v_readlane 40, an exchange inside a branch only the lower half takes, and a loop the halves leave at different iterations with a lane read in each. The last one shows that the per-lane form, which hosts with 64-lane waves get, is wrong for it (on a Radeon iGPU): noted in docs/wave64-on-wave32.md, not changed. Co-Authored-By: Claude Opus 5.5 <[email protected]>@slatefield on GitHub · 2026-11-25 01:08 UTC · original
Branch updated for
main's new commit42363ab("hardware-only shader checks skip on a machine without a GPU"), which touched the sameHost::newadapter selection. One merge commit on top, nothing else changed: main's refusal of a software default adapter stays, and the branch'sVICTORY_ADAPTERname selection goes in front of it, so an explicitly named adapter is still taken and the refusal only applies to the default path. Windows-target clippy with--all-targets --all-featuresclean, Linuxvictory-shader --lib146 passed, 2 ignored.The other three rebases (#1922, #1923, #1924) already merge cleanly onto
42363ab.@Marvisak on GitHub · 2026-11-25 02:18 UTC · original
Automated triage for the maintainers.
This pull request does not merge cleanly into
main. Conflicting files:apps/victory/src/translate.rs,crates/victory-gpu/src/shader_cache.rs,crates/victory-shader/src/emit/bvh_tests.rs,crates/victory-shader/src/emit/host.rs,crates/victory-shader/src/emit/lower.rs,crates/victory-shader/src/emit/memory_tests.rsand 6 more.It will be reviewed once it is rebased onto the current
main.Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-25 05:26 UTC · original
A question before merge, about the console flow's group barriers on NVIDIA.
The console flow places group barriers (
exchange,lower.rs9724-9756 in this PR) inside the program's own branches and loops, throughconsole_branch/any_lane(9503, 9578, 9647) andmask_dword(1847). That is safe as long as both host waves always take the same edges, which the design gets from exchanged ballots and SCC bits. Butscc_bit(9617) accepts any scalarVal::Bitas uniform, and a scalar memory load runs once per host wave, so a value that changes during the dispatch (a flag or counter another group writes) could send the two halves different ways, with one half waiting at a barrier the other never reaches.For reference: a fork with a similar "two host waves" form that put barriers in branches and loops (Zettrox/ztrx, commit
e9765a7) lost the device on an RTX 4070 in 4 of 4 runs when the title dispatchedptfx_CS_lightAtlas_Spriteandptfx_CS_lightAtlas_Trail, and turned that form off by default. I have not checked whether those two programs take this PR's console flow.Could the 10
split_testsGPU tests (listed as not checked) be run on an NVIDIA card, and a title run go through those two particle programs, before this is merged?@upipibi on GitHub · 2026-11-25 05:44 UTC · original
The NVIDIA run asked for above. Ran on Windows 11 with an RTX 3070 (Ampere, 32-lane waves, driver 616.56), debug build, at
b9b6dab,cargo test -p victory-shader --locked: 256 passed, 5 failed, 3 ignored.main(the twostride_testsheap-buffer reads andgathers_at_a_level_match_the_hardware).split_tests. On this 32-lane host the translator refuses both programs instead of splitting them:first_lane_reads_are_the_console_waves:DPP and v_readfirstlane: GFX10 code at 0x34: a lane mask read whole in a wave64 program split in halves is not supported(split_tests.rs:216)masks_read_whole_count_both_halves:s_bcnt1 of lanes below 40: GFX10 code at 0x30: a lane mask read whole in a wave64 program split in halves is not supported(split_tests.rs:216)split_tests/ wave-size tests pass, among themlane_reads_cross_halves,exchanges_inside_a_branch_one_half_skips,loops_run_while_any_lane_of_the_console_wave_does,three_dimensional_groups_keep_the_consoles_lanesandeach_adapter_gets_what_it_runs.So on a host without 64-lane waves, the whole-mask reads (a
v_readfirstlaneafter DPP,s_bcnt1of the exec mask) still hit that refusal. A 64-lane host never splits, so it wouldn't show this. Not run: a title.AI-assisted (Claude Code). Synthetic tests only.
@r4tedx on GitHub · 2026-11-25 07:09 UTC · original
@slatefield, thank you for doing this; it saved real time. #233 itself is now updated with
main940d32fmerged in: head7147671onshader/wave64-console-flow(with #223's plumbing at02b955funder it). I used this PR as the reference for the conflicts and adopted yourhost_shadertarget point for the warm cache path (it now asks the run's own host range, the same function the runtime uses). The one place I departed is the order of the split-form refusal and the console ballot inmask_dword; the details and the three fixes on top are in the note on #233.Since the stack is updated by merge commits rather than rebases (testers quote its hashes), the trees differ in history but should be close in content:
git diff b9b6dab 7147671 -- crates/shows what is mine. Keeping one PR open for #233 would keep testers' reports in one place, so I would suggest closing this one if the diff looks right to you, but that is your call.AI-assisted (Claude Code).
Pull request closed