compute: translate divergent multi-wave wave64 groups as lane pairs #3352

Closed
Not-Saii wants to merge 2 commits from upstream-pr/3352 into main
Not-Saii commented 2026-11-28 12:12:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-28T12:12:53Z.


Change

Refs #3237 (stage 2).

Direct compute runs a guest wave64 as two host wave32s that exchange mask words at group barriers (split halves). D3D12 defines a group barrier only when every thread of the group reaches it. Guest waves that branch apart reach a different number of those barriers, so translate_program refused a group of more than one guest wave that has a conditional branch together with a mask-writing compare, a carry-out, a lane read, an LDS access or an s_barrier:

multi-wave64 exchange requires converged group control flow

On main, a request with the packed state block already avoids that refusal through virtual waves (94d2803f). Every other such group now compiles as lane pairs. One host wave32 runs one guest wave64, host lane j carries guest lanes j and j + 32, and the module declares numthreads(guest threads / 2, 1, 1) with wave size 32. Virtual waves and requests that did not hit that refusal compile to the same bytes as before.

In the emitter (src/gfx1013_direct_compute.inl):

  • Every instruction outside the scalar encodings is emitted once per lane set, with a second set of VGPR storage. Split halves already select a half's EXEC and mask word through one value (upper_half), and each emission uses it as a constant.
  • A scalar register written by a vector instruction is stored after both emissions, so the second one still reads the instruction's operands. Each emission writes its own mask word.
  • Four places have their own lane-pair form: the ballot (no exchange), v_readlane_b32, v_readfirstlane_b32 and the thread ids.
  • The group barrier before each LDS access is gone. Each LDS access takes its lane predicate from a ballot of its own instead, so that the lanes of the host wave reach it together. This is the second commit, 2c8a38be (3167ecb0 before the rebase), added after the WARP result in the comments.
  • If some path reaches s_endpgm without passing an s_barrier, a wave could end or skip the barrier while the others wait at it. Such a program gets one barrier site in a loop. A wave runs to its next s_barrier or to s_endpgm, stores where to resume and goes to the site, where lane 0 publishes whether the wave has ended and the group meets. A wave that has ended keeps returning until all of them have, so every thread passes the same barrier the same number of times. A barrier that every wave passes stays a plain barrier.

Two new refusals:

  • lane-pair layout: s_barrier inside a guest loop
  • lane-pair layout: one scalar register written for both lane sets. No handler does this today. The check turns a wrong assumption about a handler into a refusal, where it would otherwise lose one of the two writes.

The prototype's layout switch (an environment variable) and its timing pass in native_store_replay are not in this change. The layout depends on the request alone.

Layout, fixture and limits are written up in docs/experiments/native-wave64-lane-pairs.md.

Verification

Build under test: 2c8a38be (two commits on main eeb52277), Debug. Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088, 32-lane waves), DXC from Windows SDK 10.0.26100. The debug layer was not enabled. Every result in this section was taken again after the rebase onto eeb52277, unless it says otherwise.

cmake --build --preset dev --target compile_dxil native_store_replay
ctest --preset dev --no-tests=error -j 1 -R '^native_wave64_lane_pairs_' -V

Result: 2 of 2 passed, no skips.

  • native_wave64_lane_pairs_controls (no GPU): the nine 128-thread programs declare 64 host threads and no exchange memory, lds_same_address has a ballot per lane set before each LDS access, mask_readlane with 64 threads keeps its exchange memory, only exit_before_barrier has the barrier loop, and the barrier inside a loop is refused.
  • native_wave64_lane_pairs_hardware: 17 runs matched their CPU model over all 2,064 output words, guards included. Nine programs ran as lane pairs (128 threads), exit_before_barrier with 256 threads, and seven of the nine as split halves (64 threads). The other two are not asserted for split halves, see below. All 16 negative controls reported a mismatch. Three of them:
    • mask_readlane with the two lane sets exchanged: word 264, got 0xffffffff, expected 0x00001fff;
    • atomic_count without the high lane set: word 8, got 0x69696999, expected 0x69696979;
    • exit_before_barrier with wave 0 not ended: word 8, got 0x69696969, expected 0x0000c005.

tests/native_direct_container_check.py had two cases that expected the old refusal, multi-wave64-exchange-branch and wave64-divergent-carry. They now expect a module with 64 host threads and no exchange memory, and the converged two-wave64 case must keep 128 threads and its exchange memory.

ctest --preset dev --no-tests=error -R '^native_direct_container$' -V

Result: 1 of 1 passed. Run against an unmodified compiler built from eeb52277, the same test file fails at the first of the two cases with the old refusal.

Of the 91 CPU-only tests that use compile_dxil, 90 pass, with no skips. They are the registered tests whose command runs compile_dxil, that are not _warp or _hardware tests, and that need no executable beyond compile_dxil and native_store_replay. The one failure, startup_compute_half_buffer_uav_controls ("unsupported startup runtime manifest bindings: UAV kind unknown"), fails the same way on the unmodified eeb52277 build.

Before and after, with that unmodified compiler and a local script that is not in the branch. The 68 requests are the fixture programs with 64 and 128 threads, the slot 67 wave-size program, three straight-line programs of 441, 296 and 625 instructions with 64, 128 and 256 threads, and the 24 fixture requests again with the packed state block.

compiled refused
main eeb52277 55 13
this branch 67 1
  • All 55 modules that main produces are byte-identical in this branch. They include the 24 packed-state requests, which main compiles as virtual waves.
  • The 13 refusals on main all carry the old message. This branch compiles 12 of them and refuses the barrier inside a loop.

App-local WARP 1.0.22 (d3d10warp.dll 1.0.22.0.20261027.1 beside the replay executable, in-box D3D12 runtime), with the fixture's requests replayed by a local script that passes --direct-warp: all 17 asserted readbacks matched in 12 of 12 runs. Before the second commit lds_divergent as lane pairs differed in every run, in the LDS read before the s_barrier, which is what the second commit fixes. The comments have the details and an independent run of the first commit on an RTX 4070 and on WARP 1.0.22.

python -B tests/docs_links_check.py passes (156 files, 680 links).

Not run:

  • A second adapter for the second commit, the debug layer, and a dispatch through the stand-in.
  • The _warp and _hardware tests of the rest of the suite. The fixture has no --direct-warp mode, and the in-box WARP has 4-lane waves (docs/experiments/native-compute-warp.md).
  • The compile counts over the 55 programs in #3237.

The pull request check uses the pr preset, which does not build compile_dxil or select any native_* test, so a green check there does not exercise this change. The full suite runs on main and on a manual run of the workflow. A manual run of the first commit on my fork was cut off by the 30-minute job limit; the comments have its partial results.

Evidence and follow-up

The fixture programs are original. They were assembled with LLVM 15.0.7 (clang -cc1as, gfx1013, +wavefrontsize64) and are embedded as words with the assembly in comments, like the other tests/native_*_check.py files.

Assumptions and gaps:

  • On hardware, lane pairs ran integer VOP1, VOP2 and VOP3 instructions, compares, v_cmpx, DPP row operations, v_permlanex16_b32, both lane reads, LDS reads and writes, raw buffer stores and one buffer atomic. Buffer loads, typed stores, image operations (implicit derivatives included), 16-bit and packed operations go through the same per-lane handlers, each emitted in its lower-half and its upper-half form, but were not run in a lane-pair module.
  • Programs that the gate refused now compile, so the in-process route can dispatch them when their bindings are supported. I have not run a lane-pair module through the stand-in.
  • Every host wave is assumed to be full, as on the split-halves path.
  • The ballot before an LDS access relies on a wave operation gathering every lane of the host wave. D3D12 does not state that. It held on WARP 1.0.22, and both GPUs matched without the ballot as well.
  • main's wave32 path has no such ballot. A wave32 program in which a lane reads the LDS word another lane wrote one instruction earlier differs on WARP 1.0.22, with a module that is byte-identical to the unmodified compiler's. That path is not changed here.
  • lds_same_address fixes the host order: lane j + 32 wins. Which lane the guest hardware keeps is not established, so the result is asserted for lane pairs only.
  • readfirstlane_empty is not asserted for split halves. That lowering returns lane 32, not lane 0, for an empty EXEC. It is a separate defect on main, fixed in #3354, which is stacked on this branch.
  • The barrier loop ran with one s_barrier. exit_before_barrier shows that the loop works on this driver. It does not show that an early ret would have failed.
  • A lane-pair module emits each vector instruction twice. Size and timing against split halves were measured on an earlier base, with the layout switch that is not in this change and before the LDS ballot: #3237 comment.

Work someone else can pick up: a run of the second commit on another adapter, the same ballot for the wave32 path, and a lane-pair fixture for buffer loads or image operations.

Maintainers can push to this branch.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5540003683 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3352). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-28T12:12:53Z. --- ## Change Refs #3237 (stage 2). Direct compute runs a guest wave64 as two host wave32s that exchange mask words at group barriers (split halves). D3D12 defines a group barrier only when every thread of the group reaches it. Guest waves that branch apart reach a different number of those barriers, so `translate_program` refused a group of more than one guest wave that has a conditional branch together with a mask-writing compare, a carry-out, a lane read, an LDS access or an `s_barrier`: ``` multi-wave64 exchange requires converged group control flow ``` On `main`, a request with the packed state block already avoids that refusal through virtual waves (`94d2803f`). Every other such group now compiles as lane pairs. One host wave32 runs one guest wave64, host lane j carries guest lanes j and j + 32, and the module declares `numthreads(guest threads / 2, 1, 1)` with wave size 32. Virtual waves and requests that did not hit that refusal compile to the same bytes as before. In the emitter (`src/gfx1013_direct_compute.inl`): - Every instruction outside the scalar encodings is emitted once per lane set, with a second set of VGPR storage. Split halves already select a half's EXEC and mask word through one value (`upper_half`), and each emission uses it as a constant. - A scalar register written by a vector instruction is stored after both emissions, so the second one still reads the instruction's operands. Each emission writes its own mask word. - Four places have their own lane-pair form: the ballot (no exchange), `v_readlane_b32`, `v_readfirstlane_b32` and the thread ids. - The group barrier before each LDS access is gone. Each LDS access takes its lane predicate from a ballot of its own instead, so that the lanes of the host wave reach it together. This is the second commit, `2c8a38be` (`3167ecb0` before the rebase), added after the WARP result in the comments. - If some path reaches `s_endpgm` without passing an `s_barrier`, a wave could end or skip the barrier while the others wait at it. Such a program gets one barrier site in a loop. A wave runs to its next `s_barrier` or to `s_endpgm`, stores where to resume and goes to the site, where lane 0 publishes whether the wave has ended and the group meets. A wave that has ended keeps returning until all of them have, so every thread passes the same barrier the same number of times. A barrier that every wave passes stays a plain barrier. Two new refusals: - `lane-pair layout: s_barrier inside a guest loop` - `lane-pair layout: one scalar register written for both lane sets`. No handler does this today. The check turns a wrong assumption about a handler into a refusal, where it would otherwise lose one of the two writes. The prototype's layout switch (an environment variable) and its timing pass in `native_store_replay` are not in this change. The layout depends on the request alone. Layout, fixture and limits are written up in `docs/experiments/native-wave64-lane-pairs.md`. ## Verification Build under test: `2c8a38be` (two commits on `main` `eeb52277`), Debug. Windows 11 build 26300, NVIDIA GeForce RTX 4090 (driver 32.0.16.1088, 32-lane waves), DXC from Windows SDK 10.0.26100. The debug layer was not enabled. Every result in this section was taken again after the rebase onto `eeb52277`, unless it says otherwise. ```powershell cmake --build --preset dev --target compile_dxil native_store_replay ctest --preset dev --no-tests=error -j 1 -R '^native_wave64_lane_pairs_' -V ``` Result: 2 of 2 passed, no skips. - `native_wave64_lane_pairs_controls` (no GPU): the nine 128-thread programs declare 64 host threads and no exchange memory, `lds_same_address` has a ballot per lane set before each LDS access, `mask_readlane` with 64 threads keeps its exchange memory, only `exit_before_barrier` has the barrier loop, and the barrier inside a loop is refused. - `native_wave64_lane_pairs_hardware`: 17 runs matched their CPU model over all 2,064 output words, guards included. Nine programs ran as lane pairs (128 threads), `exit_before_barrier` with 256 threads, and seven of the nine as split halves (64 threads). The other two are not asserted for split halves, see below. All 16 negative controls reported a mismatch. Three of them: - `mask_readlane` with the two lane sets exchanged: word 264, got `0xffffffff`, expected `0x00001fff`; - `atomic_count` without the high lane set: word 8, got `0x69696999`, expected `0x69696979`; - `exit_before_barrier` with wave 0 not ended: word 8, got `0x69696969`, expected `0x0000c005`. `tests/native_direct_container_check.py` had two cases that expected the old refusal, `multi-wave64-exchange-branch` and `wave64-divergent-carry`. They now expect a module with 64 host threads and no exchange memory, and the converged `two-wave64` case must keep 128 threads and its exchange memory. ```powershell ctest --preset dev --no-tests=error -R '^native_direct_container$' -V ``` Result: 1 of 1 passed. Run against an unmodified compiler built from `eeb52277`, the same test file fails at the first of the two cases with the old refusal. Of the 91 CPU-only tests that use `compile_dxil`, 90 pass, with no skips. They are the registered tests whose command runs `compile_dxil`, that are not `_warp` or `_hardware` tests, and that need no executable beyond `compile_dxil` and `native_store_replay`. The one failure, `startup_compute_half_buffer_uav_controls` ("unsupported startup runtime manifest bindings: UAV kind unknown"), fails the same way on the unmodified `eeb52277` build. Before and after, with that unmodified compiler and a local script that is not in the branch. The 68 requests are the fixture programs with 64 and 128 threads, the slot 67 wave-size program, three straight-line programs of 441, 296 and 625 instructions with 64, 128 and 256 threads, and the 24 fixture requests again with the packed state block. | | compiled | refused | |---|---:|---:| | `main` `eeb52277` | 55 | 13 | | this branch | 67 | 1 | - All 55 modules that `main` produces are byte-identical in this branch. They include the 24 packed-state requests, which `main` compiles as virtual waves. - The 13 refusals on `main` all carry the old message. This branch compiles 12 of them and refuses the barrier inside a loop. App-local WARP 1.0.22 (`d3d10warp.dll` 1.0.22.0.20261027.1 beside the replay executable, in-box D3D12 runtime), with the fixture's requests replayed by a local script that passes `--direct-warp`: all 17 asserted readbacks matched in 12 of 12 runs. Before the second commit `lds_divergent` as lane pairs differed in every run, in the LDS read before the `s_barrier`, which is what the second commit fixes. The comments have the details and an independent run of the first commit on an RTX 4070 and on WARP 1.0.22. `python -B tests/docs_links_check.py` passes (156 files, 680 links). Not run: - A second adapter for the second commit, the debug layer, and a dispatch through the stand-in. - The `_warp` and `_hardware` tests of the rest of the suite. The fixture has no `--direct-warp` mode, and the in-box WARP has 4-lane waves (`docs/experiments/native-compute-warp.md`). - The compile counts over the 55 programs in #3237. The pull request check uses the `pr` preset, which does not build `compile_dxil` or select any `native_*` test, so a green check there does not exercise this change. The full suite runs on `main` and on a manual run of the workflow. A manual run of the first commit on my fork was cut off by the 30-minute job limit; the comments have its partial results. ## Evidence and follow-up The fixture programs are original. They were assembled with LLVM 15.0.7 (`clang -cc1as`, gfx1013, `+wavefrontsize64`) and are embedded as words with the assembly in comments, like the other `tests/native_*_check.py` files. Assumptions and gaps: - On hardware, lane pairs ran integer VOP1, VOP2 and VOP3 instructions, compares, `v_cmpx`, DPP row operations, `v_permlanex16_b32`, both lane reads, LDS reads and writes, raw buffer stores and one buffer atomic. Buffer loads, typed stores, image operations (implicit derivatives included), 16-bit and packed operations go through the same per-lane handlers, each emitted in its lower-half and its upper-half form, but were not run in a lane-pair module. - Programs that the gate refused now compile, so the in-process route can dispatch them when their bindings are supported. I have not run a lane-pair module through the stand-in. - Every host wave is assumed to be full, as on the split-halves path. - The ballot before an LDS access relies on a wave operation gathering every lane of the host wave. D3D12 does not state that. It held on WARP 1.0.22, and both GPUs matched without the ballot as well. - `main`'s wave32 path has no such ballot. A wave32 program in which a lane reads the LDS word another lane wrote one instruction earlier differs on WARP 1.0.22, with a module that is byte-identical to the unmodified compiler's. That path is not changed here. - `lds_same_address` fixes the host order: lane j + 32 wins. Which lane the guest hardware keeps is not established, so the result is asserted for lane pairs only. - `readfirstlane_empty` is not asserted for split halves. That lowering returns lane 32, not lane 0, for an empty EXEC. It is a separate defect on `main`, fixed in #3354, which is stacked on this branch. - The barrier loop ran with one `s_barrier`. `exit_before_barrier` shows that the loop works on this driver. It does not show that an early `ret` would have failed. - A lane-pair module emits each vector instruction twice. Size and timing against split halves were measured on an earlier base, with the layout switch that is not in this change and before the LDS ballot: [#3237 comment](https://github.com/R0Y00/Xbox2Windows/issues/3237#issuecomment-7232595595). Work someone else can pick up: a run of the second commit on another adapter, the same ballot for the wave32 path, and a lane-pair fixture for buffer loads or image operations. Maintainers can push to this branch. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
RonLogic commented 2026-11-28 12:35:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-28T12:35:40Z.


Independent run of c754ab997d6c1b5c388ba02e372f7000f46267b2 on 052abe6f.

RTX 4070: Debug and Release each passed all three selected tests with no skips. The full replay matched all 17 expected readbacks (2,064 words each), including exit_before_barrier, and all 16 negative controls found a mismatch. Windows 26300.10075, RTX 4070 10de:2786 driver 32.0.16.2124, DXC 1.9.2602.17. The replay did not instrument the debug layer.

App-local WARP 1.0.22: I used the same requests and CPU models, with the replay command's --direct changed to --direct-warp in a scratch runner. In each configuration, 14 of 17 expected readbacks matched and three differed.

Case Layout Readback
lds_divergent 128 guest threads, lane pairs 32 or 64 differences per run. Word 264 was 0x00000000 instead of 0x00007f05.
dpp_permlane_divergent 128 guest threads, lane pairs 88 differences. First at word 266, got 42, expected 34.
dpp_permlane_divergent 64 guest threads, split halves 88 differences. First at word 10, got 42, expected 34.

I repeated just the 128-thread LDS request 12 times per configuration with the same cached shader. Every run differed in column 0, the reversed-lane LDS read before the join barrier. Column 1, the read after that barrier, matched in all 24 runs. The 64-thread split-halves LDS case and the 256-thread early-exit/barrier case both matched. This isolates the failing output to the pre-barrier LDS read on WARP. The cause of the backend difference is still unverified.

cmake --build --preset <dev-or-release> --target compile_dxil native_store_replay
ctest --preset <dev-or-release> --no-tests=error -j 1 -V -R '^(native_wave64_lane_pairs_.*|native_direct_container)$'

WARP used d3d10warp.dll 1.0.22.0.20261027.1 beside the replay executable. These were standalone native replay tests. I used Codex for the scratch runner and ran the verification locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7239334348 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3352#issuecomment-7239334348). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-28T12:35:40Z. --- Independent run of `c754ab997d6c1b5c388ba02e372f7000f46267b2` on `052abe6f`. **RTX 4070:** Debug and Release each passed all three selected tests with no skips. The full replay matched all 17 expected readbacks (2,064 words each), including `exit_before_barrier`, and all 16 negative controls found a mismatch. Windows 26300.10075, RTX 4070 `10de:2786` driver `32.0.16.2124`, DXC 1.9.2602.17. The replay did not instrument the debug layer. **App-local WARP 1.0.22:** I used the same requests and CPU models, with the replay command's `--direct` changed to `--direct-warp` in a scratch runner. In each configuration, 14 of 17 expected readbacks matched and three differed. | Case | Layout | Readback | | --- | --- | --- | | `lds_divergent` | 128 guest threads, lane pairs | 32 or 64 differences per run. Word 264 was `0x00000000` instead of `0x00007f05`. | | `dpp_permlane_divergent` | 128 guest threads, lane pairs | 88 differences. First at word 266, got 42, expected 34. | | `dpp_permlane_divergent` | 64 guest threads, split halves | 88 differences. First at word 10, got 42, expected 34. | I repeated just the 128-thread LDS request 12 times per configuration with the same cached shader. Every run differed in column 0, the reversed-lane LDS read before the join barrier. Column 1, the read after that barrier, matched in all 24 runs. The 64-thread split-halves LDS case and the 256-thread early-exit/barrier case both matched. This isolates the failing output to the pre-barrier LDS read on WARP. The cause of the backend difference is still unverified. ```powershell cmake --build --preset <dev-or-release> --target compile_dxil native_store_replay ctest --preset <dev-or-release> --no-tests=error -j 1 -V -R '^(native_wave64_lane_pairs_.*|native_direct_container)$' ``` WARP used `d3d10warp.dll` 1.0.22.0.20261027.1 beside the replay executable. These were standalone native replay tests. I used Codex for the scratch runner and ran the verification locally.
Not-Saii commented 2026-11-28 13:20:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-28T13:20:45Z.


@RonLogic thanks for the independent run. The WARP result on lds_divergent is a real gap, and I have pushed a second commit for it: 3167ecb0, on top of c754ab99, with no force push, so your run still describes the first commit.

What was wrong. A guest lane may read an LDS word that another lane of its wave wrote one instruction earlier. Split halves order the two with the group barrier before each LDS access. A lane-pair module has no barrier there, and nothing else made the host bring all lanes of the wave to the same point before the read. Both GPUs matched anyway. WARP 1.0.22 did not, and my reading is that it runs a wave's lanes in smaller batches between wave operations.

The change. Each LDS access of a lane-pair module now takes its lane predicate from a WaveActiveBallot of its own, because a wave operation needs every lane of the wave at that point. D3D12 does not promise that this orders memory accesses. It is what WARP 1.0.22 did in the runs below.

WARP 1.0.22 here. d3d10warp.dll 1.0.22.0.20261027.1 beside the replay executable, in-box D3D12 runtime, the fixture's requests replayed by a local script with --direct-warp.

Request c754ab99 3167ecb0
lds_divergent, 128 threads, lane pairs differed in 15 of 15 runs: 32 or 64 words, all in the read before the s_barrier (word 264, got 0x00000000, expected 0x00007f05) matched in 12 of 12 runs
the other 16 asserted readbacks matched in 3 of 3 runs matched in 12 of 12 runs

That is your LDS result, reproduced and then gone.

The same gap exists on main's wave32 path. A wave32 program with 32 threads, in which each lane reads the word that lane 31 − l wrote one instruction earlier, differed on WARP 1.0.22 in every one of 27 runs (word 8, got 0x00000000, expected 0x00001f05). Its module is byte-identical to the one an unmodified compiler built from 052abe6f produces. With one compare placed between the write and the read, the same program matched in 12 of 12 runs. So this is not specific to lane pairs. That path is not changed here, and it needs a change of its own, because it alters modules that compile today.

dpp_permlane_divergent. I could not reproduce it: it matched here on WARP 1.0.22 under both layouts in every run. In your data it also fails under split halves, so it does not come from this change. I don't know the cause.

3167ecb0 on this machine. Windows 11 build 26300, RTX 4090 (driver 32.0.16.1088), Debug, debug layer not enabled.

  • native_wave64_lane_pairs_controls and native_wave64_lane_pairs_hardware pass: 17 readbacks match and all 16 negative controls report a mismatch.
  • The controls test has a new check: lds_same_address must have a ballot per lane set before each of its two LDS instructions, five in all. A build without the change has one and fails the check.
  • The 91 CPU-only tests that use compile_dxil pass, with no skips. They are the registered tests whose command runs compile_dxil, that are not _warp or _hardware tests, and that need no executable beyond compile_dxil and native_store_replay. native_direct_container is one of them.
  • Against an unmodified compiler built from 052abe6f, all 31 modules it produces over the 44 requests are still byte-identical.

Your RTX 4070 run covers the first commit. The second commit has run on the RTX 4090 and on WARP 1.0.22 only.

The full workflow on my fork, first commit. A manual run of "Windows checks" on c754ab99, next to a run on main at 052abe6f. The branch run is incomplete: both of its Windows jobs were cut off by the 30-minute job limit.

Job main 052abe6f c754ab99
Windows, Debug finished: 2,006 passed, 67 skipped, 1 failed (of 2,074) cut off after 1,335 of 2,075: 1,287 passed, 48 skipped, 0 failed
Windows, /O2 cut off after 2,056 of 2,074: 1,988 passed, 67 skipped, 1 failed cut off after 895 of 2,075: 849 passed, 45 skipped, 1 timed out
The two Linux jobs passed passed
  • Every test that ran in both has the same result, apart from the timeout: pixel_aot_warp hit its 60-second limit in the branch's /O2 job. It passed in the branch's Debug job at 57 seconds and takes 32 seconds on the baseline's runners. The tests common to both runs took about 1.7 times longer on the branch's runners, so I read the timeout as runner speed. One run does not prove that.
  • The failure on main is shader_compile_lds_request_cli_check, which compares runneradmin with RUNNER~1 in a temporary path.
  • The branch run reached only 25 of the 144 non-hardware tests that use compile_dxil, which is why I ran the 91 locally.

Runs: branch, main baseline.

Still open. The wave32 gap above, the cause of your dpp_permlane_divergent difference, a second adapter for 3167ecb0, the debug layer and a dispatch through the stand-in. I have updated the description and docs/experiments/native-wave64-lane-pairs.md to match.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7239869827 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3352#issuecomment-7239869827). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-28T13:20:45Z. --- @RonLogic thanks for the independent run. The WARP result on `lds_divergent` is a real gap, and I have pushed a second commit for it: `3167ecb0`, on top of `c754ab99`, with no force push, so your run still describes the first commit. **What was wrong.** A guest lane may read an LDS word that another lane of its wave wrote one instruction earlier. Split halves order the two with the group barrier before each LDS access. A lane-pair module has no barrier there, and nothing else made the host bring all lanes of the wave to the same point before the read. Both GPUs matched anyway. WARP 1.0.22 did not, and my reading is that it runs a wave's lanes in smaller batches between wave operations. **The change.** Each LDS access of a lane-pair module now takes its lane predicate from a `WaveActiveBallot` of its own, because a wave operation needs every lane of the wave at that point. D3D12 does not promise that this orders memory accesses. It is what WARP 1.0.22 did in the runs below. **WARP 1.0.22 here.** `d3d10warp.dll` 1.0.22.0.20261027.1 beside the replay executable, in-box D3D12 runtime, the fixture's requests replayed by a local script with `--direct-warp`. | Request | `c754ab99` | `3167ecb0` | |---|---|---| | `lds_divergent`, 128 threads, lane pairs | differed in 15 of 15 runs: 32 or 64 words, all in the read before the `s_barrier` (word 264, got `0x00000000`, expected `0x00007f05`) | matched in 12 of 12 runs | | the other 16 asserted readbacks | matched in 3 of 3 runs | matched in 12 of 12 runs | That is your LDS result, reproduced and then gone. **The same gap exists on `main`'s wave32 path.** A wave32 program with 32 threads, in which each lane reads the word that lane 31 − l wrote one instruction earlier, differed on WARP 1.0.22 in every one of 27 runs (word 8, got `0x00000000`, expected `0x00001f05`). Its module is byte-identical to the one an unmodified compiler built from `052abe6f` produces. With one compare placed between the write and the read, the same program matched in 12 of 12 runs. So this is not specific to lane pairs. That path is not changed here, and it needs a change of its own, because it alters modules that compile today. **`dpp_permlane_divergent`.** I could not reproduce it: it matched here on WARP 1.0.22 under both layouts in every run. In your data it also fails under split halves, so it does not come from this change. I don't know the cause. **`3167ecb0` on this machine.** Windows 11 build 26300, RTX 4090 (driver 32.0.16.1088), Debug, debug layer not enabled. - `native_wave64_lane_pairs_controls` and `native_wave64_lane_pairs_hardware` pass: 17 readbacks match and all 16 negative controls report a mismatch. - The controls test has a new check: `lds_same_address` must have a ballot per lane set before each of its two LDS instructions, five in all. A build without the change has one and fails the check. - The 91 CPU-only tests that use `compile_dxil` pass, with no skips. They are the registered tests whose command runs `compile_dxil`, that are not `_warp` or `_hardware` tests, and that need no executable beyond `compile_dxil` and `native_store_replay`. `native_direct_container` is one of them. - Against an unmodified compiler built from `052abe6f`, all 31 modules it produces over the 44 requests are still byte-identical. Your RTX 4070 run covers the first commit. The second commit has run on the RTX 4090 and on WARP 1.0.22 only. **The full workflow on my fork, first commit.** A manual run of "Windows checks" on `c754ab99`, next to a run on `main` at `052abe6f`. The branch run is incomplete: both of its Windows jobs were cut off by the 30-minute job limit. | Job | `main` `052abe6f` | `c754ab99` | |---|---|---| | Windows, Debug | finished: 2,006 passed, 67 skipped, 1 failed (of 2,074) | cut off after 1,335 of 2,075: 1,287 passed, 48 skipped, 0 failed | | Windows, /O2 | cut off after 2,056 of 2,074: 1,988 passed, 67 skipped, 1 failed | cut off after 895 of 2,075: 849 passed, 45 skipped, 1 timed out | | The two Linux jobs | passed | passed | - Every test that ran in both has the same result, apart from the timeout: `pixel_aot_warp` hit its 60-second limit in the branch's /O2 job. It passed in the branch's Debug job at 57 seconds and takes 32 seconds on the baseline's runners. The tests common to both runs took about 1.7 times longer on the branch's runners, so I read the timeout as runner speed. One run does not prove that. - The failure on `main` is `shader_compile_lds_request_cli_check`, which compares `runneradmin` with `RUNNER~1` in a temporary path. - The branch run reached only 25 of the 144 non-hardware tests that use `compile_dxil`, which is why I ran the 91 locally. Runs: [branch](https://github.com/Not-Saii/Xbox2Windows/actions/runs/46144668626), [`main` baseline](https://github.com/Not-Saii/Xbox2Windows/actions/runs/46144636139). **Still open.** The wave32 gap above, the cause of your `dpp_permlane_divergent` difference, a second adapter for `3167ecb0`, the debug layer and a dispatch through the stand-in. I have updated the description and `docs/experiments/native-wave64-lane-pairs.md` to match. AI-assisted.
Not-Saii commented 2026-11-28 14:22:31 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-28T14:22:31Z.


@R0Y00 this branch now conflicts with main (f5a6f6ba), and I'd like your call before I rebase, because the conflict is between two designs and not a mechanical one.

94d2803f added virtual waves at the gate this pull request replaces. As I read translate_program on main:

  • a divergent multi-wave64 group with a packed state block sets virtual_waves and no longer hits "multi-wave64 exchange requires converged group control flow";
  • every other request still gets that refusal.

The conflicts are one region at the gate in src/gfx1013_compute_native.cpp and seven in src/gfx1013_direct_compute.inl (register storage, initialize and the main loop). I have read those regions, not the whole virtual-wave mechanism.

Which of these do you want?

  1. Lane pairs only for the requests that main still refuses, with virtual waves left exactly as they are for packed-state requests.
  2. Virtual waves extended to the remaining requests, in which case this pull request should be closed or reduced to its fixture.
  3. Something else.

With option 1 I would rebase this branch and then the two stacked on it, #3354 and #3356, and rerun the fixture on the RTX 4090 and on WARP 1.0.22. Until you answer I will leave all three as they are.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7240620903 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3352#issuecomment-7240620903). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-28T14:22:31Z. --- @R0Y00 this branch now conflicts with `main` (`f5a6f6ba`), and I'd like your call before I rebase, because the conflict is between two designs and not a mechanical one. `94d2803f` added virtual waves at the gate this pull request replaces. As I read `translate_program` on `main`: - a divergent multi-wave64 group with a packed state block sets `virtual_waves` and no longer hits "multi-wave64 exchange requires converged group control flow"; - every other request still gets that refusal. The conflicts are one region at the gate in `src/gfx1013_compute_native.cpp` and seven in `src/gfx1013_direct_compute.inl` (register storage, `initialize` and the main loop). I have read those regions, not the whole virtual-wave mechanism. Which of these do you want? 1. Lane pairs only for the requests that `main` still refuses, with virtual waves left exactly as they are for packed-state requests. 2. Virtual waves extended to the remaining requests, in which case this pull request should be closed or reduced to its fixture. 3. Something else. With option 1 I would rebase this branch and then the two stacked on it, #3354 and #3356, and rerun the fixture on the RTX 4090 and on WARP 1.0.22. Until you answer I will leave all three as they are. AI-assisted.
Not-Saii commented 2026-11-28 20:05:18 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-28T20:05:18Z.


@R0Y00 I went ahead with option 1 from my question above. If you prefer another way, say so and I'll redo it.

Rebased onto main eeb52277 (force push): this branch is now 0864239e, 2c8a38be; #3354 is 71627ab2 and #3356 is 55d0b448, 1d03b1fe, both on top of it.

The gate in src/gfx1013_compute_native.cpp:

if (branches && synchronizes) {
    if (packed_state) compiler.virtual_waves = static_cast<unsigned>(threads / 64);
    else compiler.lane_pairs = true;
}

The two never apply to the same request. In the emitter the per-set loop now carries the virtual-wave yields at branches, s_endpgm and s_barrier, and initialize runs where main now calls it.

Taken again on 2c8a38be (RTX 4090, Debug, debug layer off):

  • native_wave64_lane_pairs_controls, native_wave64_lane_pairs_hardware and native_direct_container pass. 17 readbacks match and all 16 negative controls report a mismatch.
  • Against an unmodified compiler built from eeb52277, 68 requests, including the 24 fixture requests again with the packed state block: all 55 modules main produces are byte-identical here, the packed-state ones (virtual waves) included.
  • App-local WARP 1.0.22: all 17 asserted readbacks matched in 12 of 12 runs.
  • 90 of the 91 CPU-only compile_dxil tests pass. startup_compute_half_buffer_uav_controls fails here and on the unmodified eeb52277 build alike ("UAV kind unknown").

The description is updated. The stacked pull requests were re-run as well; their descriptions have the results.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7245025871 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3352#issuecomment-7245025871). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-28T20:05:18Z. --- @R0Y00 I went ahead with option 1 from my question above. If you prefer another way, say so and I'll redo it. Rebased onto `main` `eeb52277` (force push): this branch is now `0864239e`, `2c8a38be`; #3354 is `71627ab2` and #3356 is `55d0b448`, `1d03b1fe`, both on top of it. The gate in `src/gfx1013_compute_native.cpp`: ```cpp if (branches && synchronizes) { if (packed_state) compiler.virtual_waves = static_cast<unsigned>(threads / 64); else compiler.lane_pairs = true; } ``` The two never apply to the same request. In the emitter the per-set loop now carries the virtual-wave yields at branches, `s_endpgm` and `s_barrier`, and `initialize` runs where `main` now calls it. Taken again on `2c8a38be` (RTX 4090, Debug, debug layer off): - `native_wave64_lane_pairs_controls`, `native_wave64_lane_pairs_hardware` and `native_direct_container` pass. 17 readbacks match and all 16 negative controls report a mismatch. - Against an unmodified compiler built from `eeb52277`, 68 requests, including the 24 fixture requests again with the packed state block: all 55 modules `main` produces are byte-identical here, the packed-state ones (virtual waves) included. - App-local WARP 1.0.22: all 17 asserted readbacks matched in 12 of 12 runs. - 90 of the 91 CPU-only `compile_dxil` tests pass. `startup_compute_half_buffer_uav_controls` fails here and on the unmodified `eeb52277` build alike ("UAV kind unknown"). The description is updated. The stacked pull requests were re-run as well; their descriptions have the results. AI-assisted.
KelboLive commented 2026-11-28 20:59:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-28T20:59:03Z.

Review: APPROVED


LGTM — clean lane-pair layout for divergent multi-wave wave64 groups.

Replaces the "converged group control flow" refusal with the lane-pair layout: one host wave32 per guest wave64, host lane j carrying guest lanes j and j+32. Vector instructions emit once per lane set with VGPR duplication; scalar writes are held until both sets read operands. The WaveActiveBallot before LDS accesses ensures in-order semantics on WARP. The barrier loop handles s_barrier when waves can branch apart (waveDone shared memory + switch dispatch). Empty EXEC returns lane 0 (handled by #3354).

Test fixture exercises 9 programs across 128/64-thread groups with full negative controls.

Ready to land.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6100063563 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3352#pullrequestreview-6100063563). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-28T20:59:03Z. **Review:** APPROVED --- LGTM — clean lane-pair layout for divergent multi-wave wave64 groups. Replaces the "converged group control flow" refusal with the lane-pair layout: one host wave32 per guest wave64, host lane j carrying guest lanes j and j+32. Vector instructions emit once per lane set with VGPR duplication; scalar writes are held until both sets read operands. The WaveActiveBallot before LDS accesses ensures in-order semantics on WARP. The barrier loop handles s_barrier when waves can branch apart (waveDone shared memory + switch dispatch). Empty EXEC returns lane 0 (handled by #3354). Test fixture exercises 9 programs across 128/64-thread groups with full negative controls. Ready to land.
KelboLive commented 2026-11-28 21:57:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by KelboLive on 2026-11-28T21:57:36Z.

Review: APPROVED


LGTM — clean lane-pair layout for divergent multi-wave wave64 groups.

Replaces the "converged group control flow" refusal with the lane-pair layout: one host wave32 per guest wave64, host lane j carrying guest lanes j and j+32. Vector instructions emit once per lane set with VGPR duplication; scalar writes are held until both sets read operands. The WaveActiveBallot before LDS accesses ensures in-order semantics on WARP. The barrier loop handles s_barrier when waves can branch apart (waveDone shared memory + switch dispatch). Empty EXEC returns lane 0 (handled by #3354).

Test fixture exercises 9 programs across 128/64-thread groups with full negative controls.

Ready to land.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6100254627 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3352#pullrequestreview-6100254627). Originally posted by [KelboLive](https://github.com/KelboLive) on 2026-11-28T21:57:36Z. **Review:** APPROVED --- LGTM — clean lane-pair layout for divergent multi-wave wave64 groups. Replaces the "converged group control flow" refusal with the lane-pair layout: one host wave32 per guest wave64, host lane j carrying guest lanes j and j+32. Vector instructions emit once per lane set with VGPR duplication; scalar writes are held until both sets read operands. The WaveActiveBallot before LDS accesses ensures in-order semantics on WARP. The barrier loop handles s_barrier when waves can branch apart (waveDone shared memory + switch dispatch). Empty EXEC returns lane 0 (handled by #3354). Test fixture exercises 9 programs across 128/64-thread groups with full negative controls. Ready to land.
Not-Saii commented 2026-11-29 01:43:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-29T01:43:48Z.


Closing. main's virtual waves (94d2803f) already run every divergent multi-wave64 request that has the packed state block, and a census at 0614f68c found none left without it, so the lane-pair layout is not needed. Option 1 is withdrawn. The split-halves v_readfirstlane_b32 fix in #3354 will move to main on its own. The lane-pair version stays reachable as 2c8a38be.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7248975397 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3352#issuecomment-7248975397). Originally posted by [Not-Saii](https://github.com/Not-Saii) on 2026-11-29T01:43:48Z. --- Closing. `main`'s virtual waves (`94d2803f`) already run every divergent multi-wave64 request that has the packed state block, and a census at `0614f68c` found none left without it, so the lane-pair layout is not needed. Option 1 is withdrawn. The split-halves `v_readfirstlane_b32` fix in #3354 will move to `main` on its own. The lane-pair version stays reachable as `2c8a38be`. AI-assisted.

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
R0Y00/Xbox2Windows!3352
No description provided.