shader: lower compute VOP1 bfrev and ffbh_i32 #1584

Merged
Asimmimx merged 3 commits from upstream-pr/1591 into main 2026-11-26 04:51:39 +00:00
Asimmimx commented 2026-11-24 14:39:47 +00:00 (Migrated from github.com)

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


Change

Refs #1546. This lowers the VOP1 forms v_bfrev_b32_e32 and v_ffbh_i32_e32 in the compute translator (tools/compute_store_aot.py).

The change adds a VOP1_ALU table after ALU and a new elif branch before the v_mad_u32_u24 row-pitch branch. The branch reads its source operand through ALU_SOURCE/alu_word and reuses the existing "Unverified ALU operand" and ALU_EXPRESSION_LIMIT checks.

Semantics

  • v_bfrev_b32 lowers to reversebits(x).

  • v_ffbh_i32 follows the RDNA 2 ISA pseudocode: D = -1, then D is the first i from 1 to 31 for which S0[31-i] differs from S0[31]. For example:

    • 0 and 0xffffffff give 0xffffffff;
    • 1 and 0xfffffffe give 31;
    • 0x40000000 and 0x80000000 give 1.

    This matches gfx2hlsl.py and pixel_aot.py.

  • The v_ffbh_i32 HLSL is firstbitlow(reversebits(x ^ asuint(asint(x) >> 31u))). It gives the same result as the gfx2hlsl expression but names x twice instead of five times, which keeps inline chains short.

Fixture

The fixture is in a new tests/compute_alu_vop1_check.py, which imports the helpers of tests/compute_store_check.py (that file is unchanged). It is READ_COMPUTE with the ALU lines replaced. With w the source word and cap = params[0].y = 0xfffffffe, each lane stores 16 bytes:

bfrev(w)
ffbh_i32(w << (w & 31))
ffbh_i32(ashr(bfrev(w), (w >> 5) & 31))
((bfrev(gid) ^ ffbh_i32(cap)) + ffbh_i32(-1)) ^ bfrev(0x12345678)
  • Over 70 lanes, the scanned words include 0, 0xffffffff and both signs.
  • They produce every result from 1 to 30 except 14 and 16. The cap gives 31.
  • The expected words come from Python bit loops written from the ISA text. I checked those loops first against hand-worked cases, for example bfrev(0x12345678) = 0x1e6a2c48.

Wrong references and templates

  • 7 wrong references must each fail at their first differing word: one word off, a lane past the bound, ffbh_u32 semantics, count minus one, LSB-first index, 32 for 0 and -1, and bfrev as a copy.
  • 7 wrong HLSL templates must each fail with "Compute readback differs".

Controls

These are refused with the existing messages:

  • _e64 (including -v3), SDWA and DPP forms, and -v1, |v1|, clamp and v[1:2];
  • v_ffbh_u32, v_ffbl_b32, v_not_b32, s_brev_b32 and s_flbit_i32;
  • unknown, descriptor, saved-exec, pending and byte-offset sources, a 33-bit literal, s106 and v256;
  • the result used as an address or as a guard operand, a dropped vmcnt wait, and a chain that grows too large.

Registration and docs

  • New CTest compute_store_aot_alu_vop1_${adapter}, registered after compute_store_aot_mubuf_subword. It sets FORM_COVERAGE_RECORD, so the dashboard counts both forms.
  • New docs/experiments.md subsection, "VOP1 bit reverse and signed leading-bit count".

Verification

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

python -B tests/compute_alu_vop1_check.py controls                                  # pass
python -B tests/compute_alu_vop1_check.py draw <dxc> <offscreen_check.exe> warp     # pass
python -B tests/compute_alu_vop1_check.py draw <dxc> <offscreen_check.exe> hardware # pass
ctest --preset dev --no-tests=error -R '^compute_store_aot_alu_vop1_(warp|hardware)$' -V
Backend Result
WARP 10.0.26100.9818, debug layer enabled 3 runs (0, 17, 70 lanes), 320 words each, mismatches 0; all 14 controls caught
AMD Radeon RX 6600 (RDNA 2, 1002:73ff), driver 32.0.21045.29003, debug layer enabled 3 runs, 320 words each, mismatches 0, debug errors 0

These also pass:

  • the compute_store_check translator controls, run through its compile-mimg-atomic-* modes;
  • draw-guard-read on WARP;
  • tests/docs_links_check.py, tests/bidi_controls_check.py, tests/form_coverage_check.py and git diff --check.

I did not run the LLVM 15 binary mode.

Notes

  • _e64 without modifiers is refused, as in the binary32 subset. Accepting it would be a separate decision.
  • The fixture text round-trips through llvm-mc 19 unchanged, apart from a blank line.

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:6584299246 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1591). Originally posted by [Asimmimx](https://github.com/Asimmimx) on 2026-11-24T14:39:47Z. --- ## Change Refs #1546. This lowers the VOP1 forms `v_bfrev_b32_e32` and `v_ffbh_i32_e32` in the compute translator (`tools/compute_store_aot.py`). The change adds a `VOP1_ALU` table after `ALU` and a new `elif` branch before the `v_mad_u32_u24` row-pitch branch. The branch reads its source operand through `ALU_SOURCE`/`alu_word` and reuses the existing "Unverified ALU operand" and `ALU_EXPRESSION_LIMIT` checks. **Semantics** - `v_bfrev_b32` lowers to `reversebits(x)`. - `v_ffbh_i32` follows the RDNA 2 ISA pseudocode: D = -1, then D is the first i from 1 to 31 for which S0[31-i] differs from S0[31]. For example: - 0 and 0xffffffff give 0xffffffff; - 1 and 0xfffffffe give 31; - 0x40000000 and 0x80000000 give 1. This matches `gfx2hlsl.py` and `pixel_aot.py`. - The `v_ffbh_i32` HLSL is `firstbitlow(reversebits(x ^ asuint(asint(x) >> 31u)))`. It gives the same result as the `gfx2hlsl` expression but names x twice instead of five times, which keeps inline chains short. **Fixture** The fixture is in a new `tests/compute_alu_vop1_check.py`, which imports the helpers of `tests/compute_store_check.py` (that file is unchanged). It is `READ_COMPUTE` with the ALU lines replaced. With w the source word and cap = `params[0].y` = 0xfffffffe, each lane stores 16 bytes: ``` bfrev(w) ffbh_i32(w << (w & 31)) ffbh_i32(ashr(bfrev(w), (w >> 5) & 31)) ((bfrev(gid) ^ ffbh_i32(cap)) + ffbh_i32(-1)) ^ bfrev(0x12345678) ``` - Over 70 lanes, the scanned words include 0, 0xffffffff and both signs. - They produce every result from 1 to 30 except 14 and 16. The cap gives 31. - The expected words come from Python bit loops written from the ISA text. I checked those loops first against hand-worked cases, for example `bfrev(0x12345678) = 0x1e6a2c48`. **Wrong references and templates** - 7 wrong references must each fail at their first differing word: one word off, a lane past the bound, ffbh_u32 semantics, count minus one, LSB-first index, 32 for 0 and -1, and bfrev as a copy. - 7 wrong HLSL templates must each fail with "Compute readback differs". **Controls** These are refused with the existing messages: - `_e64` (including `-v3`), SDWA and DPP forms, and `-v1`, `|v1|`, `clamp` and `v[1:2]`; - `v_ffbh_u32`, `v_ffbl_b32`, `v_not_b32`, `s_brev_b32` and `s_flbit_i32`; - unknown, descriptor, saved-exec, pending and byte-offset sources, a 33-bit literal, s106 and v256; - the result used as an address or as a guard operand, a dropped vmcnt wait, and a chain that grows too large. **Registration and docs** - New CTest `compute_store_aot_alu_vop1_${adapter}`, registered after `compute_store_aot_mubuf_subword`. It sets `FORM_COVERAGE_RECORD`, so the dashboard counts both forms. - New `docs/experiments.md` subsection, "VOP1 bit reverse and signed leading-bit count". ## 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_alu_vop1_check.py controls # pass python -B tests/compute_alu_vop1_check.py draw <dxc> <offscreen_check.exe> warp # pass python -B tests/compute_alu_vop1_check.py draw <dxc> <offscreen_check.exe> hardware # pass ctest --preset dev --no-tests=error -R '^compute_store_aot_alu_vop1_(warp|hardware)$' -V ``` | Backend | Result | |---|---| | WARP 10.0.26100.9818, debug layer enabled | 3 runs (0, 17, 70 lanes), 320 words each, mismatches 0; all 14 controls caught | | AMD Radeon RX 6600 (RDNA 2, `1002:73ff`), driver 32.0.21045.29003, debug layer enabled | 3 runs, 320 words each, mismatches 0, debug errors 0 | These also pass: - the `compute_store_check` translator controls, run through its `compile-mimg-atomic-*` modes; - `draw-guard-read` on WARP; - `tests/docs_links_check.py`, `tests/bidi_controls_check.py`, `tests/form_coverage_check.py` and `git diff --check`. I did not run the LLVM 15 `binary` mode. ## Notes - `_e64` without modifiers is refused, as in the binary32 subset. Accepting it would be a separate decision. - The fixture text round-trips through `llvm-mc` 19 unchanged, apart from a blank line. ## 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 15:02:13 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Reviewed dd929728 (tools/compute_store_aot.py, tests/compute_alu_vop1_check.py, CMakeLists.txt, docs/experiments.md).

Findings

  • No defects found.
  • v_bfrev_b32_e32 lowers to reversebits({0}) and v_ffbh_i32_e32 lowers to firstbitlow(reversebits({0} ^ asuint(asint({0}) >> 31u))). Folding the sign bit via arithmetic right shift clears bit 31 and sets bit 31 - i iff S0[31 - i] != S0[31], so firstbitlow(reversebits(m)) returns the RDNA 2 V_FFBH_I32 index 1..31 (or 0xffffffff when S0 is 0 or 0xffffffff), while substituting {0} only twice.
  • _e64, _sdwa, _dpp, modifiers, register ranges, neighbouring opcodes (v_ffbh_u32_e32, v_ffbl_b32_e32, v_not_b32_e32, s_brev_b32, s_flbit_i32), unverified operands, and data-only address/guard/post-exec-restore misuse are all rejected.
  • tests/compute_alu_vop1_check.py covers both wrong reference models and mutated HLSL templates on WARP.

Verification

  • Linux:
    • python3 tests/compute_alu_vop1_check.py controls: passed.
    • llvm-mc-19 -arch=amdgcn -mcpu=gfx1013 -show-encoding on the fixture's v_bfrev_b32_e32 / v_ffbh_i32_e32 forms: passed.
    • python3 tests/docs_links_check.py: passed (16 Markdown files, 344 links).
    • python3 tests/bidi_controls_check.py: passed (1253 tracked files).
  • Windows WARP (OS build 26100, MSVC 14.44.35207, Debug & Release /O2):
    • ctest --preset dev on the 41 offscreen_check / compute_*_warp tests (including compute_store_aot_alu_vop1_warp): 41/41 passed.
    • ctest --preset release on the same 41 tests: 41/41 passed (58.43s, compute_store_aot_alu_vop1_warp 4.19s).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6041702176 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1591#pullrequestreview-6041702176). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:01:31Z. **Review:** COMMENTED --- Reviewed `dd929728` (`tools/compute_store_aot.py`, `tests/compute_alu_vop1_check.py`, `CMakeLists.txt`, `docs/experiments.md`). ### Findings - No defects found. - `v_bfrev_b32_e32` lowers to `reversebits({0})` and `v_ffbh_i32_e32` lowers to `firstbitlow(reversebits({0} ^ asuint(asint({0}) >> 31u)))`. Folding the sign bit via arithmetic right shift clears bit 31 and sets bit `31 - i` iff `S0[31 - i] != S0[31]`, so `firstbitlow(reversebits(m))` returns the RDNA 2 `V_FFBH_I32` index `1..31` (or `0xffffffff` when `S0` is `0` or `0xffffffff`), while substituting `{0}` only twice. - `_e64`, `_sdwa`, `_dpp`, modifiers, register ranges, neighbouring opcodes (`v_ffbh_u32_e32`, `v_ffbl_b32_e32`, `v_not_b32_e32`, `s_brev_b32`, `s_flbit_i32`), unverified operands, and data-only address/guard/post-exec-restore misuse are all rejected. - `tests/compute_alu_vop1_check.py` covers both wrong reference models and mutated HLSL templates on WARP. ### Verification - Linux: - `python3 tests/compute_alu_vop1_check.py controls`: passed. - `llvm-mc-19 -arch=amdgcn -mcpu=gfx1013 -show-encoding` on the fixture's `v_bfrev_b32_e32` / `v_ffbh_i32_e32` forms: passed. - `python3 tests/docs_links_check.py`: passed (16 Markdown files, 344 links). - `python3 tests/bidi_controls_check.py`: passed (1253 tracked files). - Windows WARP (OS build 26100, MSVC 14.44.35207, Debug & Release `/O2`): - `ctest --preset dev` on the 41 `offscreen_check` / `compute_*_warp` tests (including `compute_store_aot_alu_vop1_warp`): 41/41 passed. - `ctest --preset release` on the same 41 tests: 41/41 passed (`58.43s`, `compute_store_aot_alu_vop1_warp` `4.19s`). AI-assisted; commands listed were executed locally.
Jess-Doit commented 2026-11-24 17:01:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Jess-Doit on 2026-11-24T16:46:14Z.

Review: COMMENTED


Hardware check on NVIDIA, which adds a data point to the RX 6600 and WARP runs above. Nothing below is a code change.

Tested: dd929728 merged onto main c864f138. docs/experiments.md conflicts with main (see the end of this review). For the build I kept this PR's version of that file; no code conflicted.

Environment:

  • Windows 10 22H2, build 19045.6456; Windows SDK 10.0.26100.0 DXC; D3D12 debug layer enabled.
  • Hardware: NVIDIA GeForce GTX 1060 6GB (10de:1c03), driver 32.0.15.6094 (Pascal).
  • WARP: in-box, 1414:008c.

Ran:

  • python -B tests/compute_alu_vop1_check.py controls: passed.
  • ctest --preset {dev,release} --no-tests=error -R '^compute_store_aot_(alu_vop1_(warp|hardware)|warp|hardware)$' -V: 4/4 in Debug and 4/4 in Release. Every dispatch read compared_words=320 mismatches=0 with debug_errors=0 debug_warnings=0, on the 1060 and on WARP.

Controls on the 1060:

  • All seven wrong references fail at the expected word (ffbh_u32 for ffbh_i32 at word 2, counting after the sign bit at word 1, and so on).
  • All seven HLSL mutations fail, including logical sign fold. So DXC emits the asint(x) >> 31u fold as an arithmetic shift on this driver too, and the negative inputs in the fixture, plus 0 and 0xffffffff, read back as the ISA model gives.

Reading of the lowering: firstbitlow(reversebits(x ^ asuint(asint(x) >> 31u))) agrees with V_FFBH_I32 for every word. After the fold, bit 31 is always clear, so the result is 1–31 for mixed words and 0xffffffff for 0 and −1. reversebits matches V_BFREV_B32. No defects found.

Merge conflict: docs/experiments.md currently conflicts with main, next to the new "VOP1 bit reverse and signed leading-bit count" section. It needs a rebase or merge before this can land.

AI-assisted (Claude Code); the commands listed were run locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6043530435 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1591#pullrequestreview-6043530435). Originally posted by [Jess-Doit](https://github.com/Jess-Doit) on 2026-11-24T16:46:14Z. **Review:** COMMENTED --- Hardware check on NVIDIA, which adds a data point to the RX 6600 and WARP runs above. Nothing below is a code change. **Tested:** `dd929728` merged onto main `c864f138`. `docs/experiments.md` conflicts with main (see the end of this review). For the build I kept this PR's version of that file; no code conflicted. **Environment:** - Windows 10 22H2, build 19045.6456; Windows SDK 10.0.26100.0 DXC; D3D12 debug layer enabled. - Hardware: NVIDIA GeForce GTX 1060 6GB (`10de:1c03`), driver 32.0.15.6094 (Pascal). - WARP: in-box, `1414:008c`. **Ran:** - `python -B tests/compute_alu_vop1_check.py controls`: passed. - `ctest --preset {dev,release} --no-tests=error -R '^compute_store_aot_(alu_vop1_(warp|hardware)|warp|hardware)$' -V`: 4/4 in Debug and 4/4 in Release. Every dispatch read `compared_words=320 mismatches=0` with `debug_errors=0 debug_warnings=0`, on the 1060 and on WARP. **Controls on the 1060:** - All seven wrong references fail at the expected word (`ffbh_u32 for ffbh_i32` at word 2, `counting after the sign bit` at word 1, and so on). - All seven HLSL mutations fail, including `logical sign fold`. So DXC emits the `asint(x) >> 31u` fold as an arithmetic shift on this driver too, and the negative inputs in the fixture, plus 0 and `0xffffffff`, read back as the ISA model gives. **Reading of the lowering:** `firstbitlow(reversebits(x ^ asuint(asint(x) >> 31u)))` agrees with V_FFBH_I32 for every word. After the fold, bit 31 is always clear, so the result is 1–31 for mixed words and `0xffffffff` for 0 and −1. `reversebits` matches V_BFREV_B32. No defects found. **Merge conflict:** `docs/experiments.md` currently conflicts with main, next to the new "VOP1 bit reverse and signed leading-bit count" section. It needs a rebase or merge before this can land. AI-assisted (Claude Code); the commands listed were run locally.
tedin7 commented 2026-11-24 18:02:17 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Re-review at head_sha: 6d5586490575dd64259647f557946eb388fcf8f9 (previously reviewed at dd929728).

Findings

No P1/P2. No defect found.

  • The new head is a rebase onto a newer main. git range-diff and a diff of the added/removed lines of the two patches show the PR's own content is unchanged; only context lines differ.
  • git merge-tree against current main (bc65bb1b) reports no conflicts (tree 32a58dc1).
  • Semantics re-checked independently of the PR's model: I evaluated firstbitlow(reversebits(x ^ (x >>s 31))) against a direct "first bit that differs from the sign bit, counted from the MSB" over 75 words (0, 0xffffffff, 0x80000000, 0x7fffffff, every single-bit word and its complement, and a few mixed patterns). 0 mismatches, including the 0xffffffff result for 0 and 0xffffffff.

Verified

Limits: Linux x86-64 only. I did not rerun the Windows WARP/hardware ctest for this head, so draw mode rests on the unchanged patch and the earlier Windows results on the previous head.

  • python3 -B tests/compute_alu_vop1_check.py controls -> exit 0.
  • llvm-mc-19 -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding: v_bfrev_b32_e32 v1, v2 -> 02 71 02 7e; v_ffbh_i32_e32 v1, v2 -> 02 77 02 7e; the literal and SGPR forms assemble too.
  • python3 -B tests/docs_links_check.py -> 16 files, 351 links OK. git diff --check HEAD^ HEAD clean.
  • Mutation: changed the arithmetic shift asint({0}) >> 31u to >> 30u in the v_ffbh_i32_e32 template; controls fails with an AssertionError on the exact-text check (exit 1). Restored with git checkout -- .; git status --short clean.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044027584 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1591#pullrequestreview-6044027584). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:18:11Z. **Review:** COMMENTED --- Re-review at `head_sha`: `6d5586490575dd64259647f557946eb388fcf8f9` (previously reviewed at `dd929728`). ### Findings No P1/P2. No defect found. - The new head is a rebase onto a newer `main`. `git range-diff` and a diff of the added/removed lines of the two patches show the PR's own content is unchanged; only context lines differ. - `git merge-tree` against current `main` (`bc65bb1b`) reports no conflicts (tree `32a58dc1`). - Semantics re-checked independently of the PR's model: I evaluated `firstbitlow(reversebits(x ^ (x >>s 31)))` against a direct "first bit that differs from the sign bit, counted from the MSB" over 75 words (0, 0xffffffff, 0x80000000, 0x7fffffff, every single-bit word and its complement, and a few mixed patterns). 0 mismatches, including the `0xffffffff` result for `0` and `0xffffffff`. ### Verified Limits: Linux x86-64 only. I did not rerun the Windows WARP/hardware `ctest` for this head, so `draw` mode rests on the unchanged patch and the earlier Windows results on the previous head. - `python3 -B tests/compute_alu_vop1_check.py controls` -> exit 0. - `llvm-mc-19 -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding`: `v_bfrev_b32_e32 v1, v2` -> `02 71 02 7e`; `v_ffbh_i32_e32 v1, v2` -> `02 77 02 7e`; the literal and SGPR forms assemble too. - `python3 -B tests/docs_links_check.py` -> 16 files, 351 links OK. `git diff --check HEAD^ HEAD` clean. - **Mutation:** changed the arithmetic shift `asint({0}) >> 31u` to `>> 30u` in the `v_ffbh_i32_e32` template; `controls` fails with an `AssertionError` on the exact-text check (exit 1). Restored with `git checkout -- .`; `git status --short` clean. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 18:02:17 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Verified at head_sha: 6d5586490575dd64259647f557946eb388fcf8f9 (0 P1, 0 P2).

Scope & Semantics

  • Touches only tools/compute_store_aot.py, tests/compute_alu_vop1_check.py, CMakeLists.txt (test-only compute_store_aot_alu_vop1_{hardware,warp}), and docs/experiments.md.
  • v_bfrev_b32_e32 (reversebits(a)) and v_ffbh_i32_e32 (firstbitlow(reversebits(a ^ asuint(asint(a) >> 31u)))) match the AMD RDNA 2 ISA definitions (VOP1 opcodes 56 and 59, returning 0xffffffff for 0 and -1, and 1..31 for the first bit differing from bit 31); _e64, SDWA, DPP, modifiers, register ranges, and unknown/pending/descriptor operands are refused.

Verified

  • Linux:
    • git diff --check origin/main...HEAD -> clean
    • python3 tests/docs_links_check.py -> passed (16 Markdown files, 351 links)
    • python3 tests/bidi_controls_check.py -> passed (1280 tracked files)
    • python3 tests/compute_alu_vop1_check.py controls -> passed
    • llvm-mc-19 -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding: v_bfrev_b32_e32 v1, v2 (02 71 02 7e), v_ffbh_i32_e32 v3, v4 (04 77 06 7e)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev): offscreen_check built (10.49s), ctest --preset dev -R 'compute_store_aot_alu_vop1' 2/2 passed (4.51s: compute_store_aot_alu_vop1_hardware, compute_store_aot_alu_vop1_warp)
    • Release /O2 (--preset release): offscreen_check built (8.13s), ctest --preset release -R 'compute_store_aot_alu_vop1' 2/2 passed (4.48s)
  • Mutation checks (local, reverted cleanly):
    • Replaced v_bfrev_b32_e32 template with identity ({0}) in tools/compute_store_aot.py -> compute_alu_vop1_check.py controls failed as expected.
    • Dropped arithmetic sign fold from v_ffbh_i32_e32 template in tools/compute_store_aot.py -> compute_alu_vop1_check.py controls failed as expected.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6044371588 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1591#pullrequestreview-6044371588). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T17:41:28Z. **Review:** COMMENTED --- Verified at `head_sha`: `6d5586490575dd64259647f557946eb388fcf8f9` (0 P1, 0 P2). ### Scope & Semantics - Touches only `tools/compute_store_aot.py`, `tests/compute_alu_vop1_check.py`, `CMakeLists.txt` (test-only `compute_store_aot_alu_vop1_{hardware,warp}`), and `docs/experiments.md`. - `v_bfrev_b32_e32` (`reversebits(a)`) and `v_ffbh_i32_e32` (`firstbitlow(reversebits(a ^ asuint(asint(a) >> 31u)))`) match the AMD RDNA 2 ISA definitions (VOP1 opcodes 56 and 59, returning `0xffffffff` for `0` and `-1`, and `1..31` for the first bit differing from bit 31); `_e64`, SDWA, DPP, modifiers, register ranges, and unknown/pending/descriptor operands are refused. ### Verified - **Linux**: - `git diff --check origin/main...HEAD` -> clean - `python3 tests/docs_links_check.py` -> passed (16 Markdown files, 351 links) - `python3 tests/bidi_controls_check.py` -> passed (1280 tracked files) - `python3 tests/compute_alu_vop1_check.py controls` -> passed - `llvm-mc-19 -triple=amdgcn-amd-amdhsa -mcpu=gfx1013 -show-encoding`: `v_bfrev_b32_e32 v1, v2` (`02 71 02 7e`), `v_ffbh_i32_e32 v3, v4` (`04 77 06 7e`) - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - **Debug (`--preset dev`)**: `offscreen_check` built (`10.49s`), `ctest --preset dev -R 'compute_store_aot_alu_vop1'` **2/2 passed** (`4.51s`: `compute_store_aot_alu_vop1_hardware`, `compute_store_aot_alu_vop1_warp`) - **Release `/O2` (`--preset release`)**: `offscreen_check` built (`8.13s`), `ctest --preset release -R 'compute_store_aot_alu_vop1'` **2/2 passed** (`4.48s`) - **Mutation checks** (local, reverted cleanly): - Replaced `v_bfrev_b32_e32` template with identity `({0})` in `tools/compute_store_aot.py` -> `compute_alu_vop1_check.py controls` failed as expected. - Dropped arithmetic sign fold from `v_ffbh_i32_e32` template in `tools/compute_store_aot.py` -> `compute_alu_vop1_check.py controls` failed as expected. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-24 19:01:41 +00:00 (Migrated from github.com)

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


This PR currently has merge conflicts with main. Could you please rebase it onto the latest main so it can be checked for merge?

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7140848468 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1591#issuecomment-7140848468). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T18:35:03Z. --- This PR currently has merge conflicts with `main`. Could you please rebase it onto the latest `main` so it can be checked for merge? AI-assisted.
tedin7 commented 2026-11-26 03:03:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T02:58:07Z.


Pushed 1614dc918: merged current main into this branch (no rebase, no force) so it no longer conflicts.

Conflicts resolved, keeping both sides: tools/compute_store_aot.py (the new VOP1 bfrev/ffbh_i32 branch sits next to main's new borrow/carry branches in the same elif chain) and docs/experiments.md. CMakeLists.txt merged cleanly.

Verification:

  • Linux: python3 tests/compute_alu_vop1_check.py controls and the sibling compute_alu_*_check.py controls (bcnt, med3, xor3, mad_i24): pass.
  • Win2025 (dev): x2w_pipe.py win2025 1591 --patch <merge diff> --regex 'compute_alu_(vop1|bcnt|med3|xor3|mad_i24|minmax3|cmp_ne|cvt_pk_u8|lane_gaps)|compute_store': 212/213 pass. compute_store_aot_mac_f32_hardware fails the same way on a tree without this PR (Basic Render Driver, "fused mad() escaped detection"); its warp variant passes, and this PR does not touch that test or the v_mac_f32 lowering.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181277197 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1591#issuecomment-7181277197). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T02:58:07Z. --- Pushed 1614dc918: merged current `main` into this branch (no rebase, no force) so it no longer conflicts. Conflicts resolved, keeping both sides: `tools/compute_store_aot.py` (the new VOP1 `bfrev`/`ffbh_i32` branch sits next to main's new borrow/carry branches in the same `elif` chain) and `docs/experiments.md`. `CMakeLists.txt` merged cleanly. Verification: - Linux: `python3 tests/compute_alu_vop1_check.py controls` and the sibling `compute_alu_*_check.py controls` (bcnt, med3, xor3, mad_i24): pass. - Win2025 (dev): `x2w_pipe.py win2025 1591 --patch <merge diff> --regex 'compute_alu_(vop1|bcnt|med3|xor3|mad_i24|minmax3|cmp_ne|cvt_pk_u8|lane_gaps)|compute_store'`: 212/213 pass. `compute_store_aot_mac_f32_hardware` fails the same way on a tree without this PR (Basic Render Driver, "fused mad() escaped detection"); its warp variant passes, and this PR does not touch that test or the `v_mac_f32` lowering. AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-26 05:02:06 +00:00
R0Y00 commented 2026-11-26 05:02:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-26T04:51:26Z.

Review: APPROVED


The current branch includes the mainline fix for duplicate Pass fields that broke the older Windows build. Its diff against main is the VOP1 code and fixture only. Release offscreen readbacks for v_bfrev_b32 and v_ffbh_i32 matched on WARP and RTX 4060 Laptop, and the guards and wrong-model mutations failed as intended. The Python translation controls passed as well.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6068716827 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1591#pullrequestreview-6068716827). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T04:51:26Z. **Review:** APPROVED --- The current branch includes the mainline fix for duplicate Pass fields that broke the older Windows build. Its diff against main is the VOP1 code and fixture only. Release offscreen readbacks for v_bfrev_b32 and v_ffbh_i32 matched on WARP and RTX 4060 Laptop, and the guards and wrong-model mutations failed as intended. The Python translation controls passed as well.
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!1584
No description provided.