compute: accept VCC as source in 64-bit scalar bit-count and bit-scan #3458

Manually merged
github merged 3 commits from github-bot/gh-3456 into main 2026-11-29 13:44:35 +00:00 AGit
Owner

@⁠Leyukaka on GitHub · 2026-11-29 13:32 UTC · original
Leyukaka:takeover-3402-salu-bitscan64-vcc → main · +268 −8 · 7 files · 3 commits · merged 2026-11-29 13:41 UTC

Takeover of #3404 by @⁠Ammmae0x.

Change

  • 414874b6 (@⁠Ammmae0x, unchanged): the s0_pair guard in src/gfx1013_direct_compute.inl accepts s0 == 106 (VCC) as the 64-bit source of s_bcnt0_i32_b64, s_bcnt1_i32_b64, s_ff0_i32_b64, s_ff1_i32_b64, s_flbit_i32_b64 and s_flbit_i32_i64. It adds native_salu_bitscan64_vcc_controls / native_salu_bitscan64_vcc_hardware, switches two existing VCC refusals to M0, and updates docs/experiments/native-direct-salu-bitscan64.md.
  • 863e9549: merge of main c04e0dd6, no conflict.
  • ee117c4f (tests only, 2 files):
    • tests/native_scalar_mask64_check.py: removes the comment VCC stays refused as a 64-bit count source and the two count_program() cases (64 and 32 threads) that expected invalid s_bcnt1_i32_b64 source. count_program() defaults to src=106; the guard change stops refusing that source, so the two cases no longer hold (not run on 414874b6 alone; this is from reading the guard). count_program(src=107) stays.
    • tests/native_salu_bitscan64_vcc_check.py: adds a refusal case sop1(FF1_64, 24, VCC + 1) expecting invalid s_ff1_i32_b64 source, so the new controls also refuse vcc_hi (107) as a source. The printed count goes from 6 to 7 invalid forms.

git diff --stat c04e0dd6 ee117c4f: 7 files, +268 -8. git merge-tree --write-tree --name-only origin/main ee117c4f against main 17b662a2 exits 0.

Verification

Head ee117c4f, Windows, network off, dev preset configured with -DX2W_WITH_OPUS=OFF, full build (exit 0), a hardware adapter.

ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64|native_wave64_exec_salu|native_scalar_mask64_)' -> exit 0

native_salu_bitscan64_controls        Passed    1.86 s
native_salu_bitscan64_hardware        Passed   27.16 s
native_salu_bitscan64_vcc_controls    Passed    1.86 s
native_salu_bitscan64_vcc_hardware    Passed   57.59 s
native_scalar_mask64_controls         Passed    1.75 s
native_scalar_mask64_hardware         Passed    2.72 s
native_wave64_exec_salu_hardware      Passed    7.05 s
100% tests passed, 0 tests failed out of 7

compiled 64-bit scalar counts and scans (adjacent s32 descriptor preserved); 6 invalid forms refused; 6 reference mutants differ
compiled 6 ops with VCC source (plus lane-compare VCC); 7 invalid forms refused; 5 reference mutants differ

Not covered

  • No WARP leg: the four cmake files register only _controls and _hardware tests.
  • native_salu_bitscan64_vcc_hardware took 57.59 s here against its 60 s TIMEOUT.
  • release preset not run on this head.
  • The "reference mutants" mutate the Python reference, not the translator.
  • The wave32 cmp_lt16 / cmp_eq0 cases expect vcc_hi == 0 without setting it.
  • The gfx2hlsl text translator and the pixel path are untouched.
  • No run of the application.

Refs #3404, #3226, #2935

**@⁠Leyukaka** on GitHub · 2026-11-29 13:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3456) `Leyukaka:takeover-3402-salu-bitscan64-vcc` → `main` · +268 −8 · 7 files · 3 commits · merged 2026-11-29 13:41 UTC Takeover of #3404 by @⁠Ammmae0x. ## Change - `414874b6` (@⁠Ammmae0x, unchanged): the `s0_pair` guard in `src/gfx1013_direct_compute.inl` accepts `s0 == 106` (VCC) as the 64-bit source of `s_bcnt0_i32_b64`, `s_bcnt1_i32_b64`, `s_ff0_i32_b64`, `s_ff1_i32_b64`, `s_flbit_i32_b64` and `s_flbit_i32_i64`. It adds `native_salu_bitscan64_vcc_controls` / `native_salu_bitscan64_vcc_hardware`, switches two existing VCC refusals to `M0`, and updates `docs/experiments/native-direct-salu-bitscan64.md`. - `863e9549`: merge of `main` `c04e0dd6`, no conflict. - `ee117c4f` (tests only, 2 files): - `tests/native_scalar_mask64_check.py`: removes the comment `VCC stays refused as a 64-bit count source` and the two `count_program()` cases (64 and 32 threads) that expected `invalid s_bcnt1_i32_b64 source`. `count_program()` defaults to `src=106`; the guard change stops refusing that source, so the two cases no longer hold (not run on `414874b6` alone; this is from reading the guard). `count_program(src=107)` stays. - `tests/native_salu_bitscan64_vcc_check.py`: adds a refusal case `sop1(FF1_64, 24, VCC + 1)` expecting `invalid s_ff1_i32_b64 source`, so the new controls also refuse `vcc_hi` (107) as a source. The printed count goes from 6 to 7 invalid forms. `git diff --stat c04e0dd6 ee117c4f`: 7 files, +268 -8. `git merge-tree --write-tree --name-only origin/main ee117c4f` against `main` `17b662a2` exits 0. ## Verification Head `ee117c4f`, Windows, network off, `dev` preset configured with `-DX2W_WITH_OPUS=OFF`, full build (exit 0), a hardware adapter. `ctest --preset dev --no-tests=error -R '^(native_salu_bitscan64|native_wave64_exec_salu|native_scalar_mask64_)'` -> exit 0 ```text native_salu_bitscan64_controls Passed 1.86 s native_salu_bitscan64_hardware Passed 27.16 s native_salu_bitscan64_vcc_controls Passed 1.86 s native_salu_bitscan64_vcc_hardware Passed 57.59 s native_scalar_mask64_controls Passed 1.75 s native_scalar_mask64_hardware Passed 2.72 s native_wave64_exec_salu_hardware Passed 7.05 s 100% tests passed, 0 tests failed out of 7 compiled 64-bit scalar counts and scans (adjacent s32 descriptor preserved); 6 invalid forms refused; 6 reference mutants differ compiled 6 ops with VCC source (plus lane-compare VCC); 7 invalid forms refused; 5 reference mutants differ ``` ## Not covered - No WARP leg: the four cmake files register only `_controls` and `_hardware` tests. - `native_salu_bitscan64_vcc_hardware` took 57.59 s here against its 60 s `TIMEOUT`. - `release` preset not run on this head. - The "reference mutants" mutate the Python reference, not the translator. - The wave32 `cmp_lt16` / `cmp_eq0` cases expect `vcc_hi == 0` without setting it. - The `gfx2hlsl` text translator and the pixel path are untouched. - No run of the application. Refs #3404, #3226, #2935
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 13:32:51 +00:00
github manually merged commit c3cae6118c into main 2026-11-29 13:44:35 +00:00
Author
Owner

@⁠JohnConnorNPC on GitHub · 2026-11-29 13:40 UTC · original

Review of head ee117c4f. Its merge-base is c04e0dd6. git merge-tree --write-tree origin/main ee117c4f against main 4b0586d4 exits 0. No commit on main since c04e0dd6 touches src/gfx1013_direct_compute.inl. I only read the change. Nothing was built here; the native tests need Windows and DXC.

BLOCKED: this was CI still running. The run started at 13:32Z. At 13:38Z, Build and test on Windows, Run platform-independent Python checks on Linux and Assemble and translate gfx1013 fixtures had all passed, and the PR showed MERGEABLE CLEAN.

Checked:

  • The only source edit is the guard (|| s0 == 106 ||). operand32(i, 106) and operand32(i, 107) lift sgpr_limit to 108 for VCC. This is the same pair read that pair_high and the other 64-bit SALU guards on main already accept (s0 == 106 in the s_*_b64 mask lowerings). In wave32, initialize writes s107 = 0, which is why the cmp_lt16/cmp_eq0 wave32 cases expect hi = 0. The lowering after the guard is unchanged. It uses unaryBits 31/32/33 = Countbits/FirstbitLo/FirstbitHi.
  • The blocking point from the #3404 review is fixed. The two count_program() cases that expected invalid s_bcnt1_i32_b64 source for VCC are removed. count_program(src=107) stays. On the merged tree, git grep -n 'invalid s_(bcnt[01]_i32_b64|ff[01]_i32_b64|flbit_i32_[bi]64) source' finds only non-VCC sources (M0, odd SGPR, exec_hi, vcc_hi, float).
  • Default path: since #3451 these six ops with a VCC source are lowered in default runs instead of refused. The new hardware leg compares the result, the neighbour word, SCC and the guard words for all 6 ops × 6 VCC values, plus lane-compare VCC, in wave32 and wave64. By reading, controls fails on main: its first compile uses S0 = VCC and asserts returncode == 0.

SHOULD

  1. native_salu_bitscan64_vcc_hardware took 57.59 s in the posted run, against TIMEOUT 60 in tests/cmake/native_salu_bitscan64_vcc.cmake. It starts one native_store_replay per case, 102 in all (2 wave sizes × 51 cases). A slower adapter or a debug-layer run would hit the timeout, and ctest reports that as a failure, not a skip. A follow-up could raise the timeout, for example to 180 as tests/cmake/native_image_atomic_binops.cmake does, or batch the cases into fewer dispatches.

NIT

  1. docs/experiments/native-direct-salu-bitscan64.md says the controls check "6 invalid destination/source refusals (vcc/exec/m0 dst, …)". The refused tuple in tests/native_salu_bitscan64_check.py has no M0 destination case. The two destination cases are VCC and EXEC, and M0 is used only as a source.

Nothing blocks. Merging at ee117c4f.

AI-assisted.

**@⁠JohnConnorNPC** on GitHub · 2026-11-29 13:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3456#issuecomment-7256721416) Review of head `ee117c4f`. Its merge-base is `c04e0dd6`. `git merge-tree --write-tree origin/main ee117c4f` against `main` `4b0586d4` exits 0. No commit on `main` since `c04e0dd6` touches `src/gfx1013_direct_compute.inl`. I only read the change. Nothing was built here; the native tests need Windows and DXC. **BLOCKED:** this was CI still running. The run started at 13:32Z. At 13:38Z, `Build and test on Windows`, `Run platform-independent Python checks on Linux` and `Assemble and translate gfx1013 fixtures` had all passed, and the PR showed `MERGEABLE CLEAN`. Checked: - The only source edit is the guard (`|| s0 == 106 ||`). `operand32(i, 106)` and `operand32(i, 107)` lift `sgpr_limit` to 108 for VCC. This is the same pair read that `pair_high` and the other 64-bit SALU guards on `main` already accept (`s0 == 106` in the `s_*_b64` mask lowerings). In wave32, `initialize` writes `s107 = 0`, which is why the `cmp_lt16`/`cmp_eq0` wave32 cases expect `hi = 0`. The lowering after the guard is unchanged. It uses `unaryBits` 31/32/33 = Countbits/FirstbitLo/FirstbitHi. - The blocking point from the #3404 review is fixed. The two `count_program()` cases that expected `invalid s_bcnt1_i32_b64 source` for VCC are removed. `count_program(src=107)` stays. On the merged tree, `git grep -n 'invalid s_(bcnt[01]_i32_b64|ff[01]_i32_b64|flbit_i32_[bi]64) source'` finds only non-VCC sources (`M0`, odd SGPR, `exec_hi`, `vcc_hi`, float). - Default path: since #3451 these six ops with a VCC source are lowered in default runs instead of refused. The new hardware leg compares the result, the neighbour word, SCC and the guard words for all 6 ops × 6 VCC values, plus lane-compare VCC, in wave32 and wave64. By reading, `controls` fails on `main`: its first compile uses `S0 = VCC` and asserts `returncode == 0`. **SHOULD** 1. `native_salu_bitscan64_vcc_hardware` took 57.59 s in the posted run, against `TIMEOUT 60` in `tests/cmake/native_salu_bitscan64_vcc.cmake`. It starts one `native_store_replay` per case, 102 in all (2 wave sizes × 51 cases). A slower adapter or a debug-layer run would hit the timeout, and ctest reports that as a failure, not a skip. A follow-up could raise the timeout, for example to 180 as `tests/cmake/native_image_atomic_binops.cmake` does, or batch the cases into fewer dispatches. **NIT** 2. `docs/experiments/native-direct-salu-bitscan64.md` says the controls check "6 invalid destination/source refusals (`vcc`/`exec`/`m0` dst, …)". The `refused` tuple in `tests/native_salu_bitscan64_check.py` has no `M0` destination case. The two destination cases are VCC and EXEC, and `M0` is used only as a source. Nothing blocks. Merging at `ee117c4f`. AI-assisted.
This discussion has been locked. Commenting is limited to contributors.
No description provided.