Skip to content

Add opt-in paired compute lowering for Wave64 shaders - #883

Closed
Kamiloj9 wants to merge 2 commits into
fxceless:mainfrom
Kamiloj9:codex/paired-wave32-compute
Closed

Kamiloj9 wants to merge 2 commits into
fxceless:mainfrom
Kamiloj9:codex/paired-wave32-compute

Conversation

@Kamiloj9

@Kamiloj9 Kamiloj9 commented Nov 25, 2026 •

Copy link
Copy Markdown

Summary

Extract the compute paired-lane idea from #854 for a single full console Wave64 on a Wave32 host. Run two logical lanes per host lane, combine their masks and preserve prefix order across the two halves. The retry requires VICTORY_WAVE_PAIRS=1 and an emitted WaveSize of 32.

The second commit supports selected LDS instructions. It adds a group synchronization after both logical halves complete each guest LDS instruction and checks convergence in the optimized DXIL control flow. It also checks distinct ordinary stores and bounds for shared-memory accesses. The LDS form requires group synchronization, so it is skipped with VICTORY_GROUP_SYNC=0. Guest barriers, direct transfers into LDS and scalar memory writes remain outside this form.

Verification

  • Windows workspace check with all features, shader wave and convergence unit tests, and staged asset policy.
  • CPU replay on the current main base: the paired outputs of three previously tested captures match the forced Shaders: wave64 programs in a paired form on 32-lane GPUs, mesh programs over 32 KiB linked with their pixel program, and more (230 more programs pass) #854 results. The additional LDS capture validates as a 32-thread group with 16 group synchronizations. Its DXIL matches the local integration build byte for byte.
  • All nine default results match the base. With the new opt-in LDS support, only the LDS capture changes relative to the preceding commit in the same nine-input replay.
  • Execution and rendered output still need hardware verification. No D3D12 PSOs were created in these checks.

Kamiloj9 and others added 2 commits November 25, 2026 12:43
Map one shared-memory-free console wave to one host Wave32 while preserving logical lane indices, cross-half ballots and reservation prefixes.

Based on the paired-wave lowering in fxceless#854 and adapted from local commit 210faa14259d994114d3990766933e3c1378ef67.

Co-authored-by: Pilote Production <75377040+PiloteCode@users.noreply.github.com>
Synchronize both logical halves after each shared-memory instruction and certify convergence, distinct stores and access bounds in the optimized module.

Adapted from local commit 98fc4ff6d3b0394ac9740a0b43003e0056999f64.
@m335671

m335671 commented Nov 25, 2026

Copy link
Copy Markdown

A first hardware check, since the description asks for one: an offline pipeline census on a 32-lane card. On the title's shader pack, VICTORY_WAVE_PAIRS=1 changes no pipeline here.

Tested

  • RTX 4070 12 GB (32-lane waves), driver 32.0.16.2124, Windows 11 Pro 26300, release build.
  • main 3973179, then main with this PR's head 683b077 merged in. The merge was clean.
  • VICTORY_HOST_MAX_WAVE=32 victory translate --list --pipelines over the title's whole shader pack, compared program by program by hash.
pipelines created refused
main 3973179 25,608 27
main + this PR 25,608 27
main + this PR, VICTORY_WAVE_PAIRS=1 25,608 27

The same programs are created and refused in all three, and every pipeline the driver creates without the switch, it still creates with it.

So on this pack the paired form either isn't chosen for any of the 27 refused compute programs, or isn't chosen at all. I didn't add logging to tell which. Most of the 27 use LDS with guest barriers, and the description says that case stays out of this form, so that may be all there is to it.

Not tested: in the title, since offline nothing changes; your captures; other GPUs.

AI use: Claude Code (Claude Opus 5.5) built and ran the check on my machine, compared the listings and wrote this comment.

@MKmajster

Copy link
Copy Markdown

Two notes from merging this with #258 and running on a 32-lane host (RTX 3070).

The conflict. #258 adds a second range to the section loop in Lower (instructions after the section's end, up to after). I kept that loop and used this PR's twin dispatch in all three places:

  • paired_inst for the instruction at i and at end;
  • paired_section_inst for both ranges (i+1..end and end+1..after).

The shader tests pass (222).

What stays refused. With VICTORY_HOST_MAX_WAVE=32 VICTORY_WAVE_PAIRS=1, 10 compute programs that the driver refuses at pipeline creation (E_INVALIDARG; the validator accepts them) are still emitted with WaveSize(64). Your retry declines them:

  • 8 with "an uncertified paired LDS convergence or address proof";
  • 2 with "a floating-point wave operation in paired lanes".

All 10 have groups of 64 with LDS shared inside the console wave, plus v_mbcnt / v_readlane / a mask read as data. The two floating-point ones might be the cheaper next step, at least where the operation is min/max, which is exact in pairs.

AI-assisted (Claude Code). No game data attached.

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.

3 participants