Shaders: wave64 compute on 32-lane hosts, in halves and in the console flow (rebase of #233) #1927

Closed
slatefield wants to merge 12 commits from upstream-pr/1929 into main
slatefield commented 2026-11-25 01:07:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by slatefield on 2026-11-25T01:07:37Z.


Closed: r4tedx updated #233 itself onto main 940d32f (head 7147671), taking the host_shader target 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 the split_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-rebase stays on the fork for reference.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6594761915 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1929). Originally posted by [slatefield](https://github.com/slatefield) on 2026-11-25T01:07:37Z. --- Closed: r4tedx updated #233 itself onto `main` `940d32f` (head `7147671`), taking the `host_shader` target 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 the `split_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-rebase` stays on the fork for reference.
slatefield commented 2026-11-25 02:05:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by slatefield on 2026-11-25T01:08:56Z.


Branch updated for main's new commit 42363ab ("hardware-only shader checks skip on a machine without a GPU"), which touched the same Host::new adapter selection. One merge commit on top, nothing else changed: main's refusal of a software default adapter stays, and the branch's VICTORY_ADAPTER name 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-features clean, Linux victory-shader --lib 146 passed, 2 ignored.

The other three rebases (#1922, #1923, #1924) already merge cleanly onto 42363ab.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149254582 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1929#issuecomment-7149254582). Originally posted by [slatefield](https://github.com/slatefield) on 2026-11-25T01:08:56Z. --- Branch updated for `main`'s new commit `42363ab` ("hardware-only shader checks skip on a machine without a GPU"), which touched the same `Host::new` adapter selection. One merge commit on top, nothing else changed: main's refusal of a software default adapter stays, and the branch's `VICTORY_ADAPTER` name 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-features` clean, Linux `victory-shader --lib` 146 passed, 2 ignored. The other three rebases (#1922, #1923, #1924) already merge cleanly onto `42363ab`.
Marvisak commented 2026-11-25 03:03:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T02:18:25Z.


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.rs and 6 more.

It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7150557733 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1929#issuecomment-7150557733). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T02:18:25Z. --- <!-- victory-triage v1 head=b9b6dab9eb610536104542076585cf5ff17211af verdict=needs-rebase at=2026-11-25T02:15:48Z --> 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.rs` and 6 more. It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
0xkn0wh3r3 commented 2026-11-25 06:02:46 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T05:26:12Z.


A question before merge, about the console flow's group barriers on NVIDIA.

The console flow places group barriers (exchange, lower.rs 9724-9756 in this PR) inside the program's own branches and loops, through console_branch / any_lane (9503, 9578, 9647) and mask_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. But scc_bit (9617) accepts any scalar Val::Bit as 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 dispatched ptfx_CS_lightAtlas_Sprite and ptfx_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_tests GPU 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?

<!-- greyfinch-sync:Marvisak/VIctory:comment:7153768367 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1929#issuecomment-7153768367). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T05:26:12Z. --- A question before merge, about the console flow's group barriers on NVIDIA. The console flow places group barriers (`exchange`, `lower.rs` 9724-9756 in this PR) inside the program's own branches and loops, through `console_branch` / `any_lane` (9503, 9578, 9647) and `mask_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. But `scc_bit` (9617) accepts any scalar `Val::Bit` as 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 dispatched `ptfx_CS_lightAtlas_Sprite` and `ptfx_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_tests` GPU 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 commented 2026-11-25 06:02:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-25T05:44:57Z.


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.

  • 3 of the failures are #1744's NVIDIA failures on main (the two stride_tests heap-buffer reads and gathers_at_a_level_match_the_hardware).
  • 2 are this PR's 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)
  • The other 13 new split_tests / wave-size tests pass, among them lane_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_lanes and each_adapter_gets_what_it_runs.

So on a host without 64-lane waves, the whole-mask reads (a v_readfirstlane after DPP, s_bcnt1 of 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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154101438 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1929#issuecomment-7154101438). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-25T05:44:57Z. --- 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. - 3 of the failures are #1744's NVIDIA failures on `main` (the two `stride_tests` heap-buffer reads and `gathers_at_a_level_match_the_hardware`). - **2 are this PR's `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) - The other 13 new `split_tests` / wave-size tests pass, among them `lane_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_lanes` and `each_adapter_gets_what_it_runs`. So on a host without 64-lane waves, the whole-mask reads (a `v_readfirstlane` after DPP, `s_bcnt1` of 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 commented 2026-11-25 08:06:30 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by r4tedx on 2026-11-25T07:09:11Z.


@slatefield, thank you for doing this; it saved real time. #233 itself is now updated with main 940d32f merged in: head 7147671 on shader/wave64-console-flow (with #223's plumbing at 02b955f under it). I used this PR as the reference for the conflicts and adopted your host_shader target 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 in mask_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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155545473 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1929#issuecomment-7155545473). Originally posted by [r4tedx](https://github.com/r4tedx) on 2026-11-25T07:09:11Z. --- @slatefield, thank you for doing this; it saved real time. #233 itself is now updated with `main` `940d32f` merged in: head `7147671` on `shader/wave64-console-flow` (with #223's plumbing at `02b955f` under it). I used this PR as the reference for the conflicts and adopted your `host_shader` target 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 in `mask_dword`; the details and the three fixes on top are in [the note on #233](https://github.com/Marvisak/VIctory/pull/233#issuecomment-7155539757). 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).
upstream-sync closed this pull request 2026-11-25 13:01:45 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!1927
No description provided.