shader: lower compute s_bitreplicate_b64_b32 lane masks #1575

Merged
Asimmimx merged 1 commit from upstream-pr/1582 into main 2026-11-24 17:56:01 +00:00
Asimmimx commented 2026-11-24 14:35:44 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Asimmimx on 2026-11-24T14:35:44Z.


Change

Refs #1546. This lowers s_bitreplicate_b64_b32 lane-pattern masks in the compute translator (tools/compute_store_aot.py). It also adds one minimal consumer that makes such a mask observable: a lane select through v_cndmask_b32_e64.

Lowering rules

  • s_bitreplicate_b64_b32 s[d:d+1], imm: D.u64[2i] = D.u64[2i+1] = S0.u32[i], per the RDNA 2 ISA, the same as the existing pixel_aot helper. With an inline or 32-bit literal source, both halves become known scalar words: the low half replicates bits 0–15 and the high half bits 16–31.
    • Any other source, such as an SGPR, a VGPR, a float or a value wider than 32 bits, is refused with Unverified lane mask source.
    • An odd, non-consecutive, out-of-range or pending pair is refused with Invalid lane mask destination.
  • v_cndmask_b32_e64 vD, a, b, sM (wave32 spelling): D = mask[lane] ? b : a. It lowers to (((0xMASKu >> (tid.x % Xu)) & 1u) != 0u ? b : a), and the result is data only.
    • The mask must be a statically known word, either a replicated half or an immediate. Anything else is refused with Unverified lane mask.
    • Unknown a/b operands, or a destination past v255, are refused with Unverified ALU operand.
  • Wave size: a one-dimensional group of at most 32 threads is a single wave on both wave32 and wave64, so the lane is the local X index and only the low 32 bits of the mask are read. Larger or multi-dimensional groups would depend on a wave size the translator cannot see. They are refused with Lane mask select requires a one-dimensional group of at most 32 threads rather than guessed.

The change adds two new elif branches before the s_lshl_b32 branch. It touches no shared table or comment.

Fixture (tests/compute_lane_mask_check.py, new; it imports the helpers of tests/compute_store_check.py, which is unchanged)

  • Masks:
    • m = bitreplicate(0x3f3f3f3f) = 0x0fff0fff in both halves.
    • n = bitreplicate(0x9c3a5e17): low 0x33fc033f, high 0xc3f00fcc.
  • Per thread, one buffer_store_dwordx4 stores four words:
    • m.lo[lane] ? 0x600d : gid
    • n.lo[lane] ? gid : 0xbeef
    • n.hi[lane] ? gid : 0xffffffff
    • the plain word 0xc3f00fcc
  • Runs: groups of 32 (1 and 2 groups) and of 16 (1, 3 and 5 groups). The expected words come from a bit-by-bit Python model of the ISA text.

The draw must also reject the following, each at its first differing word:

  • 6 wrong references: no replication, high half for low, low half for high, arms swapped, lane+1, and the dispatch index used as the lane;
  • a changed sentinel;
  • 5 mutated HLSL sources.

Controls

  • The controls mode pins the exact HLSL, checks the masks -1, 0, 0xffff and 0xffff0000, and runs about 30 refusals.
  • Besides the new messages above, these refusals hit the existing Unsupported compute instruction: … for:
    • a wave64 s[8:9] mask;
    • vcc_lo or exec_lo as the mask;
    • the e32 form;
    • -v/|v|/clamp;
    • s_mov_b32 exec_lo, s8;
    • s_and_saveexec_b32 s20, s8.
  • A select result used as an address hits Unsupported store address.
  • Four deliberate translator mutants each make the controls fail.

Registration and docs

  • New CTest: compute_store_aot_lane_mask_${adapter}, registered after compute_store_aot_mimg_store_packed.
  • New docs/experiments.md subsection "Lane-pattern masks from s_bitreplicate_b64_b32", after the per-lane guards section.

Verification

Commit 6c0e5380 (main) plus this change, dev preset, Windows 11 Pro build 26300.9974, DXC 1.8.2502.11.

python -B tests/compute_lane_mask_check.py controls                                  # pass
python -B tests/compute_lane_mask_check.py draw <dxc> <offscreen_check.exe> warp     # pass
python -B tests/compute_lane_mask_check.py draw <dxc> <offscreen_check.exe> hardware # pass
ctest --preset dev --no-tests=error -R '^compute_store_aot_lane_mask_(warp|hardware)$' -V
Backend Result
WARP 10.0.26100.9818, debug layer enabled 5 dispatches, 320 words each, mismatches 0; 11 wrong references and 9 mutants caught
AMD Radeon RX 6600 (RDNA 2, 1002:73ff), driver 32.0.21045.29003, debug layer enabled 5 dispatches, 320 words each, mismatches 0, debug errors 0

These also pass with the change: the compute_store_check translator controls, draw and draw-guard-read on WARP, tests/docs_links_check.py, tests/bidi_controls_check.py, tests/form_coverage_check.py and git diff --check.

Open points

  • Groups larger than 32 threads. The measured programs may use them. Supporting them needs a declared wave size per program. That is a design decision I left open rather than guessed.
  • Lane placement on the console. That a one-wave group places local X in lane X on the console is an assumption, and the docs state it as one. It is not a measurement.
  • Mask sources. An SGPR source holding a known word is refused, so only immediates are replicated. On the consumer side, any statically known mask word is accepted.

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).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6584214657 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1582). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T14:35:44Z. --- ## Change Refs #1546. This lowers `s_bitreplicate_b64_b32` lane-pattern masks in the compute translator (`tools/compute_store_aot.py`). It also adds one minimal consumer that makes such a mask observable: a lane select through `v_cndmask_b32_e64`. **Lowering rules** - **`s_bitreplicate_b64_b32 s[d:d+1], imm`**: `D.u64[2i] = D.u64[2i+1] = S0.u32[i]`, per the RDNA 2 ISA, the same as the existing `pixel_aot` helper. With an inline or 32-bit literal source, both halves become known scalar words: the low half replicates bits 0–15 and the high half bits 16–31. - Any other source, such as an SGPR, a VGPR, a float or a value wider than 32 bits, is refused with `Unverified lane mask source`. - An odd, non-consecutive, out-of-range or pending pair is refused with `Invalid lane mask destination`. - **`v_cndmask_b32_e64 vD, a, b, sM`** (wave32 spelling): `D = mask[lane] ? b : a`. It lowers to `(((0xMASKu >> (tid.x % Xu)) & 1u) != 0u ? b : a)`, and the result is data only. - The mask must be a statically known word, either a replicated half or an immediate. Anything else is refused with `Unverified lane mask`. - Unknown `a`/`b` operands, or a destination past v255, are refused with `Unverified ALU operand`. - **Wave size**: a one-dimensional group of at most 32 threads is a single wave on both wave32 and wave64, so the lane is the local X index and only the low 32 bits of the mask are read. Larger or multi-dimensional groups would depend on a wave size the translator cannot see. They are refused with `Lane mask select requires a one-dimensional group of at most 32 threads` rather than guessed. The change adds two new `elif` branches before the `s_lshl_b32` branch. It touches no shared table or comment. **Fixture** (`tests/compute_lane_mask_check.py`, new; it imports the helpers of `tests/compute_store_check.py`, which is unchanged) - Masks: - m = bitreplicate(0x3f3f3f3f) = `0x0fff0fff` in both halves. - n = bitreplicate(0x9c3a5e17): low `0x33fc033f`, high `0xc3f00fcc`. - Per thread, one `buffer_store_dwordx4` stores four words: - `m.lo[lane] ? 0x600d : gid` - `n.lo[lane] ? gid : 0xbeef` - `n.hi[lane] ? gid : 0xffffffff` - the plain word `0xc3f00fcc` - Runs: groups of 32 (1 and 2 groups) and of 16 (1, 3 and 5 groups). The expected words come from a bit-by-bit Python model of the ISA text. The draw must also reject the following, each at its first differing word: - 6 wrong references: no replication, high half for low, low half for high, arms swapped, lane+1, and the dispatch index used as the lane; - a changed sentinel; - 5 mutated HLSL sources. **Controls** - The `controls` mode pins the exact HLSL, checks the masks -1, 0, 0xffff and 0xffff0000, and runs about 30 refusals. - Besides the new messages above, these refusals hit the existing `Unsupported compute instruction: …` for: - a wave64 `s[8:9]` mask; - `vcc_lo` or `exec_lo` as the mask; - the e32 form; - `-v`/`|v|`/`clamp`; - `s_mov_b32 exec_lo, s8`; - `s_and_saveexec_b32 s20, s8`. - A select result used as an address hits `Unsupported store address`. - Four deliberate translator mutants each make the controls fail. **Registration and docs** - New CTest: `compute_store_aot_lane_mask_${adapter}`, registered after `compute_store_aot_mimg_store_packed`. - New `docs/experiments.md` subsection "Lane-pattern masks from s_bitreplicate_b64_b32", after the per-lane guards section. ## Verification Commit `6c0e5380` (`main`) plus this change, `dev` preset, Windows 11 Pro build 26300.9974, DXC 1.8.2502.11. ```powershell python -B tests/compute_lane_mask_check.py controls # pass python -B tests/compute_lane_mask_check.py draw <dxc> <offscreen_check.exe> warp # pass python -B tests/compute_lane_mask_check.py draw <dxc> <offscreen_check.exe> hardware # pass ctest --preset dev --no-tests=error -R '^compute_store_aot_lane_mask_(warp|hardware)$' -V ``` | Backend | Result | |---|---| | WARP 10.0.26100.9818, debug layer enabled | 5 dispatches, 320 words each, mismatches 0; 11 wrong references and 9 mutants caught | | AMD Radeon RX 6600 (RDNA 2, `1002:73ff`), driver 32.0.21045.29003, debug layer enabled | 5 dispatches, 320 words each, mismatches 0, debug errors 0 | These also pass with the change: the `compute_store_check` translator controls, `draw` and `draw-guard-read` on WARP, `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `tests/form_coverage_check.py` and `git diff --check`. ## Open points - **Groups larger than 32 threads.** The measured programs may use them. Supporting them needs a declared wave size per program. That is a design decision I left open rather than guessed. - **Lane placement on the console.** That a one-wave group places local X in lane X on the console is an assumption, and the docs state it as one. It is not a measurement. - **Mask sources.** An SGPR source holding a known word is refused, so only immediates are replicated. On the consumer side, any statically known mask word is accepted. ## 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).
tedin7 commented 2026-11-24 16:03:08 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:27:27Z.

Review: COMMENTED


Reviewed at commit 285cbc6c724442601f27b6f92c96c173358c6f33.

Findings

  • tools/compute_store_aot.py:
    • s_bitreplicate_b64_b32 s[d:d+1], imm validates even alignment, high == dst + 1 <= 105, non-pending destination pair, and 32-bit integer inline/literal source, then folds both 32-bit halves into scalar.
    • v_cndmask_b32_e64 vD, src0, src1, sM enforces a 1D group of at most 32 threads (dims[1:] == (1, 1) and dims[0] <= 32) so tid.x % dims[0] matches the wave lane at either wave size, checks that sM holds a statically known 32-bit integer word, and lowers D = mask[lane] ? src1 : src0.
  • tests/compute_lane_mask_check.py and CMakeLists.txt: negative controls cover non-immediate sources, invalid/pending destinations, unknown/pending/unsupported masks, source modifiers/clamp, out-of-range VGPRs, store-address rejection, and >32 / multi-dimensional groups; D3D12 WARP dispatches verify 320 readback words across 32- and 16-thread groups along with wrong-reference and mutated-HLSL rejection.

Verification

  • Linux:
    • python3 -B tests/docs_links_check.py -> passed (16 Markdown files, 344 links).
    • python3 -B tests/bidi_controls_check.py -> passed (1253 tracked files).
    • python3 -B tests/compute_lane_mask_check.py controls -> passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): ctest --preset dev (41 direct downstream compute_*_warp tests, including compute_store_aot_lane_mask_warp) -> 41/41 passed (61.07s / 4.49s for compute_store_aot_lane_mask_warp).
    • Release /O2 (--preset release): same 41-test suite -> 41/41 passed (58.32s / 4.78s for compute_store_aot_lane_mask_warp).

No blocking issues found.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6042190952 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1582#pullrequestreview-6042190952). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:27:27Z. **Review:** COMMENTED --- Reviewed at commit `285cbc6c724442601f27b6f92c96c173358c6f33`. ### Findings - `tools/compute_store_aot.py`: - `s_bitreplicate_b64_b32 s[d:d+1], imm` validates even alignment, `high == dst + 1 <= 105`, non-pending destination pair, and 32-bit integer inline/literal source, then folds both 32-bit halves into `scalar`. - `v_cndmask_b32_e64 vD, src0, src1, sM` enforces a 1D group of at most 32 threads (`dims[1:] == (1, 1)` and `dims[0] <= 32`) so `tid.x % dims[0]` matches the wave lane at either wave size, checks that `sM` holds a statically known 32-bit integer word, and lowers `D = mask[lane] ? src1 : src0`. - `tests/compute_lane_mask_check.py` and `CMakeLists.txt`: negative controls cover non-immediate sources, invalid/pending destinations, unknown/pending/unsupported masks, source modifiers/`clamp`, out-of-range VGPRs, store-address rejection, and >32 / multi-dimensional groups; D3D12 WARP dispatches verify 320 readback words across 32- and 16-thread groups along with wrong-reference and mutated-HLSL rejection. ### Verification - Linux: - `python3 -B tests/docs_links_check.py` -> passed (16 Markdown files, 344 links). - `python3 -B tests/bidi_controls_check.py` -> passed (1253 tracked files). - `python3 -B tests/compute_lane_mask_check.py controls` -> passed. - Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP): - Debug (`--preset dev`): `ctest --preset dev` (41 direct downstream `compute_*_warp` tests, including `compute_store_aot_lane_mask_warp`) -> **41/41 passed** (`61.07s` / `4.49s` for `compute_store_aot_lane_mask_warp`). - Release `/O2` (`--preset release`): same 41-test suite -> **41/41 passed** (`58.32s` / `4.78s` for `compute_store_aot_lane_mask_warp`). No blocking issues found. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 18:02:14 +00:00
tedin7 commented 2026-11-24 18:02:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:35:07Z.

Review: COMMENTED


Audit at head_sha: 285cbc6c724442601f27b6f92c96c173358c6f33 (this follows my earlier comment on the same head and adds the semantic audit and the mutation results it lacked).

Verdict: 0 P1, 0 P2.

Scope

  • Files: CMakeLists.txt (one add_test, test only), docs/experiments.md, tests/compute_lane_mask_check.py (new), tools/compute_store_aot.py (+29). No src/, no gfx2hlsl, no .github/. git merge-tree against current main (68969ed8): no conflicts.

RDNA 2 semantics

  • s_bitreplicate_b64_b32 s[d:d+1], imm: D.u64[2i] = D.u64[2i+1] = S0.u32[i] for i in 0..31. The lowering computes sum(((src >> (bit // 2)) & 1) << bit for bit in range(64)) and stores the two halves as known words. Sign extension of a negative immediate is safe because only bits 0..31 are read. Destination must be even, high == dst + 1, at most s105, and not pending; only decimal/hex immediates in [-2^31, 2^32) are accepted, so an SGPR source or a float inline constant is refused.
  • v_cndmask_b32_e64 vD, src0, src1, sM: D = mask[lane] ? src1 : src0. It is accepted only for a one-dimensional group of at most 32 threads, where the group is one wave at wave32 and the lane is tid.x % dims[0]. The single-SGPR mask operand is wave32 syntax: llvm-mc-19 -mcpu=gfx1013 -mattr=-wavefrontsize32,+wavefrontsize64 rejects all three fixture v_cndmask_b32_e64 ..., sN lines (3 errors), so a wave64 program cannot reach this branch with the same text. The mask SGPR must hold a statically known word; source modifiers, clamp, vcc, ranges are not matched.
  • llvm-mc-19 -mcpu=gfx1030 -mattr=+wavefrontsize32 assembles s_bitreplicate_b64_b32 s[8:9], 0x3f3f3f3f (ff 3b 88 be ...), the second constant, and the three v_cndmask_b32_e64 forms (-1, literal and SGPR sources).

Verified

Limits: Linux x86-64 only. No Windows/D3D12/DXC: compute_store_aot_lane_mask_* (draw: 320 readback words, wrong references, mutated HLSL) was not run for this head.

  • python3 -B tests/compute_lane_mask_check.py controls -> exit 0. python3 -B tests/docs_links_check.py -> 16 files, 344 links OK. git diff --check HEAD^ HEAD clean.
  • Six mutations, all detected by the Linux controls (exit 1): replication index bit // 2 -> bit // 3 (exact-text AssertionError); select arms swapped (AssertionError); lane taken as tid.x without the modulo (AssertionError); group limit 32 -> 64 (Expected a rejection: Lane mask select requires a one-dimensional group of at most 32 threads); odd destination allowed (AssertionError: Unverified lane mask); negative immediate refused (ValueError: Unverified lane mask source).
  • All mutations reverted with git checkout -- .; git status --short clean.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044283154 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1582#pullrequestreview-6044283154). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:35:07Z. **Review:** COMMENTED --- Audit at `head_sha`: `285cbc6c724442601f27b6f92c96c173358c6f33` (this follows my earlier comment on the same head and adds the semantic audit and the mutation results it lacked). **Verdict: 0 P1, 0 P2.** ### Scope - Files: `CMakeLists.txt` (one `add_test`, test only), `docs/experiments.md`, `tests/compute_lane_mask_check.py` (new), `tools/compute_store_aot.py` (+29). No `src/`, no `gfx2hlsl`, no `.github/`. `git merge-tree` against current `main` (`68969ed8`): no conflicts. ### RDNA 2 semantics - `s_bitreplicate_b64_b32 s[d:d+1], imm`: `D.u64[2i] = D.u64[2i+1] = S0.u32[i]` for i in 0..31. The lowering computes `sum(((src >> (bit // 2)) & 1) << bit for bit in range(64))` and stores the two halves as known words. Sign extension of a negative immediate is safe because only bits 0..31 are read. Destination must be even, `high == dst + 1`, at most `s105`, and not pending; only decimal/hex immediates in `[-2^31, 2^32)` are accepted, so an SGPR source or a float inline constant is refused. - `v_cndmask_b32_e64 vD, src0, src1, sM`: `D = mask[lane] ? src1 : src0`. It is accepted only for a one-dimensional group of at most 32 threads, where the group is one wave at wave32 and the lane is `tid.x % dims[0]`. The single-SGPR mask operand is wave32 syntax: `llvm-mc-19 -mcpu=gfx1013 -mattr=-wavefrontsize32,+wavefrontsize64` rejects all three fixture `v_cndmask_b32_e64 ..., sN` lines (3 errors), so a wave64 program cannot reach this branch with the same text. The mask SGPR must hold a statically known word; source modifiers, `clamp`, `vcc`, ranges are not matched. - `llvm-mc-19 -mcpu=gfx1030 -mattr=+wavefrontsize32` assembles `s_bitreplicate_b64_b32 s[8:9], 0x3f3f3f3f` (`ff 3b 88 be ...`), the second constant, and the three `v_cndmask_b32_e64` forms (`-1`, literal and SGPR sources). ### Verified Limits: Linux x86-64 only. No Windows/D3D12/DXC: `compute_store_aot_lane_mask_*` (draw: 320 readback words, wrong references, mutated HLSL) was not run for this head. - `python3 -B tests/compute_lane_mask_check.py controls` -> exit 0. `python3 -B tests/docs_links_check.py` -> 16 files, 344 links OK. `git diff --check HEAD^ HEAD` clean. - **Six mutations, all detected by the Linux controls (exit 1):** replication index `bit // 2` -> `bit // 3` (exact-text `AssertionError`); select arms swapped (`AssertionError`); lane taken as `tid.x` without the modulo (`AssertionError`); group limit 32 -> 64 (`Expected a rejection: Lane mask select requires a one-dimensional group of at most 32 threads`); odd destination allowed (`AssertionError: Unverified lane mask`); negative immediate refused (`ValueError: Unverified lane mask source`). - All mutations reverted with `git checkout -- .`; `git status --short` clean. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 18:02:15 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T17:55:24Z.

Review: COMMENTED


Independent verification at head_sha: 285cbc6c724442601f27b6f92c96c173358c6f33.

Verdict: 0 P1, 0 P2.

Scope & Semantics

  • Scope: CMakeLists.txt (test-only add_test), docs/experiments.md, tests/compute_lane_mask_check.py, tools/compute_store_aot.py. Clean-room verified; no src/, gfx2hlsl, or .github/ changes.
  • RDNA2 semantics (s_bitreplicate_b64_b32 s[d:d+1], imm and v_cndmask_b32_e64 vD, src0, src1, sM):
    • s_bitreplicate_b64_b32 replicates each source bit i in 0..31 to D[2i] and D[2i+1], enforces even-aligned contiguous SGPR pair <= s105, non-pending destination, and 32-bit integer immediate source (-(1 << 31) <= val <= 0xffffffff).
    • v_cndmask_b32_e64 lowers D = mask[lane] ? src1 : src0 to (((0x{mask:08x}u >> (tid.x % {dims[0]}u)) & 1u) != 0u ? {src1} : {src0}), restricting to 1D groups of at most 32 threads (single wave where lane == local.x at either wave32 or wave64), statically known non-pending SGPR mask, and valid ALU operands.

Commands Executed

  • Linux:
    • git diff --check origin/main...HEAD — PASS
    • python3 tests/docs_links_check.py — PASS (16 Markdown files, 344 links)
    • python3 tests/bidi_controls_check.py — PASS (1253 files)
    • python3 -B tests/compute_lane_mask_check.py controls — PASS
    • llvm-mc-19 -triple=amdgcn-- -mcpu=gfx1013 -mattr=+wavefrontsize32 -show-encoding on LANE_MASK — PASS
  • Win2025 (OS build 26100, MSVC 14.44.35207, D3D12 WARP):
    • cmake --build --preset dev + ctest --preset dev (42/42 passed, including compute_store_aot_lane_mask_warp) — PASS
    • cmake --build --preset release (/O2) + ctest --preset release (42/42 passed, including compute_store_aot_lane_mask_warp) — PASS
  • Local mutation checks on tools/compute_store_aot.py (reverted via git checkout -- .):
    1. Swapped words[1] and words[0] in v_cndmask_b32_e64 ternary -> caught by compute_lane_mask_check.py controls.
    2. Changed bit // 2 to bit // 3 in s_bitreplicate_b64_b32 -> caught by compute_lane_mask_check.py controls.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044568601 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1582#pullrequestreview-6044568601). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:55:24Z. **Review:** COMMENTED --- Independent verification at `head_sha`: `285cbc6c724442601f27b6f92c96c173358c6f33`. **Verdict: 0 P1, 0 P2.** ### Scope & Semantics - Scope: `CMakeLists.txt` (test-only `add_test`), `docs/experiments.md`, `tests/compute_lane_mask_check.py`, `tools/compute_store_aot.py`. Clean-room verified; no `src/`, `gfx2hlsl`, or `.github/` changes. - RDNA2 semantics (`s_bitreplicate_b64_b32 s[d:d+1], imm` and `v_cndmask_b32_e64 vD, src0, src1, sM`): - `s_bitreplicate_b64_b32` replicates each source bit `i` in `0..31` to `D[2i]` and `D[2i+1]`, enforces even-aligned contiguous SGPR pair `<= s105`, non-pending destination, and 32-bit integer immediate source (`-(1 << 31) <= val <= 0xffffffff`). - `v_cndmask_b32_e64` lowers `D = mask[lane] ? src1 : src0` to `(((0x{mask:08x}u >> (tid.x % {dims[0]}u)) & 1u) != 0u ? {src1} : {src0})`, restricting to 1D groups of at most 32 threads (single wave where `lane == local.x` at either wave32 or wave64), statically known non-pending SGPR mask, and valid ALU operands. ### Commands Executed - Linux: - `git diff --check origin/main...HEAD` — PASS - `python3 tests/docs_links_check.py` — PASS (16 Markdown files, 344 links) - `python3 tests/bidi_controls_check.py` — PASS (1253 files) - `python3 -B tests/compute_lane_mask_check.py controls` — PASS - `llvm-mc-19 -triple=amdgcn-- -mcpu=gfx1013 -mattr=+wavefrontsize32 -show-encoding` on `LANE_MASK` — PASS - Win2025 (OS build 26100, MSVC 14.44.35207, D3D12 WARP): - `cmake --build --preset dev` + `ctest --preset dev` (42/42 passed, including `compute_store_aot_lane_mask_warp`) — PASS - `cmake --build --preset release` (`/O2`) + `ctest --preset release` (42/42 passed, including `compute_store_aot_lane_mask_warp`) — PASS - Local mutation checks on `tools/compute_store_aot.py` (reverted via `git checkout -- .`): 1. Swapped `words[1]` and `words[0]` in `v_cndmask_b32_e64` ternary -> caught by `compute_lane_mask_check.py controls`. 2. Changed `bit // 2` to `bit // 3` in `s_bitreplicate_b64_b32` -> caught by `compute_lane_mask_check.py controls`. 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!1575
No description provided.