compute: accept VCC and EXEC in direct 64-bit s_not and s_cselect #3262

Merged
Leyukaka merged 2 commits from upstream-pr/3262 into main 2026-11-28 03:26:33 +00:00
Leyukaka commented 2026-11-28 02:30:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-28T02:30:44Z.


Part of #2935 and #3224. Target branch main. Rebased on main 0637fced now that #3245 is merged: one commit.

Change (src/gfx1013_direct_compute.inl, the s_cselect_b64 / s_not_b64 block):

  • s_not_b64 and s_cselect_b64 accept VCC (106) and EXEC (126) as 64-bit sources. Both words are read from the existing SALU register slots: VCC/VCC_HI and EXEC/EXEC_HI, in wave32 and wave64.
  • s_not_b64 may write EXEC. It uses the same pair of writes (dst, dst + 1) as s_bfm_b64 in #3245 and the s_*_b64 / s_*_saveexec_b64 mask operations already on main. The SCC write moves after the destination writes, with no behaviour change.
  • On VCC in wave64: #3245 and my earlier comment on #3224 kept VCC refused there, because nothing guarantees both its words. Here VCC is read the way s_mov_b64 and the _b64 mask operations on main already read it (operand32(106) plus pair_high, so 107). Ballot writers publish both words through the exchange. As on main for those operations, a VCC_HI that was never written is not refused in wave64; wave32 initialises it to 0.
  • Odd SGPRs, M0 and the other special registers stay refused, as does s_cselect_b64 into EXEC.
  • docs/experiments/native-salu64-ops.md now says s_not_b64 may write EXEC. It lists the VCC/EXEC sources and the new test command.

Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release.

  • New native_s_not_b64_exec_controls and _hardware reuse the #3245 fixture, in wave32 and wave64. They cover:
    • NOT from EXEC and from VCC, plus VCC all ones, so SCC is 0;
    • CSELECT of EXEC and VCC under SCC 0 and 1;
    • NOT into EXEC, followed by a per-lane store.
  • The readback checks both result words, SCC, the guard words and, after the EXEC write, which lanes stored.
  • The controls also check refusals for an odd SGPR source, an M0 source (in either CSELECT position), and CSELECT into EXEC.
  • With main's compile_dxil before this change, the controls stop at "invalid s_not_b64 source".
  • Mutation checks by hand:
    • swapping the CSELECT arms fails the hardware test;
    • refusing the EXEC destination again fails both tests.
  • tests/native_salu64_check.py refused s_not_b64 s24, vcc. That control now uses EXEC_HI (127, odd), which stays refused.
  • On a full build, ctest -R "native_|startup_compute|compile_dxil|salu" passed 417 of 418 before the rebase. native_scalar_lds_hardware fails as on main. After the rebase on 0637fced, the native_s_not_b64_exec, native_salu, native_wave64_exec_salu, cselect and native_direct_container tests pass, 22 of 22.

Measured with compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, #3245 on main 7364e6a9 against this change on that base. This was measured before #3245 was merged and not re-measured after the rebase. The merged #3245 has the same source and test changes (it adds docs only), but main has advanced 12 commits since 7364e6a9, so only the differences below carry over, not the totals.

  • Local capture of 2,689 requests: 522 to 528 compile. Of the 21 programs that stopped at these refusals, 6 compile. The others stop later:
    • 5 at "unbound numeric SGPR";
    • 4 at "direct descriptor address outside bound table";
    • 2 at "unsupported wave64 scalar operation";
    • 2 at image modifiers;
    • 1 at v_rcp_f16;
    • 1 at a DS opcode.
  • The 882 requests of #3224: 141 to 143, 20,902 dispatches.
  • No program that compiled before stops compiling.
  • Counts and instruction shape only.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5535826588 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3262). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-28T02:30:44Z. --- Part of #2935 and #3224. Target branch `main`. Rebased on `main` `0637fced` now that #3245 is merged: one commit. **Change** (`src/gfx1013_direct_compute.inl`, the `s_cselect_b64` / `s_not_b64` block): - `s_not_b64` and `s_cselect_b64` accept VCC (106) and EXEC (126) as 64-bit sources. Both words are read from the existing SALU register slots: VCC/VCC_HI and EXEC/EXEC_HI, in wave32 and wave64. - `s_not_b64` may write EXEC. It uses the same pair of writes (`dst`, `dst + 1`) as `s_bfm_b64` in #3245 and the `s_*_b64` / `s_*_saveexec_b64` mask operations already on `main`. The SCC write moves after the destination writes, with no behaviour change. - On VCC in wave64: #3245 and my earlier comment on #3224 kept VCC refused there, because nothing guarantees both its words. Here VCC is read the way `s_mov_b64` and the `_b64` mask operations on `main` already read it (`operand32(106)` plus `pair_high`, so 107). Ballot writers publish both words through the exchange. As on `main` for those operations, a VCC_HI that was never written is not refused in wave64; wave32 initialises it to 0. - Odd SGPRs, M0 and the other special registers stay refused, as does `s_cselect_b64` into EXEC. - `docs/experiments/native-salu64-ops.md` now says `s_not_b64` may write EXEC. It lists the VCC/EXEC sources and the new test command. **Tests.** The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, Release. - New `native_s_not_b64_exec_controls` and `_hardware` reuse the #3245 fixture, in wave32 and wave64. They cover: - NOT from EXEC and from VCC, plus VCC all ones, so SCC is 0; - CSELECT of EXEC and VCC under SCC 0 and 1; - NOT into EXEC, followed by a per-lane store. - The readback checks both result words, SCC, the guard words and, after the EXEC write, which lanes stored. - The controls also check refusals for an odd SGPR source, an M0 source (in either CSELECT position), and CSELECT into EXEC. - With `main`'s `compile_dxil` before this change, the controls stop at "invalid s_not_b64 source". - Mutation checks by hand: - swapping the CSELECT arms fails the hardware test; - refusing the EXEC destination again fails both tests. - `tests/native_salu64_check.py` refused `s_not_b64 s24, vcc`. That control now uses EXEC_HI (127, odd), which stays refused. - On a full build, `ctest -R "native_|startup_compute|compile_dxil|salu"` passed 417 of 418 before the rebase. `native_scalar_lds_hardware` fails as on `main`. After the rebase on `0637fced`, the `native_s_not_b64_exec`, `native_salu`, `native_wave64_exec_salu`, `cselect` and `native_direct_container` tests pass, 22 of 22. **Measured** with `compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests`, #3245 on `main` `7364e6a9` against this change on that base. This was measured before #3245 was merged and not re-measured after the rebase. The merged #3245 has the same source and test changes (it adds docs only), but `main` has advanced 12 commits since `7364e6a9`, so only the differences below carry over, not the totals. - Local capture of 2,689 requests: 522 to 528 compile. Of the 21 programs that stopped at these refusals, 6 compile. The others stop later: - 5 at "unbound numeric SGPR"; - 4 at "direct descriptor address outside bound table"; - 2 at "unsupported wave64 scalar operation"; - 2 at image modifiers; - 1 at `v_rcp_f16`; - 1 at a DS opcode. - The 882 requests of #3224: 141 to 143, 20,902 dispatches. - No program that compiled before stops compiling. - Counts and instruction shape only. AI-assisted.
tedin7 commented 2026-11-28 03:26:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-28T03:26:19Z.

Review: COMMENTED


Review of head 0cc54d1c (the PR's own change is the same as 1b58e0e1; the new head only merges current main). The dependency #3245 is merged.

What I checked:

  • src/gfx1013_direct_compute.inl, the s_cselect_b64 / s_not_b64 block: both words of a VCC (106/107) or EXEC (126/127) source now come from operand32 plus pair_high, the same reads the s_mov_b64 and _b64 mask operations already use. Odd SGPRs, M0 and the other special registers stay refused, and so does s_cselect_b64 into EXEC. s_not_b64 into EXEC writes both words through the same write(dst) / write(dst + 1) pair as the SAVEEXEC path; the SCC write after the destination writes is computed from the same lo | hi, so it is unchanged.
  • Inline constants and the literal go through the same pair_high as before the change.
  • Tests: native_s_not_b64_exec_controls (wave32 and wave64 compiles, plus the odd SGPR / M0 / CSELECT-into-EXEC refusals) and native_s_not_b64_exec_hardware (real D3D12 readback of both result words, SCC, the guard words, and which lanes store after NOT into EXEC). The expected words come from a plain 64-bit Python reference, not from the translator. The native_salu64_check.py control moved from VCC (now accepted) to EXEC_HI (odd, still refused).

Commands run:

  • Linux: python3 tests/docs_links_check.py ok, python3 tests/bidi_controls_check.py ok, git diff --check origin/main...HEAD clean, python3 -m py_compile on both touched test files ok.
  • Windows Server 2025, D3D12 WARP 1.0.22 (the hardware test ran on WARP, it did not skip), -R '^native_(s_not_b64_exec_controls|s_not_b64_exec_hardware|salu64_controls|salu64_hardware|wave64_exec_salu_hardware|compute_clear|direct_container)$': dev 7/7 passed, release 7/7 passed.
  • Mutation 1 (the high word of a 64-bit source read from the low word, in this block only): native_s_not_b64_exec_hardware fails at wave32 not_exec, word 520.
  • Mutation 2 (s_not_b64 writes SCC = 0): native_s_not_b64_exec_hardware fails at wave32 not_exec, word 776 (the SCC plane).

No blocking findings. The receipt follows in a separate comment.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6095427698 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3262#pullrequestreview-6095427698). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-28T03:26:19Z. **Review:** COMMENTED --- Review of head `0cc54d1c` (the PR's own change is the same as `1b58e0e1`; the new head only merges current `main`). The dependency #3245 is merged. What I checked: - `src/gfx1013_direct_compute.inl`, the `s_cselect_b64` / `s_not_b64` block: both words of a VCC (106/107) or EXEC (126/127) source now come from `operand32` plus `pair_high`, the same reads the `s_mov_b64` and `_b64` mask operations already use. Odd SGPRs, M0 and the other special registers stay refused, and so does `s_cselect_b64` into EXEC. `s_not_b64` into EXEC writes both words through the same `write(dst)` / `write(dst + 1)` pair as the SAVEEXEC path; the SCC write after the destination writes is computed from the same `lo | hi`, so it is unchanged. - Inline constants and the literal go through the same `pair_high` as before the change. - Tests: `native_s_not_b64_exec_controls` (wave32 and wave64 compiles, plus the odd SGPR / M0 / CSELECT-into-EXEC refusals) and `native_s_not_b64_exec_hardware` (real D3D12 readback of both result words, SCC, the guard words, and which lanes store after NOT into EXEC). The expected words come from a plain 64-bit Python reference, not from the translator. The `native_salu64_check.py` control moved from VCC (now accepted) to EXEC_HI (odd, still refused). Commands run: - Linux: `python3 tests/docs_links_check.py` ok, `python3 tests/bidi_controls_check.py` ok, `git diff --check origin/main...HEAD` clean, `python3 -m py_compile` on both touched test files ok. - Windows Server 2025, D3D12 WARP 1.0.22 (the hardware test ran on WARP, it did not skip), `-R '^native_(s_not_b64_exec_controls|s_not_b64_exec_hardware|salu64_controls|salu64_hardware|wave64_exec_salu_hardware|compute_clear|direct_container)$'`: dev 7/7 passed, release 7/7 passed. - Mutation 1 (the high word of a 64-bit source read from the low word, in this block only): `native_s_not_b64_exec_hardware` fails at wave32 `not_exec`, word 520. - Mutation 2 (`s_not_b64` writes SCC = 0): `native_s_not_b64_exec_hardware` fails at wave32 `not_exec`, word 776 (the SCC plane). No blocking findings. The receipt follows in a separate comment. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-28 03:26:20 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-28T03:26:20Z.


Win2025 WARP receipt for head 0cc54d1c after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit 0cc54d1c63332718df6726de2c2515890c4ed757:

  • Debug (--preset dev):
    • Build (cmake --build --preset dev --target compile_dxil native_store_replay -- -j 3): 8.23s (configure 0.00s)
    • Test (ctest --preset dev -R '^native_(s_not_b64_exec_controls|s_not_b64_exec_hardware|salu64_controls|salu64_hardware|wave64_exec_salu_hardware|compute_clear|direct_container)$' --parallel 4 --no-tests=error --output-on-failure): 7/7 passed (14.94s: native_salu64_controls 0.26s, native_compute_clear 0.40s, native_s_not_b64_exec_hardware 1.80s, native_s_not_b64_exec_controls 1.89s, native_salu64_hardware 2.03s, native_wave64_exec_salu_hardware 1.81s, native_direct_container 14.28s)
  • Release /O2 (--preset release):
    • Build (cmake --build --preset release --target compile_dxil native_store_replay -- -j 3): 30.68s (configure 0.00s)
    • Test (ctest --preset release -R '^native_(s_not_b64_exec_controls|s_not_b64_exec_hardware|salu64_controls|salu64_hardware|wave64_exec_salu_hardware|compute_clear|direct_container)$' --parallel 4 --no-tests=error --output-on-failure): 7/7 passed (12.66s: native_salu64_controls 0.17s, native_compute_clear 0.26s, native_s_not_b64_exec_controls 0.97s, native_s_not_b64_exec_hardware 0.95s, native_salu64_hardware 1.16s, native_wave64_exec_salu_hardware 0.97s, native_direct_container 12.22s)
  • sccache: 1/8 hits; wall 48.6s
    tested: 0cc54d1c via fetch (pull/3262/head, no patch)

The new tests native_s_not_b64_exec_controls and native_s_not_b64_exec_hardware (on WARP, not skipped) and the changed native_salu64_controls ran in both legs.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7233072919 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/3262#issuecomment-7233072919). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-28T03:26:20Z. --- Win2025 WARP receipt for head 0cc54d1c after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit `0cc54d1c63332718df6726de2c2515890c4ed757`: - **Debug (`--preset dev`)**: - Build (`cmake --build --preset dev --target compile_dxil native_store_replay -- -j 3`): `8.23s` (configure `0.00s`) - Test (`ctest --preset dev -R '^native_(s_not_b64_exec_controls|s_not_b64_exec_hardware|salu64_controls|salu64_hardware|wave64_exec_salu_hardware|compute_clear|direct_container)$' --parallel 4 --no-tests=error --output-on-failure`): **7/7 passed** (`14.94s`: `native_salu64_controls` `0.26s`, `native_compute_clear` `0.40s`, `native_s_not_b64_exec_hardware` `1.80s`, `native_s_not_b64_exec_controls` `1.89s`, `native_salu64_hardware` `2.03s`, `native_wave64_exec_salu_hardware` `1.81s`, `native_direct_container` `14.28s`) - **Release `/O2` (`--preset release`)**: - Build (`cmake --build --preset release --target compile_dxil native_store_replay -- -j 3`): `30.68s` (configure `0.00s`) - Test (`ctest --preset release -R '^native_(s_not_b64_exec_controls|s_not_b64_exec_hardware|salu64_controls|salu64_hardware|wave64_exec_salu_hardware|compute_clear|direct_container)$' --parallel 4 --no-tests=error --output-on-failure`): **7/7 passed** (`12.66s`: `native_salu64_controls` `0.17s`, `native_compute_clear` `0.26s`, `native_s_not_b64_exec_controls` `0.97s`, `native_s_not_b64_exec_hardware` `0.95s`, `native_salu64_hardware` `1.16s`, `native_wave64_exec_salu_hardware` `0.97s`, `native_direct_container` `12.22s`) - `sccache`: 1/8 hits; wall `48.6s` tested: 0cc54d1c via fetch (pull/3262/head, no patch) The new tests `native_s_not_b64_exec_controls` and `native_s_not_b64_exec_hardware` (on WARP, not skipped) and the changed `native_salu64_controls` ran in both legs. AI-assisted; commands listed were executed locally.
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!3262
No description provided.