startup: lower s_bfm_b64 in gfx2hlsl #2000

Merged
JB2WIN merged 5 commits from upstream-pr/2007 into main 2026-11-26 04:48:34 +00:00
JB2WIN commented 2026-11-24 22:58:27 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-24T22:58:27Z.


Refs #1723

Change

tools/startup/gfx2hlsl.py now lowers s_bfm_b64. It is one of the refusals in the #1723 census (1 pair).

  • Semantics. The AMD RDNA 2 ISA (30 November 2020, SOP2 opcode 37) gives D.u64 = ((1ULL << S0.u[5:0]) - 1) << S1.u[5:0]. The entry lists no SCC write; the bit operations next to it do list one. The existing s_bfm_b32 entry and the pixel_aot reference also leave SCC unchanged, so the handler emits no scc.
  • Representation. The lane-mask 64-bit ops (s_and_b64 and the others) keep only a lane bit and a zero high word. s_bfm_b64 produces a real 64-bit value, so the new Stage.op_s_bfm_b64 writes both words s[d] and s[d+1]. It uses the preamble's shl64 helper, as v_lshlrev_b64 does.
  • Masking. The width is masked to six bits, and shl64 masks the offset and cuts at bit 63. A width of 32 or more gives the low word 0xffffffff and the high word (1u << (w & 31u)) - 1u. A width of 0 gives 0. No emitted shift count is 32 or more.
  • Constants. Constant sources are folded in Python.
  • Refused: modifiers, a wrong operand count, a destination that is not an even SGPR pair, pair, vector, exec/vcc or descriptor sources.

Test

New device-free check tests/startup_gfx2hlsl_bfm_b64_check.py, registered as startup_gfx2hlsl_bfm_b64 and listed in the pure-Python job and AGENTS.md.

  • Evaluation: a small evaluator runs the emitted HLSL together with the real shl64 from the preamble and compares the result with an independent bit-loop reference.
  • Coverage: all 64 × 64 width/offset pairs, hand-computed anchors, source bits above [5:0] that must be ignored, inline and literal sources, constant folding and destination equal to source. The check also asserts that no shift count reaches 32.
  • Rejections: refusal controls with a positive control, and an encoder/decoder round trip.
  • Mutations: each of these mutations fails the check: an unmasked width, & 31 instead of & 63, a 5-bit offset, and width 0 giving all ones.
  • Against main: with main's gfx2hlsl.py the check fails with Unsupported: s_bfm_b64.

Results on 1ebfe511 plus this commit:

  • ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl' passed 41/41.
  • tests/startup_translator_check.py and tests/docs_links_check.py pass.

The check evaluates the emitted HLSL in Python. It does not compile it or draw with it.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6593104066 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-24T22:58:27Z. --- Refs #1723 ## Change `tools/startup/gfx2hlsl.py` now lowers `s_bfm_b64`. It is one of the refusals in the #1723 census (1 pair). - **Semantics.** The AMD RDNA 2 ISA (30 November 2020, SOP2 opcode 37) gives `D.u64 = ((1ULL << S0.u[5:0]) - 1) << S1.u[5:0]`. The entry lists no SCC write; the bit operations next to it do list one. The existing `s_bfm_b32` entry and the `pixel_aot` reference also leave SCC unchanged, so the handler emits no `scc`. - **Representation.** The lane-mask 64-bit ops (`s_and_b64` and the others) keep only a lane bit and a zero high word. `s_bfm_b64` produces a real 64-bit value, so the new `Stage.op_s_bfm_b64` writes both words `s[d]` and `s[d+1]`. It uses the preamble's `shl64` helper, as `v_lshlrev_b64` does. - **Masking.** The width is masked to six bits, and `shl64` masks the offset and cuts at bit 63. A width of 32 or more gives the low word `0xffffffff` and the high word `(1u << (w & 31u)) - 1u`. A width of 0 gives 0. No emitted shift count is 32 or more. - **Constants.** Constant sources are folded in Python. - **Refused:** modifiers, a wrong operand count, a destination that is not an even SGPR pair, pair, vector, `exec`/`vcc` or descriptor sources. ## Test New device-free check `tests/startup_gfx2hlsl_bfm_b64_check.py`, registered as `startup_gfx2hlsl_bfm_b64` and listed in the pure-Python job and `AGENTS.md`. - **Evaluation:** a small evaluator runs the emitted HLSL together with the real `shl64` from the preamble and compares the result with an independent bit-loop reference. - **Coverage:** all 64 × 64 width/offset pairs, hand-computed anchors, source bits above `[5:0]` that must be ignored, inline and literal sources, constant folding and destination equal to source. The check also asserts that no shift count reaches 32. - **Rejections:** refusal controls with a positive control, and an encoder/decoder round trip. - **Mutations:** each of these mutations fails the check: an unmasked width, `& 31` instead of `& 63`, a 5-bit offset, and width 0 giving all ones. - **Against `main`:** with `main`'s `gfx2hlsl.py` the check fails with `Unsupported: s_bfm_b64`. Results on `1ebfe511` plus this commit: - `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl'` passed 41/41. - `tests/startup_translator_check.py` and `tests/docs_links_check.py` pass. The check evaluates the emitted HLSL in Python. It does not compile it or draw with it. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ChazY11 commented 2026-11-25 01:01:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:08:44Z.


Ran it, broke it five ways — all caught — and checked the emitted formula against the ISA expression

Windows 11 build 26300.9974, device-free:

out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_bfm_b64_check.py
mutation "offset masked to five bits" changes the text and reads a wrong word [(1, 32)]: ok
mutation "width 0 reads all ones" changes the text and reads a wrong word [(0, 0)]: ok
PASS      exit 0
mutation result
bw >= 32u → bw > 32u (the exactly-32 boundary) caught
the mask's (1u << (bw & 31u)) → (bw & 63u) (a shift count of 32 or more) caught
s[d] = t.x; s[d+1] = t.y written the other way round caught
uint bw = width & 63u → no mask (a width above 63) caught
the offset handed to shl64 pre-masked in a different way caught

Your two controls and the first two of my mutations fail in the same place — the width boundary at 32 and the six-bit masking — which is a good sign that the check knows what can go wrong rather than merely comparing text.

The arithmetic, checked exhaustively

I reimplemented the emitted expression (mask split into two words, shl64 masking the offset to six bits) and compared it with ((1ULL << S0.u[5:0]) - 1) << S1.u[5:0] over every (width, offset) pair:

pairs checked: 4096  mismatches: 0

and that a width outside the six-bit field behaves exactly like its masked value, as the ISA says it must:

width=64 / 65 / 127 / 255 masked to 6 bits behaves identically: True (for every offset)

So the two-word split at bw >= 32u, the (1u << (bw & 31u)) - 1u high word, and the 0 high word below 32 all hold together.

Two details worth keeping in the description

  • dst[1] % 2 and dst[2] > 105 are the right refusals, not merely "is it an SGPR pair": a 64-bit scalar destination must be even-aligned in the file, and 105 is the last usable high word. A reviewer who had not read your diff would expect alignment to be enforced by reg_range and would be wrong.
  • self.sym.pop(d) before emitting, with the comment that a source may be the destination, is the subtle half. s_bfm_b64 s0, s0, s1 reads s0 and writes s0/s1 through locals, so the emitted block is correct only because both words are computed before either store. That sentence is doing real work.

What I could not check

SCC being unchanged is argued from the ISA PDF entry, the neighbouring s_bfm_b32 entry and pixel_aot. I do not have the PDF, so I can only say the reasoning is consistent with the code — the handler emits no scc write, and my mutations did not disturb that.

Scope

Text and arithmetic; no shader was compiled or run. Constant folding is covered by your fixture, not by my probes.

Verdict

Reviewed. Five independent breakages, five failures, and the formula agrees with the ISA expression on all 4,096 inputs.

Notes

  • AI-assisted review.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147065252 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7147065252). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T23:08:44Z. --- ## Ran it, broke it five ways — all caught — and checked the emitted formula against the ISA expression Windows 11 build 26300.9974, device-free: ```powershell out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_bfm_b64_check.py mutation "offset masked to five bits" changes the text and reads a wrong word [(1, 32)]: ok mutation "width 0 reads all ones" changes the text and reads a wrong word [(0, 0)]: ok PASS exit 0 ``` | mutation | result | |---|---| | `bw >= 32u` → `bw > 32u` (the exactly-32 boundary) | **caught** | | the mask's `(1u << (bw & 31u))` → `(bw & 63u)` (a shift count of 32 or more) | **caught** | | `s[d] = t.x; s[d+1] = t.y` written the other way round | **caught** | | `uint bw = width & 63u` → no mask (a width above 63) | **caught** | | the offset handed to `shl64` pre-masked in a different way | **caught** | Your two controls and the first two of my mutations fail in the same place — the width boundary at 32 and the six-bit masking — which is a good sign that the check knows what can go wrong rather than merely comparing text. ## The arithmetic, checked exhaustively I reimplemented the emitted expression (mask split into two words, `shl64` masking the offset to six bits) and compared it with `((1ULL << S0.u[5:0]) - 1) << S1.u[5:0]` over **every** `(width, offset)` pair: ```text pairs checked: 4096 mismatches: 0 ``` and that a width outside the six-bit field behaves exactly like its masked value, as the ISA says it must: ```text width=64 / 65 / 127 / 255 masked to 6 bits behaves identically: True (for every offset) ``` So the two-word split at `bw >= 32u`, the `(1u << (bw & 31u)) - 1u` high word, and the `0` high word below 32 all hold together. ## Two details worth keeping in the description - **`dst[1] % 2` and `dst[2] > 105`** are the right refusals, not merely "is it an SGPR pair": a 64-bit scalar destination must be even-aligned in the file, and 105 is the last usable high word. A reviewer who had not read your diff would expect alignment to be enforced by `reg_range` and would be wrong. - **`self.sym.pop(d)` before emitting**, with the comment that a source may be the destination, is the subtle half. `s_bfm_b64 s0, s0, s1` reads `s0` and writes `s0`/`s1` through locals, so the emitted block is correct only because both words are computed before either store. That sentence is doing real work. ## What I could not check SCC being unchanged is argued from the ISA PDF entry, the neighbouring `s_bfm_b32` entry and `pixel_aot`. I do not have the PDF, so I can only say the reasoning is consistent with the code — the handler emits no `scc` write, and my mutations did not disturb that. ## Scope Text and arithmetic; no shader was compiled or run. Constant folding is covered by your fixture, not by my probes. ## Verdict Reviewed. Five independent breakages, five failures, and the formula agrees with the ISA expression on all 4,096 inputs. ## Notes - AI-assisted review.
ChazY11 commented 2026-11-25 01:01:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T23:12:43Z.


Two open PRs lower s_bfm_b64 — #2003 and #2007 — and they conflict on three files

Not a problem with your patch; a coordination note so the effort is not spent twice. Checked against main 7f149ac9:

#2003  contains op_s_bfm_b64: True   merge-base 36a9a06f, 22 commits behind
#2007  contains op_s_bfm_b64: True   merge-base 1ebfe511, 27 commits behind

git checkout -B bfm-both origin/main
git merge pr-2003 && git merge pr-2007
    UU AGENTS.md
    AA tests/startup_gfx2hlsl_bfm_b64_check.py
    UU tools/startup/gfx2hlsl.py

Both add a fixture with the same filename, so whichever lands second has to be rewritten rather than rebased.

Where the two implementations differ

The semantics agree (D.u64 = ((1ULL << S0[5:0]) - 1) << S1[5:0], SCC untouched, both words written). The differences are in what is refused:

#2003 #2007
modifiers and operand count one combined message two messages
destination alignment dst[2] != dst[1] + 1 and dst[2] > 105 adds dst[1] % 2
source register form accepts anything reg_range maps to s refuses exec/vcc and any range r[1] != r[2]

Two of those matter:

  • dst[1] % 2 — a 64-bit scalar destination must be even-aligned in the register file. #2007 enforces it; #2003 does not, so s_bfm_b64 s[3:4], … would be accepted. That is the one substantive difference I would not want to lose.
  • exec/vcc as sources — #2007 refuses them by name, #2003 accepts them through the generic s path. Whether that is right depends on whether the ISA allows a 64-bit pair spelling here; worth agreeing on rather than leaving to merge order.

What I would suggest

Keep #2007's dst[1] % 2 and its explicit source refusal, and take #2003's split modifier/operand messages if you prefer them — then close the other, since neither check can be reused as is.

I have already reviewed #2007 at the behaviour level (five mutations, all caught, plus an exhaustive check of the emitted expression against the ISA formula over all 4,096 (width, offset) pairs). I have not reviewed #2003.

The same duplication exists for v_swap_b32 (#1995 and #2012), so this looks like a pattern worth a one-line note in CONTRIBUTING.md — "check open PRs for the mnemonic before starting" — rather than something either author did wrong.

Notes

  • AI-assisted coordination note.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147142129 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7147142129). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T23:12:43Z. --- ## Two open PRs lower `s_bfm_b64` — #2003 and #2007 — and they conflict on three files Not a problem with your patch; a coordination note so the effort is not spent twice. Checked against `main` `7f149ac9`: ```text #2003 contains op_s_bfm_b64: True merge-base 36a9a06f, 22 commits behind #2007 contains op_s_bfm_b64: True merge-base 1ebfe511, 27 commits behind git checkout -B bfm-both origin/main git merge pr-2003 && git merge pr-2007 UU AGENTS.md AA tests/startup_gfx2hlsl_bfm_b64_check.py UU tools/startup/gfx2hlsl.py ``` Both add a fixture with the **same filename**, so whichever lands second has to be rewritten rather than rebased. ## Where the two implementations differ The semantics agree (`D.u64 = ((1ULL << S0[5:0]) - 1) << S1[5:0]`, SCC untouched, both words written). The differences are in what is *refused*: | | #2003 | #2007 | |---|---|---| | modifiers and operand count | one combined message | two messages | | destination alignment | `dst[2] != dst[1] + 1` and `dst[2] > 105` | adds **`dst[1] % 2`** | | source register form | accepts anything `reg_range` maps to `s` | refuses `exec`/`vcc` and any range `r[1] != r[2]` | Two of those matter: - **`dst[1] % 2`** — a 64-bit scalar destination must be even-aligned in the register file. #2007 enforces it; #2003 does not, so `s_bfm_b64 s[3:4], …` would be accepted. That is the one substantive difference I would not want to lose. - **`exec`/`vcc` as sources** — #2007 refuses them by name, #2003 accepts them through the generic `s` path. Whether that is right depends on whether the ISA allows a 64-bit pair spelling here; worth agreeing on rather than leaving to merge order. ## What I would suggest Keep #2007's `dst[1] % 2` and its explicit source refusal, and take #2003's split modifier/operand messages if you prefer them — then close the other, since neither check can be reused as is. I have already reviewed #2007 at the behaviour level (five mutations, all caught, plus an exhaustive check of the emitted expression against the ISA formula over all 4,096 `(width, offset)` pairs). I have not reviewed #2003. The same duplication exists for `v_swap_b32` (#1995 and #2012), so this looks like a pattern worth a one-line note in `CONTRIBUTING.md` — "check open PRs for the mnemonic before starting" — rather than something either author did wrong. ## Notes - AI-assisted coordination note.
R0Y00 commented 2026-11-25 01:01:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T23:31:15Z.


Please prefer this single implementation and coordinate the overlap with #2003. Before overwriting either destination word, reject a source SGPR tracked in Stage.masks. The current code drops the destination’s mask flag before reading its numeric sources, so aliases can bypass even a later check. Add a compare-derived scalar mask, with and without destination aliasing, as a refusal control. After rebasing on #1931, also prove or invalidate the uniformity of both written words and check that readfirstlane cannot consume a stale proof.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147492219 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7147492219). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T23:31:15Z. --- Please prefer this single implementation and coordinate the overlap with #2003. Before overwriting either destination word, reject a source SGPR tracked in Stage.masks. The current code drops the destination’s mask flag before reading its numeric sources, so aliases can bypass even a later check. Add a compare-derived scalar mask, with and without destination aliasing, as a refusal control. After rebasing on #1931, also prove or invalidate the uniformity of both written words and check that readfirstlane cannot consume a stale proof.
JB2WIN commented 2026-11-25 01:02:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-25T00:11:40Z.


Rebased on b12df353, which includes #1931, and pushed as 9d0eb2c4:

  • Mask sources: op_s_bfm_b64 now reads both sources and checks them against Stage.masks before it touches the destination. A mask source raises Unsupported before any mask flag, sym, varying_s, used_s or HLSL changes. The self.u() expressions are also computed before any write.
  • Uniformity: both sources are judged with uniform_source() before the write, so aliasing sees the old value. Both written words are proven uniform together (their varying_s entries cleared) when both sources are uniform; otherwise both are marked varying. Before, the runtime path left a stale proof in place. Constant folding still goes through set_s.
  • New controls:
    • Five refusals with a v_cmp-derived mask as width, offset or both, with and without destination aliasing. Each one also asserts that HLSL, sym, masks, varying_s and used_s are unchanged.
    • Accepting non-mask controls.
    • The positive v_readfirstlane_b32 case for both words.
    • Three stale-proof cases. A proof is shown to exist, the word is overwritten from a varying source (including an aliased SGPR holding a saved exec), and v_readfirstlane_b32 must refuse. A later uniform write restores the proof.
  • Mutations:
    • Checking the mask after clearing the destination flag fails the three aliasing cases.
    • Not clearing the proof for s[d+1] fails the three stale-proof cases.
  • Results: all tests/startup_gfx2hlsl_*_check.py, startup_translator_check.py and docs_links_check.py pass, and ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl' passes 46/46.

The overlap with #2003 is in the thread there.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7148249098 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7148249098). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-25T00:11:40Z. --- Rebased on `b12df353`, which includes #1931, and pushed as `9d0eb2c4`: - **Mask sources:** `op_s_bfm_b64` now reads both sources and checks them against `Stage.masks` before it touches the destination. A mask source raises `Unsupported` before any mask flag, `sym`, `varying_s`, `used_s` or HLSL changes. The `self.u()` expressions are also computed before any write. - **Uniformity:** both sources are judged with `uniform_source()` before the write, so aliasing sees the old value. Both written words are proven uniform together (their `varying_s` entries cleared) when both sources are uniform; otherwise both are marked varying. Before, the runtime path left a stale proof in place. Constant folding still goes through `set_s`. - **New controls:** - Five refusals with a `v_cmp`-derived mask as width, offset or both, with and without destination aliasing. Each one also asserts that HLSL, `sym`, `masks`, `varying_s` and `used_s` are unchanged. - Accepting non-mask controls. - The positive `v_readfirstlane_b32` case for both words. - Three stale-proof cases. A proof is shown to exist, the word is overwritten from a varying source (including an aliased SGPR holding a saved `exec`), and `v_readfirstlane_b32` must refuse. A later uniform write restores the proof. - **Mutations:** - Checking the mask after clearing the destination flag fails the three aliasing cases. - Not clearing the proof for `s[d+1]` fails the three stale-proof cases. - **Results:** all `tests/startup_gfx2hlsl_*_check.py`, `startup_translator_check.py` and `docs_links_check.py` pass, and `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl'` passes 46/46. The overlap with #2003 is in the thread there. AI-assisted (Claude Code).
tedin7 commented 2026-11-25 03:00:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:01:44Z.

Review: COMMENTED


Review of head 9d0eb2c41bafb99201e0a7bc9d824126b7fea5f3 (comment only, no approval).

Verdict: no blockers found. One P2 and one nit.

Checked

  • Semantics: D.u64 = ((1<<S0[5:0]) - 1) << S1[5:0], no SCC write. This matches the s_bfm_b32 handler next to it. Width >= 32 gives low word 0xffffffff and high word (1u << (w & 31)) - 1. No emitted shift count is 32 or more. Width 63 gives 0x7fffffff in the high word, which is correct. Width 64 masks to 0, which gives 0.
  • Refusals are all taken before any state is written: modifiers, operand count, odd or non-SGPR destination, exec/vcc sources, and lane-mask sources. A source that aliases the destination is handled, because uniformity is judged first and the result comes from locals.
  • Constant fold in in op_s_bfm_b64 matches the run-time path.
  • Wiring: the test is added to CMake (startup_gfx2hlsl_bfm_b64), windows.yml and AGENTS.md. Title is neutral and the diff is clean-room.
  • CI: Linux Python, gfx1013 fixtures and Windows build/test all pass. The Windows /O2 job is skipped.

Commands run locally on the PR head

  • python3 tests/startup_gfx2hlsl_bfm_b64_check.py: PASS
  • python3 tests/docs_links_check.py: 18 files, 393 links OK
  • python3 tests/bidi_controls_check.py: OK
  • git diff --check origin/main...HEAD: clean

Mutations of the new logic (each reverted with git checkout -- .)

  • High-word mask 0xffffffffu changed to 0xfffffffeu: the test fails (killed).
  • bw = width & 63u changed to & 31u: the test fails (killed).
  • Removing self.masks.discard(d + 1): the test still passes (survived).

Findings

  • P2: The new check runs the emitted HLSL through a Python evaluator. It has no D3D12 WARP GPU readback against a CPU reference. For a gfx2hlsl math lowering, the HLSL compiler's own treatment of shl64, bw >= 32u ? ... : ... and uint2 is only covered indirectly. Please add a WARP readback on a Win2025 host (for example widths 0, 1, 31, 32, 33, 63 and offsets 0, 1, 31, 32, 63) and put the result in the PR body. I did not run Windows here. The Windows CI job only builds and runs the existing tests.
  • Nit: the survived mutation shows no test depends on self.masks.discard(d + 1). Add a case where s[d+1] was a lane mask before the write and is read as a number after it.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050509720 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#pullrequestreview-6050509720). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:01:44Z. **Review:** COMMENTED --- Review of head `9d0eb2c41bafb99201e0a7bc9d824126b7fea5f3` (comment only, no approval). **Verdict:** no blockers found. One P2 and one nit. **Checked** - Semantics: `D.u64 = ((1<<S0[5:0]) - 1) << S1[5:0]`, no SCC write. This matches the `s_bfm_b32` handler next to it. Width >= 32 gives low word `0xffffffff` and high word `(1u << (w & 31)) - 1`. No emitted shift count is 32 or more. Width 63 gives `0x7fffffff` in the high word, which is correct. Width 64 masks to 0, which gives 0. - Refusals are all taken before any state is written: modifiers, operand count, odd or non-SGPR destination, exec/vcc sources, and lane-mask sources. A source that aliases the destination is handled, because uniformity is judged first and the result comes from locals. - Constant fold in in `op_s_bfm_b64` matches the run-time path. - Wiring: the test is added to CMake (`startup_gfx2hlsl_bfm_b64`), `windows.yml` and `AGENTS.md`. Title is neutral and the diff is clean-room. - CI: Linux Python, gfx1013 fixtures and Windows build/test all pass. The Windows /O2 job is skipped. **Commands run locally on the PR head** - `python3 tests/startup_gfx2hlsl_bfm_b64_check.py`: PASS - `python3 tests/docs_links_check.py`: 18 files, 393 links OK - `python3 tests/bidi_controls_check.py`: OK - `git diff --check origin/main...HEAD`: clean **Mutations of the new logic** (each reverted with `git checkout -- .`) - High-word mask `0xffffffffu` changed to `0xfffffffeu`: the test fails (killed). - `bw = width & 63u` changed to `& 31u`: the test fails (killed). - Removing `self.masks.discard(d + 1)`: the test still passes (survived). **Findings** - P2: The new check runs the emitted HLSL through a Python evaluator. It has no D3D12 WARP GPU readback against a CPU reference. For a gfx2hlsl math lowering, the HLSL compiler's own treatment of `shl64`, `bw >= 32u ? ... : ...` and `uint2` is only covered indirectly. Please add a WARP readback on a Win2025 host (for example widths 0, 1, 31, 32, 33, 63 and offsets 0, 1, 31, 32, 63) and put the result in the PR body. I did not run Windows here. The Windows CI job only builds and runs the existing tests. - Nit: the survived mutation shows no test depends on `self.masks.discard(d + 1)`. Add a case where `s[d+1]` was a lane mask before the write and is read as a number after it. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 03:00:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T02:53:46Z.

Review: COMMENTED


Review of head 283f03ead8d7862aaaa76980ef14f082b2f8166d (s_bfm_b64 lowering in gfx2hlsl).

Summary: No P1 or P2 findings. The lowering matches the ISA definition D.u64 = ((1ULL << S0.u[5:0]) - 1) << S1.u[5:0], SCC unchanged.

Checked

  • Semantics: width is masked to 6 bits. Width >= 32 gives low word 0xffffffff and high word (1<<(w&31))-1. Width 32 gives high 0 and width 0 gives 0, so both edges are right. The offset goes through shl64, which drops bits past bit 63. Every HLSL shift count stays below 32.
  • Both destination words are written from locals before either is stored, so a source aliasing the destination is safe. Uniformity is judged before the destination changes. Lane-mask, exec/vcc and register-pair sources, odd or unaligned destinations, extra modifiers and wrong operand counts are all refused.
  • The constant-folding path agrees with the run-time path (control grid in the test).
  • CI on this head: Linux checks pass, Windows build and test pass, gfx1013 fixtures pass. The Windows /O2 job was skipped.
  • Wiring: CMake CPU and WARP/hardware entries, windows.yml and AGENTS.md are all updated. The optional --startup-flat-param constants argument is bounds-checked (6..7 args, 4 hex words).

Commands run locally on the worktree

  • python3 -B tests/startup_gfx2hlsl_bfm_b64_check.py -> PASS (all controls and 3 built-in mutations caught)
  • python3 -B tests/startup_gfx2hlsl_sopk_accum_check.py (sibling) -> PASS
  • python3 tests/docs_links_check.py -> OK (18 files, 401 links)
  • python3 tests/bidi_controls_check.py -> OK
  • git diff --check origin/main...HEAD -> clean
  • Own mutation 1: bw >= 32u changed to bw > 32u in the emitted HLSL -> the test fails (rc=1, mismatch at width 32). Killed.
  • Own mutation 2: & 63u changed to & 31u on the width -> caught ("width masked with 31").
  • Worktree restored with git checkout -- ..

Nits (non-blocking)

  • The CMake comment in the new foreach block says "review of #2007", which refers to the PR itself. Prefer describing the behaviour.
  • The new Python check is 628 lines. Consider moving the shared mutation grid into a helper if more s_bf* ops follow.

Windows proof: I did not run a separate Win2025 job. The PR's own Windows CI is green and the draw test runs on WARP and hardware adapters. A fresh Win2025 WARP readback is still advisable before merge, if not already done for this exact head.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6051147601 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#pullrequestreview-6051147601). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T02:53:46Z. **Review:** COMMENTED --- Review of head `283f03ead8d7862aaaa76980ef14f082b2f8166d` (s_bfm_b64 lowering in gfx2hlsl). **Summary:** No P1 or P2 findings. The lowering matches the ISA definition `D.u64 = ((1ULL << S0.u[5:0]) - 1) << S1.u[5:0]`, SCC unchanged. **Checked** - Semantics: width is masked to 6 bits. Width >= 32 gives low word 0xffffffff and high word `(1<<(w&31))-1`. Width 32 gives high 0 and width 0 gives 0, so both edges are right. The offset goes through `shl64`, which drops bits past bit 63. Every HLSL shift count stays below 32. - Both destination words are written from locals before either is stored, so a source aliasing the destination is safe. Uniformity is judged before the destination changes. Lane-mask, exec/vcc and register-pair sources, odd or unaligned destinations, extra modifiers and wrong operand counts are all refused. - The constant-folding path agrees with the run-time path (control grid in the test). - CI on this head: Linux checks pass, Windows build and test pass, gfx1013 fixtures pass. The Windows /O2 job was skipped. - Wiring: CMake CPU and WARP/hardware entries, `windows.yml` and `AGENTS.md` are all updated. The optional `--startup-flat-param` constants argument is bounds-checked (6..7 args, 4 hex words). **Commands run locally on the worktree** - `python3 -B tests/startup_gfx2hlsl_bfm_b64_check.py` -> PASS (all controls and 3 built-in mutations caught) - `python3 -B tests/startup_gfx2hlsl_sopk_accum_check.py` (sibling) -> PASS - `python3 tests/docs_links_check.py` -> OK (18 files, 401 links) - `python3 tests/bidi_controls_check.py` -> OK - `git diff --check origin/main...HEAD` -> clean - Own mutation 1: `bw >= 32u` changed to `bw > 32u` in the emitted HLSL -> the test fails (rc=1, mismatch at width 32). Killed. - Own mutation 2: `& 63u` changed to `& 31u` on the width -> caught ("width masked with 31"). - Worktree restored with `git checkout -- .`. **Nits (non-blocking)** - The CMake comment in the new `foreach` block says "review of #2007", which refers to the PR itself. Prefer describing the behaviour. - The new Python check is 628 lines. Consider moving the shared mutation grid into a helper if more `s_bf*` ops follow. **Windows proof:** I did not run a separate Win2025 job. The PR's own Windows CI is green and the draw test runs on WARP and hardware adapters. A fresh Win2025 WARP readback is still advisable before merge, if not already done for this exact head. AI-assisted; commands listed were executed locally.
JB2WIN commented 2026-11-25 03:01:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JB2WIN on 2026-11-25T02:48:57Z.


@tedin7, both points are addressed in 283f03ea (rebased on 498c23cc).

WARP and hardware readback. New startup_gfx2hlsl_bfm_b64_warp and _hardware tests run a draw mode. Width and offset arrive as run-time root constants, so the translator cannot fold them. Each draw evaluates the pair and the swapped pair, and all four words are read back through the uint target and compared with the bit-loop reference.

Adapter Driver Compilers Result
NVIDIA GeForce RTX 3080, debug layer on (debug_errors=0) 32.0.16.2124 FXC ps_5_1, DXC ps_6_0 every case equals the reference
WARP d3d10warp.dll 10.0.26100.9818 FXC ps_5_1, DXC ps_6_0 every case equals the reference

Windows 11 build 26200, Windows SDK 10.0.26100.0 compilers.

  • Cases: widths {0, 1, 31, 32, 33, 63} × offsets {0, 1, 31, 32, 63}, plus four sources with bits above [5:0] (64/0, 0x41/0xc1, 0xffffffa1/3, 5/0xffffff9f).
  • Negative controls:
    • a reference without the bit-63 cut-off is rejected in four cases;
    • a lowering mutated to "width 0 gives all ones" reads back ffffffff,0,ffffffff,0 and ffffffe0,1f,1f,0.
  • Lowering unchanged: the measurement found no lowering error, so gfx2hlsl.py is unchanged.
  • Renderer change: to pass run-time SGPRs, offscreen_check --startup-flat-param now optionally takes the four entry constants. Without the argument they stay 0, so existing callers are unchanged.

Nit. New case: s21 is a lane mask from v_cmp, then s_bfm_b64 s[20:21] overwrites it, then s21 is read as a number. This is accepted and gives the reference high word. Reading s21 while it is still a mask is refused. A mutation that drops self.masks.discard(d + 1) makes the check fail.

ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl' passed 66/66 with no skips, and all 43 pure checks pass.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7151222895 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7151222895). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-25T02:48:57Z. --- @tedin7, both points are addressed in `283f03ea` (rebased on `498c23cc`). **WARP and hardware readback.** New `startup_gfx2hlsl_bfm_b64_warp` and `_hardware` tests run a draw mode. Width and offset arrive as run-time root constants, so the translator cannot fold them. Each draw evaluates the pair and the swapped pair, and all four words are read back through the uint target and compared with the bit-loop reference. | Adapter | Driver | Compilers | Result | |---|---|---|---| | NVIDIA GeForce RTX 3080, debug layer on (`debug_errors=0`) | 32.0.16.2124 | FXC `ps_5_1`, DXC `ps_6_0` | every case equals the reference | | WARP | `d3d10warp.dll` 10.0.26100.9818 | FXC `ps_5_1`, DXC `ps_6_0` | every case equals the reference | Windows 11 build 26200, Windows SDK 10.0.26100.0 compilers. - **Cases:** widths {0, 1, 31, 32, 33, 63} × offsets {0, 1, 31, 32, 63}, plus four sources with bits above `[5:0]` (64/0, 0x41/0xc1, 0xffffffa1/3, 5/0xffffff9f). - **Negative controls:** - a reference without the bit-63 cut-off is rejected in four cases; - a lowering mutated to "width 0 gives all ones" reads back `ffffffff,0,ffffffff,0` and `ffffffe0,1f,1f,0`. - **Lowering unchanged:** the measurement found no lowering error, so `gfx2hlsl.py` is unchanged. - **Renderer change:** to pass run-time SGPRs, `offscreen_check --startup-flat-param` now optionally takes the four entry constants. Without the argument they stay 0, so existing callers are unchanged. **Nit.** New case: `s21` is a lane mask from `v_cmp`, then `s_bfm_b64 s[20:21]` overwrites it, then `s21` is read as a number. This is accepted and gives the reference high word. Reading `s21` while it is still a mask is refused. A mutation that drops `self.masks.discard(d + 1)` makes the check fail. `ctest --preset dev --no-tests=error -R '^startup_gfx2hlsl'` passed 66/66 with no skips, and all 43 pure checks pass. AI-assisted (Claude Code).
tedin7 commented 2026-11-25 13:01:01 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:53:15Z.


@JB2WIN could you rebase this branch onto current main and force-push?

GitHub reports head 283f03ea as conflicting with main, so it cannot be merged as is.

Files that conflict with current main (cf97bee1):

  • AGENTS.md
  • CMakeLists.txt
  • tests/desktop_gpu.h
  • tests/offscreen_check.cpp
  • tests/startup_flat_param.cpp

Commands run locally:

git fetch origin main pull/2007/head
git merge-tree --write-tree --name-only origin/main FETCH_HEAD
gh pr view 2007 --json mergeable   # CONFLICTING

Once it is rebased and CI is green it will be re-checked right away.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7162993941 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7162993941). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T12:53:15Z. --- @JB2WIN could you rebase this branch onto current `main` and force-push? GitHub reports head `283f03ea` as conflicting with `main`, so it cannot be merged as is. Files that conflict with current `main` (`cf97bee1`): - `AGENTS.md` - `CMakeLists.txt` - `tests/desktop_gpu.h` - `tests/offscreen_check.cpp` - `tests/startup_flat_param.cpp` Commands run locally: ``` git fetch origin main pull/2007/head git merge-tree --write-tree --name-only origin/main FETCH_HEAD gh pr view 2007 --json mergeable # CONFLICTING ``` Once it is rebased and CI is green it will be re-checked right away. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-25 19:04:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T18:32:09Z.


Independent verification requested after the rebase. In the saved-profile comparison at a6c8d80d, one previously translated graphics pipeline reached the s_bfm_b64 refusal with the current startup translator. This gives the existing patch a concrete follow-up under #870.

The author's next step is the rebase already requested above. An independent reviewer can claim the WARP/hardware rerun here now. Once the new head is posted, record its commit and run ctest --preset release --no-tests=error -j 1 -R '^startup_gfx2hlsl_bfm_b64($|_(warp|hardware)$)' -V from a Release build with the relevant fixtures built. Report the readback for both words, the negative-control result, adapter and driver, and any skips. Main development will recheck the affected translation once the patch lands.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7171040347 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7171040347). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T18:32:09Z. --- Independent verification requested after the rebase. In the saved-profile comparison at `a6c8d80d`, one previously translated graphics pipeline reached the `s_bfm_b64` refusal with the current startup translator. This gives the existing patch a concrete follow-up under #870. The author's next step is the rebase already requested above. An independent reviewer can claim the WARP/hardware rerun here now. Once the new head is posted, record its commit and run `ctest --preset release --no-tests=error -j 1 -R '^startup_gfx2hlsl_bfm_b64($|_(warp|hardware)$)' -V` from a Release build with the relevant fixtures built. Report the readback for both words, the negative-control result, adapter and driver, and any skips. Main development will recheck the affected translation once the patch lands.
RonLogic commented 2026-11-25 20:04:42 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-25T19:15:26Z.


I’ll take the independent Release rerun requested above once the rebased head is up. I’ll use Windows 11 x64 build 26300.10075 with WARP and an RTX 4070 and report both destination words, the readback controls, and any skips.

Pre-rebase baseline at 283f03ead8d7862aaaa76980ef14f082b2f8166d: 3/3 CTests passed with no skips on in-box WARP 10.0.26100.10068 and RTX 4070 driver 32.0.16.2124. Both FXC and DXC matched the reference, including width 33 and offset 31 (80000000,ffffffff for the first pair and 00000000,fffffffe for the swapped pair). Both negative controls rejected the intentionally wrong results. A direct DXC replay of that pair reported the debug layer enabled, with zero warnings or errors, on both adapters.

cmake --build --preset release --target offscreen_check --parallel 4
ctest --preset release --no-tests=error -j 1 -R '^startup_gfx2hlsl_bfm_b64($|_(warp|hardware)$)' -V

I’ll repeat this on the new head.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7172041342 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7172041342). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-25T19:15:26Z. --- I’ll take the independent Release rerun requested above once the rebased head is up. I’ll use Windows 11 x64 build 26300.10075 with WARP and an RTX 4070 and report both destination words, the readback controls, and any skips. Pre-rebase baseline at `283f03ead8d7862aaaa76980ef14f082b2f8166d`: 3/3 CTests passed with no skips on in-box WARP 10.0.26100.10068 and RTX 4070 driver 32.0.16.2124. Both FXC and DXC matched the reference, including width 33 and offset 31 (`80000000,ffffffff` for the first pair and `00000000,fffffffe` for the swapped pair). Both negative controls rejected the intentionally wrong results. A direct DXC replay of that pair reported the debug layer enabled, with zero warnings or errors, on both adapters. ```powershell cmake --build --preset release --target offscreen_check --parallel 4 ctest --preset release --no-tests=error -j 1 -R '^startup_gfx2hlsl_bfm_b64($|_(warp|hardware)$)' -V ``` I’ll repeat this on the new head.
R0Y00 commented 2026-11-25 20:04:48 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T20:03:11Z.


The branch now includes the mainline conflict repair at db5f84fe. Both mask words use the current scalar-uniformity bookkeeping. The renderer keeps the optional four entry constants and the newer culling/winding operation. My Windows Release run passed 8/8 for BFM, flat parameter and nearby translator cases, plus 2/2 raster winding cases. The BFM draws checked both mask pairs with FXC and DXC on WARP and RTX 4060 Laptop, including the uncapped-reference and width-zero mutation controls. @RonLogic, this is the candidate for your independent rerun. The #870 executable retry is separate.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7173120932 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7173120932). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T20:03:11Z. --- The branch now includes the mainline conflict repair at `db5f84fe`. Both mask words use the current scalar-uniformity bookkeeping. The renderer keeps the optional four entry constants and the newer culling/winding operation. My Windows Release run passed 8/8 for BFM, flat parameter and nearby translator cases, plus 2/2 raster winding cases. The BFM draws checked both mask pairs with FXC and DXC on WARP and RTX 4060 Laptop, including the uncapped-reference and width-zero mutation controls. @RonLogic, this is the candidate for your independent rerun. The #870 executable retry is separate.
tedin7 commented 2026-11-25 21:00:47 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Review of head db5f84fe (comment only, Linux checks; no Windows run by me).

Code (tools/startup/gfx2hlsl.py, op_s_bfm_b64): matches the ISA expression. Width masked to 6 bits, offset handled in shl64, no emitted shift count of 32 or more. Both sources are read and checked against Stage.masks before either destination word changes, which covers the earlier request. Modifiers, operand count, odd or out-of-range destination pair, exec/vcc and descriptor sources are refused. Uniformity is recorded for both words from the old source state.

Checked locally on the exact head:

  • python3 -B tests/startup_gfx2hlsl_bfm_b64_check.py: PASS
  • python3 tests/docs_links_check.py: pass
  • python3 tests/bidi_controls_check.py: pass
  • git diff --check origin/main...HEAD: clean
  • Mutation: dropped & 63u on the width -> check exits 1 (caught)
  • Mutation: bw >= 32u changed to bw >= 33u -> check exits 1 (caught)

Care items: the .github/workflows/windows.yml change is one line and must be exercised by this PR's own CI run. The offscreen_check/startup_flat_param edits are small and sit next to the new WARP/hardware cases.

Not covered by me: WARP/hardware readback (an independent Release rerun is already claimed above by @RonLogic) and anything about the startup path under #870. Because the PR is tied to the #870 saved-profile follow-up, the merge stays with @R0Y00 / MasterDomino, who can verify on the real executable. I am not merging it.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6064227526 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#pullrequestreview-6064227526). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T20:07:35Z. **Review:** COMMENTED --- Review of head `db5f84fe` (comment only, Linux checks; no Windows run by me). Code (`tools/startup/gfx2hlsl.py`, `op_s_bfm_b64`): matches the ISA expression. Width masked to 6 bits, offset handled in `shl64`, no emitted shift count of 32 or more. Both sources are read and checked against `Stage.masks` before either destination word changes, which covers the earlier request. Modifiers, operand count, odd or out-of-range destination pair, exec/vcc and descriptor sources are refused. Uniformity is recorded for both words from the old source state. Checked locally on the exact head: - `python3 -B tests/startup_gfx2hlsl_bfm_b64_check.py`: PASS - `python3 tests/docs_links_check.py`: pass - `python3 tests/bidi_controls_check.py`: pass - `git diff --check origin/main...HEAD`: clean - Mutation: dropped `& 63u` on the width -> check exits 1 (caught) - Mutation: `bw >= 32u` changed to `bw >= 33u` -> check exits 1 (caught) Care items: the `.github/workflows/windows.yml` change is one line and must be exercised by this PR's own CI run. The `offscreen_check`/`startup_flat_param` edits are small and sit next to the new WARP/hardware cases. Not covered by me: WARP/hardware readback (an independent Release rerun is already claimed above by @RonLogic) and anything about the startup path under #870. Because the PR is tied to the #870 saved-profile follow-up, the merge stays with @R0Y00 / MasterDomino, who can verify on the real executable. I am not merging it. AI-assisted; commands listed were executed locally.
Leyukaka commented 2026-11-26 02:05:12 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-26T01:43:41Z.


Measurement, on a local capture (counts and instruction shape only), at main 7287979: 195 requests stop at s_bfm_b64, the largest refusal after src_scc operands, the slot 57 execz block, a live vcc in an execz block, v_readfirstlane_b32 and register-offset s_load through the resource heap. Another 25 stop at s_bfm_b64 right after the 64-bit literal of #2039. I measured that with main's translator plus an in-memory wrap that accepts that literal; I did not run either branch.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7180064087 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7180064087). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-26T01:43:41Z. --- Measurement, on a local capture (counts and instruction shape only), at main `7287979`: 195 requests stop at `s_bfm_b64`, the largest refusal after `src_scc` operands, the slot 57 execz block, a live `vcc` in an execz block, `v_readfirstlane_b32` and register-offset `s_load` through the resource heap. Another 25 stop at `s_bfm_b64` right after the 64-bit literal of #2039. I measured that with main's translator plus an in-memory wrap that accepts that literal; I did not run either branch. AI-assisted.
Ybucaille commented 2026-11-26 04:04:40 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ybucaille on 2026-11-26T03:39:58Z.


@JB2WIN, @R0Y00: this conflicts with main again, and with 195 requests stopping at s_bfm_b64 (Leyukaka above) it is worth landing. I merged current main into the PR head, as a merge commit on top of db5f84fe, so the branch can fast-forward to it without a force-push:

https://github.com/Ybucaille/Xbox2Windows/tree/startup/gfx2hlsl-bfm-b64-merge (a73b60f8)

git fetch https://github.com/Ybucaille/Xbox2Windows.git startup/gfx2hlsl-bfm-b64-merge
git merge --ff-only FETCH_HEAD
  • Conflicts (4), both sides kept: AGENTS.md (the bfm_b64 and mask_data lines), CMakeLists.txt (the bfm_b64 warp/hardware draw block now has its own foreach/endforeach, next to main's int_alu, cndmask_abs and cube blocks), tests/desktop_gpu.h and tests/offscreen_check.cpp (the PR's optional constants argument of --startup-flat-param alongside main's --startup-entry-words). gfx2hlsl.py, startup_flat_param.cpp and windows.yml merged cleanly.
  • Handler unchanged: uniform_source, record_scalar_uniformity, set_s, masks keep their signatures on main; the handler still refuses mask sources before any write, so main's new reject_lane_mask_data adds nothing here.
  • Checked on Linux: startup_gfx2hlsl_bfm_b64_check.py exit 0; dropping & 63u on the width makes it exit 1. The other 117 startup_gfx2hlsl_* / flat-param / translator / docs checks give the same results as on main (two draw checks fail on both without Windows tools).
  • Not checked: the C++ is not compiled here and the WARP/hardware draws were not run. @RonLogic's rerun would cover both on this head.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181917511 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7181917511). Originally posted by [Ybucaille](https://github.com/Ybucaille) on 2026-11-26T03:39:58Z. --- @JB2WIN, @R0Y00: this conflicts with `main` again, and with 195 requests stopping at `s_bfm_b64` (Leyukaka above) it is worth landing. I merged current `main` into the PR head, as a merge commit on top of `db5f84fe`, so the branch can fast-forward to it without a force-push: https://github.com/Ybucaille/Xbox2Windows/tree/startup/gfx2hlsl-bfm-b64-merge (`a73b60f8`) ``` git fetch https://github.com/Ybucaille/Xbox2Windows.git startup/gfx2hlsl-bfm-b64-merge git merge --ff-only FETCH_HEAD ``` - **Conflicts (4), both sides kept:** `AGENTS.md` (the `bfm_b64` and `mask_data` lines), `CMakeLists.txt` (the `bfm_b64` warp/hardware draw block now has its own `foreach`/`endforeach`, next to `main`'s int_alu, cndmask_abs and cube blocks), `tests/desktop_gpu.h` and `tests/offscreen_check.cpp` (the PR's optional `constants` argument of `--startup-flat-param` alongside `main`'s `--startup-entry-words`). `gfx2hlsl.py`, `startup_flat_param.cpp` and `windows.yml` merged cleanly. - **Handler unchanged:** `uniform_source`, `record_scalar_uniformity`, `set_s`, `masks` keep their signatures on `main`; the handler still refuses mask sources before any write, so `main`'s new `reject_lane_mask_data` adds nothing here. - **Checked on Linux:** `startup_gfx2hlsl_bfm_b64_check.py` exit 0; dropping `& 63u` on the width makes it exit 1. The other 117 `startup_gfx2hlsl_*` / flat-param / translator / docs checks give the same results as on `main` (two draw checks fail on both without Windows tools). - **Not checked:** the C++ is not compiled here and the WARP/hardware draws were not run. @RonLogic's rerun would cover both on this head. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-26 05:02:08 +00:00
R0Y00 commented 2026-11-26 05:02:09 +00:00 (Migrated from github.com)

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

Review: APPROVED


I verified the contributor merge is a fast-forward from the previous PR head. On its combination with main, the Release offscreen suite passed 11/11 on WARP and RTX 4060 Laptop, including the all-width/all-offset static grid, both DWORD outputs in FXC and DXC, the width and offset mutations, and the adjacent integer/negative-zero/culling checks. The newer main diff is the independent gather diagnostic. This verifies the source-built instruction lowering; the local refusal census is separate.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6068691854 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#pullrequestreview-6068691854). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T04:48:25Z. **Review:** APPROVED --- I verified the contributor merge is a fast-forward from the previous PR head. On its combination with main, the Release offscreen suite passed 11/11 on WARP and RTX 4060 Laptop, including the all-width/all-offset static grid, both DWORD outputs in FXC and DXC, the width and offset mutations, and the adjacent integer/negative-zero/culling checks. The newer main diff is the independent gather diagnostic. This verifies the source-built instruction lowering; the local refusal census is separate.
JB2WIN commented 2026-11-26 05:02:28 +00:00 (Migrated from github.com)

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


Thanks @Ybucaille. I checked a73b60f8 and fast-forwarded the branch to it (db5f84fe..a73b60f8, no force-push).

Windows run at a73b60f8, which still merges cleanly into current main (418f9245, checked with git merge-tree):

  • Adapter: NVIDIA GeForce RTX 3080, driver 32.0.16.2124, Windows 11 build 26200, VS 2026 Build Tools, release preset, debug layer as the tests set it
  • ctest --preset release --no-tests=error -R "bfm|flat_param|startup_stubs$" -V: 11/11 passed, 0 skipped
    • startup_gfx2hlsl_bfm_b64, startup_gfx2hlsl_bfm_b64_warp, startup_gfx2hlsl_bfm_b64_hardware
    • startup_flat_param_controls, startup_flat_param_warp, startup_flat_param_hardware
    • compute_store_aot_alu_bfm_warp / _hardware, pixel_aot_bfm_warp / _hardware, startup_stubs

This covers the compile of the merged C++ and the WARP and hardware draws that were not run before. Refs #2618.

AI-assisted (Claude Code); the commands above were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7182851062 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2007#issuecomment-7182851062). Originally posted by [JB2WIN](https://github.com/JB2WIN) on 2026-11-26T04:43:48Z. --- Thanks @Ybucaille. I checked `a73b60f8` and fast-forwarded the branch to it (`db5f84fe..a73b60f8`, no force-push). Windows run at `a73b60f8`, which still merges cleanly into current main (`418f9245`, checked with `git merge-tree`): - Adapter: NVIDIA GeForce RTX 3080, driver 32.0.16.2124, Windows 11 build 26200, VS 2026 Build Tools, release preset, debug layer as the tests set it - `ctest --preset release --no-tests=error -R "bfm|flat_param|startup_stubs$" -V`: **11/11 passed, 0 skipped** - `startup_gfx2hlsl_bfm_b64`, `startup_gfx2hlsl_bfm_b64_warp`, `startup_gfx2hlsl_bfm_b64_hardware` - `startup_flat_param_controls`, `startup_flat_param_warp`, `startup_flat_param_hardware` - `compute_store_aot_alu_bfm_warp` / `_hardware`, `pixel_aot_bfm_warp` / `_hardware`, `startup_stubs` This covers the compile of the merged C++ and the WARP and hardware draws that were not run before. Refs #2618. AI-assisted (Claude Code); the commands above 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!2000
No description provided.