compute: lower ds_bpermute_b32 without an LDS allocation #3320

Merged
Leyukaka merged 3 commits from upstream-pr/3320 into main 2026-12-02 12:20:45 +00:00
Leyukaka commented 2026-11-28 09:29:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T09:29:40Z.


Part of #3224 (claimed there). Target branch main.

ds_bpermute_b32 uses the LDS crossbar but reads and writes no LDS memory. The direct compute path refused it with "LDS instruction without allocation" when the request had no LDS, and it had no lowering of its own.

Change

  • src/gfx1013_compute_native.cpp:
    • is_ds_bpermute() matches DS opcode 0xb3 with GDS and the reserved bit clear;
    • in direct DXIL, it is exempt from the allocation refusal;
    • guest wave64 requests refuse it with ds_bpermute_b32 requires guest wave32.
  • src/gfx1013_direct_compute.inl: lower_ds_bpermute computes ((vaddr + offset) >> 2) & 31 and reads that lane's source VGPR with WaveReadLaneAt.
    • A source lane that is inactive in guest EXEC is modelled as 0. This is an assumption, the same rule as the direct DPP8 lowering; the hardware test checks the lowering against that model, not against console behaviour.
    • For groups of fewer than 32 threads, a lane with no host thread also counts as inactive.
    • The destination write honours EXEC like other vector writes.
    • The @lds global is not emitted for a program whose only DS instruction is ds_bpermute_b32.
  • tests/native_direct_container_check.py: compute() takes an LDS block count. The default emits the same bytes as before.

Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on main 3f780716 plus this commit.

  • The new native_ds_bpermute_controls checks:
    • the waveReadLaneAt dataflow;
    • the separate source and destination EXEC predicates;
    • that no addrspace(3) global or LDS barrier is emitted;
    • four refusals: a real LDS read and ds_permute_b32 keep "LDS instruction without allocation", and 32- and 64-thread wave64 requests get the new message.
  • With main's compile_dxil the positive program is refused with "LDS instruction without allocation", so the test fails there.
  • native_ds_bpermute_hardware passes on the RTX 5080: 336 texture words, with lanes 1 and 8 disabled and two lanes reading disabled sources. native_ds_bpermute_warp reports a capability skip (77).
  • ctest -R "native_|startup_compute|compile_dxil|salu" passes 528 of 529. native_scalar_lds_hardware fails as on main.
  • I measured my local set of 882 captured compute requests with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests (counts only):
    • 250 compile on main 3f780716, and 251 with this commit;
    • the added program is the one ds_bpermute_b32 refusal, 8,956 dispatches in that run;
    • none is lost, and the 250 programs that already compiled produce byte-identical output.

The fewer-than-32-thread branch and multi-wave wave32 groups (64 threads and up) are not covered by a test. I did not run source mutations. The failure on main covers removing the change.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5538739804 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T09:29:40Z. --- Part of #3224 (claimed there). Target branch `main`. `ds_bpermute_b32` uses the LDS crossbar but reads and writes no LDS memory. The direct compute path refused it with "LDS instruction without allocation" when the request had no LDS, and it had no lowering of its own. **Change** - `src/gfx1013_compute_native.cpp`: - `is_ds_bpermute()` matches DS opcode `0xb3` with GDS and the reserved bit clear; - in direct DXIL, it is exempt from the allocation refusal; - guest wave64 requests refuse it with `ds_bpermute_b32 requires guest wave32`. - `src/gfx1013_direct_compute.inl`: `lower_ds_bpermute` computes `((vaddr + offset) >> 2) & 31` and reads that lane's source VGPR with `WaveReadLaneAt`. - A source lane that is inactive in guest EXEC is modelled as 0. This is an assumption, the same rule as the direct DPP8 lowering; the hardware test checks the lowering against that model, not against console behaviour. - For groups of fewer than 32 threads, a lane with no host thread also counts as inactive. - The destination write honours EXEC like other vector writes. - The `@lds` global is not emitted for a program whose only DS instruction is `ds_bpermute_b32`. - `tests/native_direct_container_check.py`: `compute()` takes an LDS block count. The default emits the same bytes as before. **Tests.** The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release, on `main` `3f780716` plus this commit. - The new `native_ds_bpermute_controls` checks: - the `waveReadLaneAt` dataflow; - the separate source and destination EXEC predicates; - that no `addrspace(3)` global or LDS barrier is emitted; - four refusals: a real LDS read and `ds_permute_b32` keep "LDS instruction without allocation", and 32- and 64-thread wave64 requests get the new message. - With `main`'s `compile_dxil` the positive program is refused with "LDS instruction without allocation", so the test fails there. - `native_ds_bpermute_hardware` passes on the RTX 5080: 336 texture words, with lanes 1 and 8 disabled and two lanes reading disabled sources. `native_ds_bpermute_warp` reports a capability skip (77). - `ctest -R "native_|startup_compute|compile_dxil|salu"` passes 528 of 529. `native_scalar_lds_hardware` fails as on `main`. - I measured my local set of 882 captured compute requests with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests` (counts only): - 250 compile on `main` `3f780716`, and 251 with this commit; - the added program is the one `ds_bpermute_b32` refusal, 8,956 dispatches in that run; - none is lost, and the 250 programs that already compiled produce byte-identical output. The fewer-than-32-thread branch and multi-wave wave32 groups (64 threads and up) are not covered by a test. I did not run source mutations. The failure on `main` covers removing the change. AI-assisted.
tedin7 commented 2026-11-28 11:17:58 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-28T11:17:58Z.

Review: COMMENTED


Review of head 773d4e3b (the PR's own change is b83a449f; the new head only merges current main). Not merged: the PR's own D3D12 WARP readback test fails on Windows Server 2025.

What I checked:

  • src/gfx1013_compute_native.cpp and src/gfx1013_direct_compute.inl: the ds_bpermute_b32 match (DS opcode 0xb3, GDS and reserved bit clear), the no-LDS exemption, the wave32-only refusal, and the lowering (byte address from the address VGPR plus offset, source lane = address / 4 masked to 32, an inactive source lane reads zero, waveReadLaneAt for the data). This follows the public RDNA2 description of the backward permute. uses_lds correctly ignores the instruction, so no LDS global is declared.
  • The controls test passes and native_direct_container still passes.

Result on Windows Server 2025, D3D12 WARP 1.0.22, -R '^native_(ds_bpermute_(controls|warp)|direct_container|lds.*_controls)$':

  • dev and release: native_ds_bpermute_controls passed, native_direct_container passed, native_ds_bpermute_warp FAILED.
  • The failing test reports compared_words=336 mismatches=7, for example word=70 expected=00000022 actual=00000032, so the readback differs from the CPU reference for some lanes (debug layer clean).

What is needed: the readback must match on WARP, or the WARP leg must skip cleanly (exit 77) when the adapter's wave behaviour differs, with the real-GPU leg as the guard. As it stands the PR's own WARP test is red, so I did not merge. Both of my mutations (source lane mask 31 to 15, EXEC check dropped) fail the controls test, so the controls do guard the lowering.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6097436903 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#pullrequestreview-6097436903). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-28T11:17:58Z. **Review:** COMMENTED --- Review of head `773d4e3b` (the PR's own change is `b83a449f`; the new head only merges current `main`). Not merged: the PR's own D3D12 WARP readback test fails on Windows Server 2025. What I checked: - `src/gfx1013_compute_native.cpp` and `src/gfx1013_direct_compute.inl`: the `ds_bpermute_b32` match (DS opcode 0xb3, GDS and reserved bit clear), the no-LDS exemption, the wave32-only refusal, and the lowering (byte address from the address VGPR plus offset, source lane = address / 4 masked to 32, an inactive source lane reads zero, `waveReadLaneAt` for the data). This follows the public RDNA2 description of the backward permute. `uses_lds` correctly ignores the instruction, so no LDS global is declared. - The controls test passes and `native_direct_container` still passes. Result on Windows Server 2025, D3D12 WARP 1.0.22, `-R '^native_(ds_bpermute_(controls|warp)|direct_container|lds.*_controls)$'`: - dev and release: `native_ds_bpermute_controls` passed, `native_direct_container` passed, `native_ds_bpermute_warp` FAILED. - The failing test reports `compared_words=336 mismatches=7`, for example `word=70 expected=00000022 actual=00000032`, so the readback differs from the CPU reference for some lanes (debug layer clean). What is needed: the readback must match on WARP, or the WARP leg must skip cleanly (exit 77) when the adapter's wave behaviour differs, with the real-GPU leg as the guard. As it stands the PR's own WARP test is red, so I did not merge. Both of my mutations (source lane mask 31 to 15, EXEC check dropped) fail the controls test, so the controls do guard the lowering. AI-assisted; commands listed were executed locally.
Leyukaka commented 2026-11-28 11:26:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T11:26:29Z.


On WARP the per-lane WaveReadLaneAt index returned the wrong lane: word 70 expects 0x22 (lane 14) and reads 0x32 (lane 30), 16 lanes off. HLSL documents a non-uniform index as a shuffle, so this is a workaround for WARP: the new commit reads each present lane with a constant index and selects the one named by the address.

native_ds_bpermute_controls now checks the 32 constant-index reads and the per-lane selection, and native_ds_bpermute_hardware still matches 336 words on an RTX 5080. WARP skips here (no 32-lane wave), so the WARP leg is untested on my side.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7238553331 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#issuecomment-7238553331). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T11:26:29Z. --- On WARP the per-lane `WaveReadLaneAt` index returned the wrong lane: word 70 expects `0x22` (lane 14) and reads `0x32` (lane 30), 16 lanes off. HLSL documents a non-uniform index as a shuffle, so this is a workaround for WARP: the new commit reads each present lane with a constant index and selects the one named by the address. `native_ds_bpermute_controls` now checks the 32 constant-index reads and the per-lane selection, and `native_ds_bpermute_hardware` still matches 336 words on an RTX 5080. WARP skips here (no 32-lane wave), so the WARP leg is untested on my side.
Leyukaka commented 2026-11-29 03:07:49 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T03:07:49Z.


Since the review of 773d4e3b: bd310649 reads the ds_bpermute_b32 sources with constant lane indices, for the WARP mismatch reported there. native_ds_bpermute_warp skips here (no 32-lane wave), so a rerun of it on Server 2025 at bd310649 is what would confirm the change.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7249859058 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#issuecomment-7249859058). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T03:07:49Z. --- Since the review of `773d4e3b`: `bd310649` reads the `ds_bpermute_b32` sources with constant lane indices, for the WARP mismatch reported there. `native_ds_bpermute_warp` skips here (no 32-lane wave), so a rerun of it on Server 2025 at `bd310649` is what would confirm the change.
pigalot commented 2026-11-29 12:55:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-29T12:55:12Z.

Review: APPROVED


Independently reviewed bd310649 integrated over main fe1c1d31 (tree 2ad63d8c). The trial merge is clean and git diff --check is clean.

I approve the change. I am not merging it: the WARP mismatch tedin7 reported on Windows Server 2025 (word=70 expected=00000022 actual=00000032 at 773d4e3b) is what the second commit is for, and I could not confirm it. native_ds_bpermute_warp skips (77) on my machine because the inbox WARP has no 32-lane wave, and the Build and test on Windows job does not run it either. A rerun of that test on Server 2025 at bd310649 is the open item.

What I traced

  • is_ds_bpermute: (i.a >> 16) == 0xdacc is DS encoding 0x36, opcode 0xb3, with bits 17 and 16 clear. The address, data and destination fields are read from bits 0-7, 8-15 and 24-31 of the second word.
  • lower_ds_bpermute: source lane is ((vaddr + offset) >> 2) & 31; the source test uses guest EXEC (s126) at the source lane's bit; the result goes through vector_write, so an inactive destination lane keeps its old value.
  • The 32 constant-index waveReadLaneAt calls and the select chain choose the same lane as the earlier per-lane index. The group-size checks already on main (partial final wave in multi-wave group) keep every host wave at 32 lanes when the group has 32 or more threads, so the constant indices 0-31 name present lanes there.
  • The wave64 refusal runs before the lowering, for both the 64-thread and the 32-thread wave64 request.
  • A program with an LDS allocation and ds_bpermute_b32 now takes the new lowering instead of local_memory. No test covers that combination.

Tests
Built compile_dxil and offscreen_check in dev and release, then ran
ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^native_(ds_bpermute_(controls|warp)|direct_container|scalar_lds_controls|lds.*_controls|dpp8.*controls|image_atomic.*controls)$'
and native_ds_bpermute_hardware alone with -j 1:

  • Debug and Release /O2: 7 passed, including native_ds_bpermute_controls and native_direct_container; native_ds_bpermute_warp reported a capability skip (77), not a pass.
  • native_ds_bpermute_hardware passed in both presets on the RTX 5090: 336 texture words matched, debug layer enabled, no debug errors or warnings.
  • Negative control: with both source files as on main, native_ds_bpermute_controls and native_ds_bpermute_hardware fail.

Mutants (dev build; controls and hardware run for each)
Killed, 14:

  • by controls and hardware: lane mask 31 to 15 (16 mismatches); shift 2 to 3; offset dropped; source EXEC check dropped (2 mismatches); source EXEC test inverted; data register taken from the data1 field; address register taken from the data0 field; destination write ignoring EXEC (2 mismatches); only 16 lanes read; @lds emitted for the instruction; opcode 0xb2 matched instead of 0xb3.
  • by controls only: wave64 refusal removed.
  • by hardware only: constant read index l ^ 1 (28 mismatches); select compared against l ^ 1 (28 mismatches). The controls test checks that the 32 reads and the 32 compares exist, but not which read each compare selects, so only the GPU leg catches a wrong pairing.

Surviving, 3:

  • the match ignoring the GDS and reserved bits ((i.a >> 18) == 0x36b3): no case sets either bit;
  • the allocation exemption without the direct_dxil condition: no case sends the instruction through the non-direct path without an allocation;
  • the threads < 32 branch removed: no case uses a group smaller than 32 threads (the PR body says so).

Equivalent, 1:

  • removing source_lane = select(present, source_lane, lane);. With constant-index reads, an absent source lane matches none of the threads compares, so the value is 0, and enabled is false for it anyway. That line no longer has an effect and can go.

None of the survivors blocks this. A refusal case for the GDS bit and a group of fewer than 32 threads in the hardware test would pin the first and third.

Title run of this head (merged onto the baseline commit): pass.

Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; NVIDIA GeForce RTX 5090 driver 32.0.16.1088, debug layer enabled; inbox WARP (no 32-lane wave, native_ds_bpermute_warp skipped).
CI: Build and test on Windows passed on bd310649; it does not run the native_ds_bpermute_* tests.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6102961734 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#pullrequestreview-6102961734). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-29T12:55:12Z. **Review:** APPROVED --- Independently reviewed `bd310649` integrated over `main` `fe1c1d31` (tree `2ad63d8c`). The trial merge is clean and `git diff --check` is clean. I approve the change. I am not merging it: the WARP mismatch tedin7 reported on Windows Server 2025 (`word=70 expected=00000022 actual=00000032` at `773d4e3b`) is what the second commit is for, and I could not confirm it. `native_ds_bpermute_warp` skips (77) on my machine because the inbox WARP has no 32-lane wave, and the `Build and test on Windows` job does not run it either. A rerun of that test on Server 2025 at `bd310649` is the open item. **What I traced** - `is_ds_bpermute`: `(i.a >> 16) == 0xdacc` is DS encoding `0x36`, opcode `0xb3`, with bits 17 and 16 clear. The address, data and destination fields are read from bits 0-7, 8-15 and 24-31 of the second word. - `lower_ds_bpermute`: source lane is `((vaddr + offset) >> 2) & 31`; the source test uses guest EXEC (`s126`) at the source lane's bit; the result goes through `vector_write`, so an inactive destination lane keeps its old value. - The 32 constant-index `waveReadLaneAt` calls and the select chain choose the same lane as the earlier per-lane index. The group-size checks already on `main` (`partial final wave in multi-wave group`) keep every host wave at 32 lanes when the group has 32 or more threads, so the constant indices 0-31 name present lanes there. - The wave64 refusal runs before the lowering, for both the 64-thread and the 32-thread wave64 request. - A program with an LDS allocation and `ds_bpermute_b32` now takes the new lowering instead of `local_memory`. No test covers that combination. **Tests** Built `compile_dxil` and `offscreen_check` in `dev` and `release`, then ran `ctest --test-dir out/build/<preset> --no-tests=error -j 1 -R '^native_(ds_bpermute_(controls|warp)|direct_container|scalar_lds_controls|lds.*_controls|dpp8.*controls|image_atomic.*controls)$'` and `native_ds_bpermute_hardware` alone with `-j 1`: - Debug and Release `/O2`: 7 passed, including `native_ds_bpermute_controls` and `native_direct_container`; `native_ds_bpermute_warp` reported a capability skip (77), not a pass. - `native_ds_bpermute_hardware` passed in both presets on the RTX 5090: 336 texture words matched, debug layer enabled, no debug errors or warnings. - Negative control: with both source files as on `main`, `native_ds_bpermute_controls` and `native_ds_bpermute_hardware` fail. **Mutants** (dev build; controls and hardware run for each) Killed, 14: - by controls and hardware: lane mask 31 to 15 (16 mismatches); shift 2 to 3; offset dropped; source EXEC check dropped (2 mismatches); source EXEC test inverted; data register taken from the `data1` field; address register taken from the `data0` field; destination write ignoring EXEC (2 mismatches); only 16 lanes read; `@lds` emitted for the instruction; opcode `0xb2` matched instead of `0xb3`. - by controls only: wave64 refusal removed. - by hardware only: constant read index `l ^ 1` (28 mismatches); select compared against `l ^ 1` (28 mismatches). The controls test checks that the 32 reads and the 32 compares exist, but not which read each compare selects, so only the GPU leg catches a wrong pairing. Surviving, 3: - the match ignoring the GDS and reserved bits (`(i.a >> 18) == 0x36b3`): no case sets either bit; - the allocation exemption without the `direct_dxil` condition: no case sends the instruction through the non-direct path without an allocation; - the `threads < 32` branch removed: no case uses a group smaller than 32 threads (the PR body says so). Equivalent, 1: - removing `source_lane = select(present, source_lane, lane);`. With constant-index reads, an absent source lane matches none of the `threads` compares, so the value is 0, and `enabled` is false for it anyway. That line no longer has an effect and can go. None of the survivors blocks this. A refusal case for the GDS bit and a group of fewer than 32 threads in the hardware test would pin the first and third. Title run of this head (merged onto the baseline commit): pass. Environment: Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10; NVIDIA GeForce RTX 5090 driver 32.0.16.1088, debug layer enabled; inbox WARP (no 32-lane wave, `native_ds_bpermute_warp` skipped). CI: `Build and test on Windows` passed on `bd310649`; it does not run the `native_ds_bpermute_*` tests. This reply was AI-assisted.
JohnConnorNPC commented 2026-11-29 12:55:26 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-29T12:55:26Z.


Review of bd310649 against main 77d1ba4d. Verdict: hold. It merges cleanly (git merge-tree --write-tree origin/main bd310649 → rc 0), but the WARP fix is still unverified.

MUST

  1. native_ds_bpermute_warp was red on Windows Server 2025 at 773d4e3b (compared_words=336 mismatches=7, word=70 expected=00000022 actual=00000032). bd310649 changes the lowering for that failure, but nothing has run it on WARP since, because the author's WARP skips with 77. Since #3449 the native path is the default launcher path, so a wrong permute there would replace today's refusal (LDS instruction without allocation for a program with no LDS) with wrong lane data. A WARP pass at bd310649 would clear this.

SHOULD

  1. The workaround runs on every adapter: for (unsigned l = 0; l < (std::min)(threads, 32u); ++l) emits one waveReadLaneAt.i32 (DXIL 117) and one select per lane, so 32 of each per ds_bpermute_b32. If WARP's non-uniform WaveReadLaneAt is the only problem, the per-lane form is the cheaper lowering for hardware. Please say in the comment or body which adapters showed the wrong lane, so the cost is a known trade.
  2. CI selects neither new test: a re.search of the pr preset filter → False for native_ds_bpermute_controls and native_ds_bpermute_warp.

What I checked by reading:

  • is_ds_bpermute is (i.a >> 16) == 0xdacc = DS 0x36 << 10 | 0xb3 << 2, so op 179 with GDS and bit 16 clear.
  • The source lane is ((addr + offset) >> 2) & 31, an inactive source reads 0, and wave64 is refused.
  • uses_lds skips the instruction, so no @lds global is emitted.

Nothing built or run here.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7256160267 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#issuecomment-7256160267). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-29T12:55:26Z. --- Review of `bd310649` against main `77d1ba4d`. **Verdict: hold.** It merges cleanly (`git merge-tree --write-tree origin/main bd310649` → rc 0), but the WARP fix is still unverified. **MUST** 1. `native_ds_bpermute_warp` was red on Windows Server 2025 at `773d4e3b` (`compared_words=336 mismatches=7`, `word=70 expected=00000022 actual=00000032`). `bd310649` changes the lowering for that failure, but nothing has run it on WARP since, because the author's WARP skips with 77. Since #3449 the native path is the default launcher path, so a wrong permute there would replace today's refusal (`LDS instruction without allocation` for a program with no LDS) with wrong lane data. A WARP pass at `bd310649` would clear this. **SHOULD** 1. The workaround runs on every adapter: `for (unsigned l = 0; l < (std::min)(threads, 32u); ++l)` emits one `waveReadLaneAt.i32` (DXIL 117) and one select per lane, so 32 of each per `ds_bpermute_b32`. If WARP's non-uniform `WaveReadLaneAt` is the only problem, the per-lane form is the cheaper lowering for hardware. Please say in the comment or body which adapters showed the wrong lane, so the cost is a known trade. 2. CI selects neither new test: a `re.search` of the `pr` preset filter → `False` for `native_ds_bpermute_controls` and `native_ds_bpermute_warp`. What I checked by reading: - `is_ds_bpermute` is `(i.a >> 16) == 0xdacc` = DS `0x36 << 10 | 0xb3 << 2`, so op 179 with GDS and bit 16 clear. - The source lane is `((addr + offset) >> 2) & 31`, an inactive source reads 0, and wave64 is refused. - `uses_lds` skips the instruction, so no `@lds` global is emitted. Nothing built or run here. AI-assisted.
Leyukaka commented 2026-11-29 14:14:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T14:14:38Z.


Re: review of bd310649.

MUST 1: native_ds_bpermute_warp passes on WARP 1.0.22 at bd310649. Built at bd310649 itself (not merged; git merge-tree --write-tree origin/main bd310649 is clean against main 0ed385dc), dev preset with -DX2W_WITH_OPUS=OFF, full build. d3d10warp.dll from the NuGet package Microsoft.Direct3D.WARP 1.0.22 was placed next to offscreen_check.exe.

ctest --preset dev --no-tests=error -R '^native_ds_bpermute_'
test result output
native_ds_bpermute_controls Passed DS gather DXIL dataflow and refusal diagnostics matched
native_ds_bpermute_warp Passed DS gather and destination preservation matched across 336 texture words
native_ds_bpermute_hardware Passed DS gather and destination preservation matched across 336 texture words

100% tests passed, 0 tests failed out of 3

  • A passing native_ds_bpermute_* test does not print the adapter or the driver. The WARP leg is a pass and not a capability skip (77), which the inbox WARP cannot give because it has no 32-lane wave. The WARP version comes from another test's offscreen_check output in the same session, with the same DLL copied the same way: adapter=Microsoft Basic Render Driver vendor=1414 device=008c, driver=1.0.22.0.
  • Hardware adapter: NVIDIA GeForce RTX 5080, driver 32.0.16.2101. Host: Windows 11 build 10.0.26300.
  • This is WARP 1.0.22 on Windows 11, not Windows Server 2025. That same WARP output also prints debug_layer=unavailable, so the WARP pass is without the debug layer.

SHOULD 1: adapters that showed the wrong lane. I have no run that shows it. The only observation is the reported one: WARP 1.0.22 on Windows Server 2025 at 773d4e3b (word=70 expected=00000022 actual=00000032). I did not run the per-lane index form on WARP 1.0.22, so the mismatch is not reproduced here, and the pass above does not show that the constant-index form is what fixes it. On the RTX 5080 only bd310649 was measured in this run.

SHOULD 2: CI. Unchanged: this PR does not edit CMakePresets.json, so the pr preset selects none of the native_ds_bpermute_* tests.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7257151928 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#issuecomment-7257151928). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-29T14:14:38Z. --- Re: review of `bd310649`. **MUST 1: `native_ds_bpermute_warp` passes on WARP 1.0.22 at `bd310649`.** Built at `bd310649` itself (not merged; `git merge-tree --write-tree origin/main bd310649` is clean against `main` `0ed385dc`), `dev` preset with `-DX2W_WITH_OPUS=OFF`, full build. `d3d10warp.dll` from the NuGet package `Microsoft.Direct3D.WARP` 1.0.22 was placed next to `offscreen_check.exe`. ``` ctest --preset dev --no-tests=error -R '^native_ds_bpermute_' ``` | test | result | output | |---|---|---| | `native_ds_bpermute_controls` | Passed | `DS gather DXIL dataflow and refusal diagnostics matched` | | `native_ds_bpermute_warp` | Passed | `DS gather and destination preservation matched across 336 texture words` | | `native_ds_bpermute_hardware` | Passed | `DS gather and destination preservation matched across 336 texture words` | `100% tests passed, 0 tests failed out of 3` - A passing `native_ds_bpermute_*` test does not print the adapter or the driver. The WARP leg is a pass and not a capability skip (77), which the inbox WARP cannot give because it has no 32-lane wave. The WARP version comes from another test's `offscreen_check` output in the same session, with the same DLL copied the same way: `adapter=Microsoft Basic Render Driver vendor=1414 device=008c`, `driver=1.0.22.0`. - Hardware adapter: NVIDIA GeForce RTX 5080, driver 32.0.16.2101. Host: Windows 11 build 10.0.26300. - This is WARP 1.0.22 on Windows 11, not Windows Server 2025. That same WARP output also prints `debug_layer=unavailable`, so the WARP pass is without the debug layer. **SHOULD 1: adapters that showed the wrong lane.** I have no run that shows it. The only observation is the reported one: WARP 1.0.22 on Windows Server 2025 at `773d4e3b` (`word=70 expected=00000022 actual=00000032`). I did not run the per-lane index form on WARP 1.0.22, so the mismatch is not reproduced here, and the pass above does not show that the constant-index form is what fixes it. On the RTX 5080 only `bd310649` was measured in this run. **SHOULD 2: CI.** Unchanged: this PR does not edit `CMakePresets.json`, so the `pr` preset selects none of the `native_ds_bpermute_*` tests.
R0Y00 commented 2026-12-02 03:05:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T03:05:02Z.


The current main now supports padded partial final waves (#3808). Its LDS path explicitly refuses op 0xb3 under padding, but the new is_ds_bpermute arm runs before local_memory, and it reads unmasked read(126) with threads >= 32. This bypasses the refusal and can select a padded lane after a scalar EXEC write. Please rebase and keep the partial-tail refusal or use the valid-lane mask with a tail-lane readback control. The recorded WARP 1.0.22 and hardware passes on the older head are useful for the full-wave path.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7333512998 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#issuecomment-7333512998). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T03:05:02Z. --- The current main now supports padded partial final waves (#3808). Its LDS path explicitly refuses op 0xb3 under padding, but the new `is_ds_bpermute` arm runs before `local_memory`, and it reads unmasked `read(126)` with `threads >= 32`. This bypasses the refusal and can select a padded lane after a scalar EXEC write. Please rebase and keep the partial-tail refusal or use the valid-lane mask with a tail-lane readback control. The recorded WARP 1.0.22 and hardware passes on the older head are useful for the full-wave path.
Leyukaka commented 2026-12-02 07:34:36 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T07:34:36Z.


Thanks for catching this. Fixed in 8f5dc89b2 (rebased onto main): lower_ds_bpermute now refuses with the same reason as the LDS path, DS lane permutation is unsupported with a partial final wave, whenever the dispatch pads a final wave, before any EXEC read. A new partial-tail case (48 threads, wave32, no LDS, EXEC set to lanes 16..31) reproduces your scenario and expects that refusal. ds_permute and ds_swizzle still go through the LDS path, which already refused them. native_ds_bpermute_* and native_partial_final_wave_* pass on the new head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7338349848 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#issuecomment-7338349848). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-12-02T07:34:36Z. --- Thanks for catching this. Fixed in `8f5dc89b2` (rebased onto `main`): `lower_ds_bpermute` now refuses with the same reason as the LDS path, `DS lane permutation is unsupported with a partial final wave`, whenever the dispatch pads a final wave, before any EXEC read. A new `partial-tail` case (48 threads, wave32, no LDS, EXEC set to lanes 16..31) reproduces your scenario and expects that refusal. `ds_permute` and `ds_swizzle` still go through the LDS path, which already refused them. `native_ds_bpermute_*` and `native_partial_final_wave_*` pass on the new head.
R0Y00 commented 2026-12-02 12:19:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T12:19:44Z.

Review: APPROVED


The padded-final-wave issue is addressed on 8f5dc89b. The new 48-thread control exercises a scalar EXEC write and checks the explicit DS permutation refusal before the lane read. I built compile_dxil and offscreen_check in Debug and ran ctest --preset dev --no-tests=error -j 1 -R '^native_(ds_bpermute_|partial_final_wave_|direct_container$)' --output-on-failure. Three translation/control tests and both RTX 4060 Laptop GPU readbacks passed. The two inbox WARP tests returned 77 because it lacks a 32-lane wave (Windows build 26300.9974, NVIDIA driver 32.0.16.1656, WARP 10.0.26100.9818, debug layer enabled). The author's WARP 1.0.22 result remains separate. Trial merge and required Windows CI pass.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6150588722 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3320#pullrequestreview-6150588722). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-12-02T12:19:44Z. **Review:** APPROVED --- The padded-final-wave issue is addressed on `8f5dc89b`. The new 48-thread control exercises a scalar EXEC write and checks the explicit DS permutation refusal before the lane read. I built `compile_dxil` and `offscreen_check` in Debug and ran `ctest --preset dev --no-tests=error -j 1 -R '^native_(ds_bpermute_|partial_final_wave_|direct_container$)' --output-on-failure`. Three translation/control tests and both RTX 4060 Laptop GPU readbacks passed. The two inbox WARP tests returned 77 because it lacks a 32-lane wave (Windows build 26300.9974, NVIDIA driver 32.0.16.1656, WARP 10.0.26100.9818, debug layer enabled). The author's WARP 1.0.22 result remains separate. Trial merge and required Windows CI pass.
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!3320
No description provided.