Skip to content

Only require console lanes for consumed numeric selects - #5

Merged
r4tedx merged 1 commit into
r4tedx:integration/testersfrom
MichaelSmithAI:integrate/numeric-mask-selects
Nov 24, 2026
Merged

r4tedx merged 1 commit into
r4tedx:integration/testersfrom
MichaelSmithAI:integrate/numeric-mask-selects

Conversation

@MichaelSmithAI

@MichaelSmithAI MichaelSmithAI commented Nov 24, 2026 •

Copy link
Copy Markdown

I ran the requested test on integration/testers at f61acfa. The current wave64 stack already translates all three live numeric-select cases in the earlier PR. This revision replaces the old integration merge with one commit for the remaining case.

A 128-thread compute shader on a wave32-only target could be rejected solely because it contained an unused numeric select. The initial wave-size analysis reserved console lanes before the lowerer found that the select result had no consumer. The current live() iterator filters known spill instructions and still includes that select. We tested that one-line change separately and reproduced the refusal.

The patch lets the ordinary lowering pass run first and retries compute lowering with numeric-select lane requirements when a consumer needs an untracked select result. The unused 128-thread case emits without wave ops. The 128-thread case that actually uses the result retains its wave32 refusal.

Linux shader tests on this revision: 121 passed, 1 ignored. Windows shader tests type-checked from Linux. The regression covers native wave32, native wave64 and guest wave64 on a wave32-only target. Native execution and title impact remain unmeasured.

AI-assisted implementation, testing and review. Earlier integration head for reference: 99f97ea2e7cddfacccc896a33cff7b7f7680e9db.

@r4tedx

r4tedx commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you for doing the integration and for saying plainly what was and was not run.

Where this stands on my side: integration/testers is in the middle of an update (more GPU PRs, and the wave64 stack moving to Marvisak#439's current head f653ea4), so its tip will move off 7670a8a shortly and emit/lower.rs will change under this merge. I have not reviewed Marvisak#69 or this resolution yet. Once the update is pushed I will review Marvisak#69 against the ISA like the other instruction PRs in the tree, run the shader tests on the hardware here (RTX 5070 and a Radeon integrated GPU, so both 32-lane and 64-lane host waves), and then either take this merge, rebased, or tell you what stopped it.

If you want to save a round trip: after the tip moves, a rebase of 2c08dcf onto it is the version I would test.

Nothing was built or run for this note. AI-assisted.

@MichaelSmithAI
MichaelSmithAI force-pushed the integrate/numeric-mask-selects branch from 2c08dcf to 99f97ea Compare November 24, 2026 06:32
@r4tedx

r4tedx commented Nov 24, 2026

Copy link
Copy Markdown
Owner

An update, since the ground moved under this PR twice and that is not your doing.

integration/testers is now f61acfa. Since your rebase it picked up two commits of the wave64 stack (upstream Marvisak#439) that touch the same code:

  • d2189ff, "compute selects take masks held as numbers": the v_cndmask_b32 arm and the masks_held analysis in emit/lower.rs, and a new Structured::pairs in structure.rs. It targets the same refusal as Translate compute selects with numeric lane masks Marvisak/VIctory#69 (a select on an untracked mask), for compute.
  • 9e98b2b (by ifBars): loop-carried inputs of console mask joins, in structure.rs.

That is why this PR shows as conflicting. I have not compared d2189ff with Marvisak#69 line by line, so I cannot say yet whether Marvisak#69 is fully covered or adds cases.

The quickest way to find out is your own test. If you put only the test from this PR (the compute select whose mask words are written independently, checked for wave32, wave64 and guest wave64 on a wave32-only target) on top of f61acfa:

Nothing was built or run for this note. AI-assisted.

@MichaelSmithAI
MichaelSmithAI force-pushed the integrate/numeric-mask-selects branch from 99f97ea to 3d3f32e Compare November 24, 2026 07:10
@MichaelSmithAI MichaelSmithAI changed the title Integrate #69 numeric mask selects with the tester wave-size paths Only require console lanes for consumed numeric selects Nov 24, 2026
@r4tedx

r4tedx commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you for running the test on f61acfa and for cutting this down to the one case that is left; that is a much easier thing to review than the merge was.

Where it goes from here: the wave-size analysis this changes belongs to the wave64 stack (upstream Marvisak#439), not to the tree's own glue, so I have passed 3d3f32e to that stack's owner to review against its d2189ff and to run on the hardware here (an RTX 5070 with 32-lane waves and a Radeon integrated GPU with 64-lane ones), which covers the native execution you list as unmeasured. If it holds, it will be taken into Marvisak#439 with your authorship, as the two earlier fork PRs against that branch were, and the tree picks it up from there. If something is wrong with it you will hear what, with a test.

I have not built or run this revision myself. AI-assisted.

r4tedx pushed a commit that referenced this pull request Nov 24, 2026
A compute program with a numeric select declared the console's wave size
whether or not anything read the select's result. On a host without
64-lane waves that refused a wave64 program in a group of more than 64
threads only for a select nothing consumes, where it translated before
selects on numeric masks were lowered.

The ordinary lowering now runs first. Only when it stops on a select
with an untracked mask is the program lowered again with numeric selects
counted among the masks held as numbers.

From #5 (MichaelSmithAI). Picked onto shader/console-flow-lds
by r4.: the selector scan iterates every instruction here (the tester
tree's `live()` filter is another PR's), and the new lines are formatted
for this crate.
@r4tedx
r4tedx merged commit 39bb69a into r4tedx:integration/testers Nov 24, 2026
@r4tedx

r4tedx commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Merged, thank you. This is in two places now:

What was checked on the stack before taking it, on the hardware here:

  • Your claim is right, and it is a regression from d2189ff: with the numeric_selects gate taken out, your test fails at the 128-thread unused-select case with console wave64 lanes in a group of more than 64 threads on a host without 64-lane waves. Before d2189ff that program translated.
  • With the change, your test passes, and the hardware test of consumed numeric selects (split_tests::selects_on_masks_held_as_numbers) is still exact on the RTX 5070 (32-lane waves) and the Radeon integrated GPU (64-lane waves). cargo test --workspace on the stack: 299 passed, 4 ignored.

On the tree after the merge, the shader tests ran on the RTX 5070 only: 200 passed in 11 of 14 runs. The other three runs did not complete for a reason that is not this change's (GPU tests that were already in the tree stalling or losing the device when run together; it is written up under "Test stability" in INTEGRATION.md).

The title was not used in these tests. AI-assisted.

r4tedx pushed a commit that referenced this pull request Nov 24, 2026
A compute program with a numeric select declared the console's wave size
whether or not anything read the select's result. On a host without
64-lane waves that refused a wave64 program in a group of more than 64
threads only for a select nothing consumes, where it translated before
selects on numeric masks were lowered.

The ordinary lowering now runs first. Only when it stops on a select
with an untracked mask is the program lowered again with numeric selects
counted among the masks held as numbers.

From #5 (MichaelSmithAI). Picked onto shader/console-flow-lds
by r4.: the selector scan iterates every instruction here (the tester
tree's `live()` filter is another PR's), and the new lines are formatted
for this crate.
r4tedx pushed a commit that referenced this pull request Nov 24, 2026
A compute program with a numeric select declared the console's wave size
whether or not anything read the select's result. On a host without
64-lane waves that refused a wave64 program in a group of more than 64
threads only for a select nothing consumes, where it translated before
selects on numeric masks were lowered.

The ordinary lowering now runs first. Only when it stops on a select
with an untracked mask is the program lowered again with numeric selects
counted among the masks held as numbers.

From #5 (MichaelSmithAI). Picked onto shader/console-flow-lds
by r4.: the selector scan iterates every instruction here (the tester
tree's `live()` filter is another PR's), and the new lines are formatted
for this crate.
r4tedx pushed a commit that referenced this pull request Nov 24, 2026
A compute program with a numeric select declared the console's wave size
whether or not anything read the select's result. On a host without
64-lane waves that refused a wave64 program in a group of more than 64
threads only for a select nothing consumes, where it translated before
selects on numeric masks were lowered.

The ordinary lowering now runs first. Only when it stops on a select
with an untracked mask is the program lowered again with numeric selects
counted among the masks held as numbers.

From #5 (MichaelSmithAI). Picked onto shader/console-flow-lds
by r4.: the selector scan iterates every instruction here (the tester
tree's `live()` filter is another PR's), and the new lines are formatted
for this crate.
mpDom pushed a commit to mpDom/VIctory that referenced this pull request Nov 24, 2026
…at 055aef9)

Brings the black-scene branch (6d7ead4: Marvisak#489, Marvisak#294, Marvisak#346, root UAVs as
bounded one-view tables, VICTORY_ROOT_SRV_MB) up to the tester tree's
update 4. No file conflicted.

The tree's Marvisak#566 gives `resource::track` a fourth argument, the program as
one lane runs it, and this branch's tests called it with three. Adapted,
tests only:
- emit/valu_tests.rs: the root UAV test structures the program first and
  passes it; the spill-table helper keeps `emit::translate`'s order (a
  program that cannot be structured is still traced and fails where it
  did before).
- resource.rs: the spill-table descriptor test passes `lanes(&p)`, as its
  neighbours do.
- victory-gpu draw.rs: the two root-view tests structure first.
- emit/waterfall_tests.rs (the tree's): its `HostShader` gets this
  branch's `root_uavs` field.

Run once each, one process at a time on the RTX 5070 and WARP:
victory-shader --lib 210 passed, 1 ignored; victory-gpu --lib 95 passed,
1 ignored. `cargo build -p victory` builds. Not run in the title.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
suirentakamura pushed a commit to suirentakamura/victory-suiren that referenced this pull request Nov 24, 2026
A compute program with a numeric select declared the console's wave size
whether or not anything read the select's result. On a host without
64-lane waves that refused a wave64 program in a group of more than 64
threads only for a select nothing consumes, where it translated before
selects on numeric masks were lowered.

The ordinary lowering now runs first. Only when it stops on a select
with an untracked mask is the program lowered again with numeric selects
counted among the masks held as numbers.

From r4tedx/VIctory#5 (MichaelSmithAI). Picked onto shader/console-flow-lds
by r4.: the selector scan iterates every instruction here (the tester
tree's `live()` filter is another PR's), and the new lines are formatted
for this crate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants