Skip to content

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

Merged
tedin7 merged 2 commits into
R0Y00:mainfrom
Leyukaka:s-not-b64-exec
Nov 28, 2026
Merged

tedin7 merged 2 commits into
R0Y00:mainfrom
Leyukaka:s-not-b64-exec

Conversation

@Leyukaka

@Leyukaka Leyukaka commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

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 compute: accept EXEC as a 64-bit scalar operand in direct compute #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: compute: accept EXEC as a 64-bit scalar operand in direct compute #3245 and my earlier comment on direct compute: untranslated compute shaders of a start-up run ranked by dispatches, with first refusals on main #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 compute: accept EXEC as a 64-bit scalar operand in direct compute #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.

AI-assisted.

s_not_b64 and s_cselect_b64 now take VCC and EXEC as 64-bit sources in
direct compute, reading both words from the existing SALU register
slots (VCC_HI, EXEC_HI), and s_not_b64 may write EXEC through the same
pair of writes the other 64-bit SALU mask operations use. s_not_b64
writes SCC after its destination. Odd SGPRs, M0 and other special
registers stay refused, as does s_cselect_b64 into EXEC.

New test native_s_not_b64_exec (controls, hardware) covers NOT from
EXEC and VCC, CSELECT under SCC 0 and 1, and NOT into EXEC with a
per-lane store, in wave32 and wave64. native_salu64_controls refused
s_not_b64 from VCC; that control now uses EXEC_HI (127), which stays
refused.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

tedin7 commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Win2025 WARP receipt for head 0cc54d1 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: 0cc54d1 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.

@tedin7
tedin7 merged commit dbaa010 into R0Y00:main Nov 28, 2026
5 checks passed
lambirou added a commit to lambirou/Xbox2Windows that referenced this pull request Nov 28, 2026
Absorb R0Y00#3262's scalar64 source validation for s_cselect_b64 and s_not_b64, including VCC and EXEC sources, while keeping the branch's direct-compute paths.
tedin7 added a commit to tedin7/Xbox2Windows that referenced this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants