Skip to content

Shader: run wave64 groups that share nothing as one host group per wave - #14

Merged
wbkepler merged 1 commit into
mainfrom
shader/wave64-regroup
Nov 25, 2026
Merged

wbkepler merged 1 commit into
mainfrom
shader/wave64-regroup

Conversation

@wbkepler

Copy link
Copy Markdown
Owner

Compute programs compiled as wave64 with groups larger than 64 threads that use neither LDS nor s_barrier (such as tiled sun-shadow variants) were previously refused on 32-lane hosts (console wave64 lanes in a group of more than 64 threads).

Changes

  • Translator (victory-shader): In the console control-flow pass, wave64 compute shaders with threads > 64, threads % 64 == 0, no LDS, and no s_barrier are lowered with a 64-thread host group ([64, 1, 1]) and regroup = threads / 64, deriving console thread/group IDs from the host group/thread IDs (HostShader::regroup, persisted in the shader cache flags).
  • Direct & indirect dispatch (victory-gpu):
    • Direct dispatches multiply X by p.regroup() (dropping if > 65,535).
    • Indirect dispatches pass regroup into indirect::bounded, multiplying the argument records' X before ExecuteIndirect and dividing it back in a follow-up ungroup pass (Bound::Regrouped).

Note: Requires a rebuilt shader cache (changes HostShader / shader cache flag bits).

Verification

  • Gate:
    • cargo clippy (victory-shader, victory-gpu, victory --features diagnostics) -- -D warnings: clean
    • cargo test -p victory-shader: 297 passed
    • cargo test -p victory-gpu -- --test-threads=1: 187 passed
    • cargo xtask policy: 186 passed
  • Shader cache pre-build: 25,874 translated / 111 refused (vs 25,851 / 134 before); compute pipelines skipped for untranslatable shader dropped from 78 to 55.
  • Live world run (RTX 5090, 240 s):
    • Stable (240 s, no device removal or panic).
    • Frame time: 312–331 ms/frame (GPU 78–82 ms) vs 333–389 ms/frame (GPU 91–100 ms) on branch base (and 300–333 ms/frame on current main).
    • Dropped indirect dispatches: 18/frame -> 0/frame.
    • Visuals: intro scene no longer has the blown-out over-exposed haze (properly shadowed/dark, awaiting remaining indirect lighting / BVH work).

On hosts without 64-lane waves, a console wave64 compute program in the
console flow with more than 64 threads per group, no LDS, and no
s_barrier runs each console wave as a 64-thread host group.

The translator derives console group and thread ids from the host ids
and reports the factor (HostShader::regroup, stored in the shader cache
flags). Direct dispatches multiply X by the factor; indirect dispatches
multiply the records' X in the clamp pass before ExecuteIndirect and
divide it back in a follow-up ungroup pass.

Requires a rebuilt shader cache.
@wbkepler
wbkepler merged commit 7853c08 into main Nov 25, 2026
1 check passed
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.

1 participant