startup: lower combined register+immediate SMEM offsets in gfx2hlsl #1874

Merged
consolelogkyo merged 1 commit from upstream-pr/1881 into main 2026-11-24 20:56:49 +00:00
consolelogkyo commented 2026-11-24 20:02:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by consolelogkyo on 2026-11-24T20:02:46Z.


Problem

In RDNA 2 SMEM instructions (s_load_dword* and s_buffer_load_dword*), a scalar register SOFFSET (w1[31:25], s0..s105 or m0) and a non-zero 21-bit signed immediate OFFSET (w1[20:0]) can be active at the same time: tools/disasm_rdna2.py prints the register in ops[2] and offset:0x... in mods (for example s_buffer_load_dwordx4 s[20:23], s[16:19], s8 offset:0x18 or s_load_dwordx4 s[24:27], s[10:11], s9 offset:0x10).

Previously, Stage.op_s_buffer_load_dword() and Stage.op_s_load_dwordx4() in tools/startup/gfx2hlsl.py ignored mods:

  1. Silent drop of offset:0x... on register-addressed SMEM loads. Both s_buffer_load_dword* and opt-in dynamic sampler-heap s_load_dwordx4 discarded offset:0x... from mods and loaded from + 0 instead of adding the immediate byte offset.
  2. Silent acceptance of negative 21-bit signed immediates as +1..2 MiB. OFFSET[20:0] is signed two's complement on RDNA 2, while disasm_rdna2 formats w1 & 0x1fffff as unsigned hex (0x100000..0x1fffff for negative byte offsets). Parsing those tokens directly as non-negative literals produced +1..2 MiB offsets instead of refusing them.
  3. Unchecked modifiers and soffset operands. Unknown SMEM modifiers and non-SGPR/m0 soffset operands (vcc_lo, exec_lo, ttmp*, VGPRs, register ranges) were not validated consistently across s_buffer_load_dword* and both sampler-heap modes of s_load_dwordx4.
  4. Destination/soffset clobber on multi-dword loads. When a multi-dword s_buffer_load_dwordx* used a runtime SGPR soffset that lay inside the destination range (dst[1] <= sreg < dst[2]), writing the first destination register overwrote sN before subsequent dwords were loaded.

What Changed

  • tools/startup/gfx2hlsl.py:
    • Added smem_mods(mods) to accept cache-policy flags (glc, dlc) and at most one non-negative 21-bit signed offset: modifier (0..0xfffff), refusing negative 21-bit immediates (> 0xfffff, an unlowered translator gap refused by name rather than read at +1..2 MiB), duplicate offset: tokens and any unknown modifier.
    • Added Stage.smem_soffset() to restrict non-literal SMEM offset operands to s0..s105 (via self.S(), preserving descriptor/pointer refusals) or m0 across s_buffer_load_dword* and both sampler-heap modes of s_load_dwordx4 (without polluting used_s when the default sampler-heap shortcut is taken).
    • Updated Stage.op_s_buffer_load_dword() and Stage.op_s_load_dwordx4() to add offset:0x... on register-addressed s_buffer_load_dword* and opt-in sampler-heap s_load_dwordx4 loads, refuse negative or out-of-range literal immediates and mismatched destination/base widths, and save an overlapping runtime SGPR soffset into a before multi-dword destination writes.
  • tests/startup_smem_address_check.py, CMakeLists.txt, .github/workflows/windows.yml, AGENTS.md, docs/experiments.md:
    • Added synthetic 8-byte RDNA 2 SMEM encodings (binary llvm-mc-15 parity check, pure-Python controls, and warp / hardware GPU readback CTests):
      • s_buffer_load_dwordx4 with SGPR + offset:0x18 glc at two runtime soffset values (32 and 64);
      • s_buffer_load_dword with m0 + offset:0x14 dlc, constant-SGPR + offset:0x08, and destination-overlapping runtime s_buffer_load_dwordx2 s[20:21], s[16:19], s20 offset:0x1c glc;
      • full-screen dynamic sampler-heap pixel draws (s_load_dwordx4 s[24:27], s[10:11], s9 offset:0x10 compiled with both DXC vs_6_0/ps_6_0 and FXC vs_5_1/ps_5_1) selecting entry 1 (s9 = 0), entry 2 (s9 = 16) and fallback entry 2047 (s9 = 2046 * 16);
      • live in-process negative control and GPU translation mutations (dropping offset:0x18, dropping + 16 on the sampler heap, and reading the clobbered s20 word instead of a) verified to fail readback.

Verification

Tested on Windows 11 26H2 (build 26300.9974), MSVC 19.44.35230.0, Windows SDK 10.0.26100.0 (dxc.exe + fxc.exe), D3D12 debug layer enabled (debug_errors=0 debug_warnings=0):

  • WARP: Microsoft Basic Render Driver 10.0.26100.9818 — 0 mismatches across all 320-dword buffer readbacks and all DXC/FXC sampler-heap draws; all wrong-reference controls and translation mutations failed as expected.
  • Physical GPU: AMD Radeon RX 9070 XT (32.0.32029.2010) — 0 mismatches across all 320-dword buffer readbacks and all DXC/FXC sampler-heap draws; all wrong-reference controls and translation mutations failed as expected.
cmake --preset dev
ctest --preset dev --no-tests=error -R '^(startup_smem_address_(controls|warp|hardware)|startup_gfx2hlsl_smem_offset|startup_sampler_heap_controls|startup_tools_lint)$' -V
python -B tests/docs_links_check.py
python -B tests/bidi_controls_check.py
git diff --check

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6590324145 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1881). Originally posted by [consolelogkyo](https://github.com/consolelogkyo) on 2026-11-24T20:02:46Z. --- ## Problem In RDNA 2 SMEM instructions (`s_load_dword*` and `s_buffer_load_dword*`), a scalar register `SOFFSET` (`w1[31:25]`, `s0`..`s105` or `m0`) and a non-zero 21-bit signed immediate `OFFSET` (`w1[20:0]`) can be active at the same time: `tools/disasm_rdna2.py` prints the register in `ops[2]` and `offset:0x...` in `mods` (for example `s_buffer_load_dwordx4 s[20:23], s[16:19], s8 offset:0x18` or `s_load_dwordx4 s[24:27], s[10:11], s9 offset:0x10`). Previously, `Stage.op_s_buffer_load_dword()` and `Stage.op_s_load_dwordx4()` in `tools/startup/gfx2hlsl.py` ignored `mods`: 1. **Silent drop of `offset:0x...` on register-addressed SMEM loads.** Both `s_buffer_load_dword*` and opt-in dynamic sampler-heap `s_load_dwordx4` discarded `offset:0x...` from `mods` and loaded from `+ 0` instead of adding the immediate byte offset. 2. **Silent acceptance of negative 21-bit signed immediates as `+1..2` MiB.** `OFFSET[20:0]` is signed two's complement on RDNA 2, while `disasm_rdna2` formats `w1 & 0x1fffff` as unsigned hex (`0x100000`..`0x1fffff` for negative byte offsets). Parsing those tokens directly as non-negative literals produced `+1..2` MiB offsets instead of refusing them. 3. **Unchecked modifiers and `soffset` operands.** Unknown SMEM modifiers and non-SGPR/`m0` `soffset` operands (`vcc_lo`, `exec_lo`, `ttmp*`, VGPRs, register ranges) were not validated consistently across `s_buffer_load_dword*` and both sampler-heap modes of `s_load_dwordx4`. 4. **Destination/soffset clobber on multi-dword loads.** When a multi-dword `s_buffer_load_dwordx*` used a runtime SGPR `soffset` that lay inside the destination range (`dst[1] <= sreg < dst[2]`), writing the first destination register overwrote `sN` before subsequent dwords were loaded. ## What Changed - **`tools/startup/gfx2hlsl.py`**: - Added `smem_mods(mods)` to accept cache-policy flags (`glc`, `dlc`) and at most one non-negative 21-bit signed `offset:` modifier (`0`..`0xfffff`), refusing negative 21-bit immediates (`> 0xfffff`, an unlowered translator gap refused by name rather than read at `+1..2` MiB), duplicate `offset:` tokens and any unknown modifier. - Added `Stage.smem_soffset()` to restrict non-literal SMEM offset operands to `s0`..`s105` (via `self.S()`, preserving descriptor/pointer refusals) or `m0` across `s_buffer_load_dword*` and both sampler-heap modes of `s_load_dwordx4` (without polluting `used_s` when the default sampler-heap shortcut is taken). - Updated `Stage.op_s_buffer_load_dword()` and `Stage.op_s_load_dwordx4()` to add `offset:0x...` on register-addressed `s_buffer_load_dword*` and opt-in sampler-heap `s_load_dwordx4` loads, refuse negative or out-of-range literal immediates and mismatched destination/base widths, and save an overlapping runtime SGPR `soffset` into `a` before multi-dword destination writes. - **`tests/startup_smem_address_check.py`**, **`CMakeLists.txt`**, **`.github/workflows/windows.yml`**, **`AGENTS.md`**, **`docs/experiments.md`**: - Added synthetic 8-byte RDNA 2 SMEM encodings (`binary llvm-mc-15` parity check, pure-Python `controls`, and `warp` / `hardware` GPU readback CTests): - `s_buffer_load_dwordx4` with `SGPR` + `offset:0x18 glc` at two runtime `soffset` values (`32` and `64`); - `s_buffer_load_dword` with `m0` + `offset:0x14 dlc`, constant-SGPR + `offset:0x08`, and destination-overlapping runtime `s_buffer_load_dwordx2 s[20:21], s[16:19], s20 offset:0x1c glc`; - full-screen dynamic sampler-heap pixel draws (`s_load_dwordx4 s[24:27], s[10:11], s9 offset:0x10` compiled with both DXC `vs_6_0`/`ps_6_0` and FXC `vs_5_1`/`ps_5_1`) selecting entry 1 (`s9 = 0`), entry 2 (`s9 = 16`) and fallback entry 2047 (`s9 = 2046 * 16`); - live in-process negative control and GPU translation mutations (dropping `offset:0x18`, dropping `+ 16` on the sampler heap, and reading the clobbered `s20` word instead of `a`) verified to fail readback. ## Verification Tested on Windows 11 26H2 (build `26300.9974`), MSVC `19.44.35230.0`, Windows SDK `10.0.26100.0` (`dxc.exe` + `fxc.exe`), D3D12 debug layer **enabled** (`debug_errors=0 debug_warnings=0`): - **WARP**: Microsoft Basic Render Driver `10.0.26100.9818` — 0 mismatches across all 320-dword buffer readbacks and all DXC/FXC sampler-heap draws; all wrong-reference controls and translation mutations failed as expected. - **Physical GPU**: AMD Radeon RX 9070 XT (`32.0.32029.2010`) — 0 mismatches across all 320-dword buffer readbacks and all DXC/FXC sampler-heap draws; all wrong-reference controls and translation mutations failed as expected. ```powershell cmake --preset dev ctest --preset dev --no-tests=error -R '^(startup_smem_address_(controls|warp|hardware)|startup_gfx2hlsl_smem_offset|startup_sampler_heap_controls|startup_tools_lint)$' -V python -B tests/docs_links_check.py python -B tests/bidi_controls_check.py git diff --check ``` AI-assisted.
upstream-sync closed this pull request 2026-11-24 21:01:05 +00:00
tedin7 commented 2026-11-24 21:01:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T20:08:36Z.

Review: COMMENTED


Review of a9401f53 (merge base = origin/main = df40e4bc, so no rebase needed). Comment only, not an approval.

Verdict

No P1 or P2 found. The addressing arithmetic matches the encoding the PR describes, and every mutant I tried is caught. Three P3 notes. Clean-room and title-neutral: all instruction bytes in the fixture are built from the bit layout, with no game files or titles.

Addressing

  • The effective offset is soffset + imm. In op_s_buffer_load_dword the generated load is Load(<soffset> + <imm> + 4*i) (bytes, no dword scaling), and in the opt-in sampler-heap path of op_s_load_dwordx4 the saved first destination is <soffset> + <imm>.
  • The disassembler prints soffset == 125 as a bare literal (0x%x of the 21-bit field) and otherwise prints the register plus offset:0x..., so the two forms cannot appear together. The PR refuses a literal with an offset: modifier, which covers a hand-written mix.
  • Signed 21-bit: 0x100000..0x1fffff are refused in both the offset: modifier and the literal form, so a negative immediate cannot read at +1..2 MiB. This is deliberately narrower than hardware (negative s_load offsets are legal); the docs say it is refused, not translated.
  • Modifiers: the disassembler only emits glc, dlc and offset:, so refusing every other modifier cannot reject something a real capture carries today.
  • Destination overlap: when a runtime sN sits in dst[1] <= N < dst[2], the offset is copied to a first, so later dwords do not read the freshly loaded value. a is the existing scratch variable (declared in the shader prologue and used the same way by two other ops), and nothing runs between the copy and the loads.

Mutants (each applied alone to tools/startup/gfx2hlsl.py, run with tests/startup_smem_address_check.py, then reverted)

All 8 fail the check: immediate dropped from s_buffer_load; limit 0xfffff raised to 0x1fffff; the overlap copy removed; the + imm removed from the sampler-heap path; unknown modifiers ignored; a second offset: accepted; literal plus offset: allowed; the s105 limit raised to 127.

P3

  • Default sampler-heap shortcut is stricter. When X2W_SAMPLER_HEAP is off, the old code accepted any non-literal offset token and returned a default sampler. The new code evaluates the operand with smem_soffset (without recording the register use), so a shader whose offset register is not s0..s105/m0, or holds something S() cannot evaluate, now stops with Unsupported where it used to translate. That matches the stated intent, but it is a behaviour change on the default path and the description only mentions the opt-in path.
  • Pre-fix handler kept in the test. old_s_buffer_load_dword is a copy of the removed implementation, kept for negative controls. It will not follow future changes to the real handler; the mutants above already cover the same failures against the real code.
  • Windows evidence. The GPU readbacks (WARP, RX 9070 XT, DXC and FXC) are the author's. I could not reproduce them.

Commands run (Linux, Python 3.14.8, llvm-mc-19)

  • python -B tests/startup_smem_address_check.py: startup SMEM address controls passed.
  • python -B tests/startup_smem_address_check.py binary llvm-mc-19: SMEM combined-offset encodings match llvm-mc (CI pins llvm-mc-15).
  • The 37 tests that import gfx2hlsl, run on this head and on origin/main: same exit code for each, except the new startup_smem_address_check.py (absent on main, passes here). That includes the existing startup_gfx2hlsl_smem_offset_check.py.
  • python -B tests/docs_links_check.py: Self-test passed. Checked 18 Markdown files and 379 links.
  • python -B tests/bidi_controls_check.py: Self-test passed. Checked 1327 tracked source, script and build/CI files: no bidirectional controls.
  • git diff --check origin/main...HEAD: clean. git merge-tree with origin/main: clean. All mutations reverted with git checkout -- ..

Not run

startup_smem_address_warp, startup_smem_address_hardware and the FXC compile (no Windows, DXC or GPU here).

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6046539327 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1881#pullrequestreview-6046539327). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T20:08:36Z. **Review:** COMMENTED --- Review of `a9401f53` (merge base = `origin/main` = `df40e4bc`, so no rebase needed). Comment only, not an approval. ## Verdict No P1 or P2 found. The addressing arithmetic matches the encoding the PR describes, and every mutant I tried is caught. Three P3 notes. Clean-room and title-neutral: all instruction bytes in the fixture are built from the bit layout, with no game files or titles. ## Addressing - The effective offset is `soffset + imm`. In `op_s_buffer_load_dword` the generated load is `Load(<soffset> + <imm> + 4*i)` (bytes, no dword scaling), and in the opt-in sampler-heap path of `op_s_load_dwordx4` the saved first destination is `<soffset> + <imm>`. - The disassembler prints `soffset == 125` as a bare literal (`0x%x` of the 21-bit field) and otherwise prints the register plus ` offset:0x...`, so the two forms cannot appear together. The PR refuses a literal with an `offset:` modifier, which covers a hand-written mix. - Signed 21-bit: `0x100000..0x1fffff` are refused in both the `offset:` modifier and the literal form, so a negative immediate cannot read at +1..2 MiB. This is deliberately narrower than hardware (negative s_load offsets are legal); the docs say it is refused, not translated. - Modifiers: the disassembler only emits `glc`, `dlc` and `offset:`, so refusing every other modifier cannot reject something a real capture carries today. - Destination overlap: when a runtime `sN` sits in `dst[1] <= N < dst[2]`, the offset is copied to `a` first, so later dwords do not read the freshly loaded value. `a` is the existing scratch variable (declared in the shader prologue and used the same way by two other ops), and nothing runs between the copy and the loads. ## Mutants (each applied alone to `tools/startup/gfx2hlsl.py`, run with `tests/startup_smem_address_check.py`, then reverted) All 8 fail the check: immediate dropped from `s_buffer_load`; limit `0xfffff` raised to `0x1fffff`; the overlap copy removed; the `+ imm` removed from the sampler-heap path; unknown modifiers ignored; a second `offset:` accepted; literal plus `offset:` allowed; the `s105` limit raised to 127. ## P3 - **Default sampler-heap shortcut is stricter.** When `X2W_SAMPLER_HEAP` is off, the old code accepted any non-literal offset token and returned a default sampler. The new code evaluates the operand with `smem_soffset` (without recording the register use), so a shader whose offset register is not `s0..s105`/`m0`, or holds something `S()` cannot evaluate, now stops with `Unsupported` where it used to translate. That matches the stated intent, but it is a behaviour change on the default path and the description only mentions the opt-in path. - **Pre-fix handler kept in the test.** `old_s_buffer_load_dword` is a copy of the removed implementation, kept for negative controls. It will not follow future changes to the real handler; the mutants above already cover the same failures against the real code. - **Windows evidence.** The GPU readbacks (WARP, RX 9070 XT, DXC and FXC) are the author's. I could not reproduce them. ## Commands run (Linux, Python 3.14.8, llvm-mc-19) - `python -B tests/startup_smem_address_check.py`: `startup SMEM address controls passed`. - `python -B tests/startup_smem_address_check.py binary llvm-mc-19`: `SMEM combined-offset encodings match llvm-mc` (CI pins `llvm-mc-15`). - The 37 tests that import `gfx2hlsl`, run on this head and on `origin/main`: same exit code for each, except the new `startup_smem_address_check.py` (absent on main, passes here). That includes the existing `startup_gfx2hlsl_smem_offset_check.py`. - `python -B tests/docs_links_check.py`: Self-test passed. Checked 18 Markdown files and 379 links. - `python -B tests/bidi_controls_check.py`: Self-test passed. Checked 1327 tracked source, script and build/CI files: no bidirectional controls. - `git diff --check origin/main...HEAD`: clean. `git merge-tree` with `origin/main`: clean. All mutations reverted with `git checkout -- .`. ## Not run `startup_smem_address_warp`, `startup_smem_address_hardware` and the FXC compile (no Windows, DXC or GPU here). AI-assisted; commands listed were executed locally.
ChazY11 commented 2026-11-24 21:01:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T20:19:13Z.


Ran the check and re-broke all four fixes

At the PR head, device-free:

out/pe-env/Scripts/python.exe -B tests/startup_smem_address_check.py
startup SMEM address controls passed      exit 0
out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_smem_offset_check.py
exit 0

Four mutations to tools/startup/gfx2hlsl.py, each reverted, one per fix the description claims:

mutation smem_address smem_offset (old check)
register-addressed load drops the immediate again (extra = imm or 0 → extra = 0) red green
if value > 0xfffff → > 0x1fffff (negative 21-bit accepted) red green
the overlapping-soffset save (emit('a = ...')) removed red green
sampling from the heap without adding the immediate red green

The right-hand column matters as much as the left: the older smem_offset check stays green under all four, i.e. these are
regressions the repo did not previously catch. That is exactly what "previously ignored mods" means, and the new fixture
distinguishes each fix separately rather than failing as a block.

One dead assertion in the new fixture

assert '0X10' or True  # uppercase hex in synthetic assembly is also accepted:
st_upper = ProbeStage()
st_upper.one('s_buffer_load_dword', 's_buffer_load_dword s24, s[16:19], s8 offset:0X2A')
assert '+ 42)' in st_upper.lines[0], st_upper.lines

'0X10' or True is always truthy, so that line asserts nothing; the real check is the '+ 42)' on the next two lines. Worth
deleting (or making it assert '0X2A' in st_upper.lines[0] if the intent was to pin the token spelling).

Two questions

  1. 0x100000..0x1fffff refusal vs. the reference. The doc row says the negative encodings are refused rather than
    translated as -1..-524288. Refusing is the conservative choice and I agree with it for now; if the ISA-level answer is
    "add the sign-extended offset", then this PR turns a wrong result into a named unsupported, which the row should say
    explicitly so a future reader knows it is a gap and not a decision.
  2. m0 as soffset with an immediate. The controls cover m0 + offset:0x14; is m0 also checked for the
    destination-overlap case (it cannot overlap, so a pass on that path is fine — I just could not tell whether the branch is
    exercised).

Scope

AGENTS.md and docs/experiments.md gain one line each, both consistent with how the other checks are listed; CMakeLists.txt
adds controls, _warp and _hardware registrations with SKIP_RETURN_CODE 77 like their neighbours. The workflow change
adds the new file to both the binary-parity matrix and the Linux check list, so it runs on both CI paths.

Verdict

Reviewed. Every fix in the description is pinned by a mutation that also proves the old check missed it. My only concrete
request is the dead assert '0X10' or True.

Notes

  • AI-assisted review.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7143361380 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1881#issuecomment-7143361380). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T20:19:13Z. --- ## Ran the check and re-broke all four fixes At the PR head, device-free: ```powershell out/pe-env/Scripts/python.exe -B tests/startup_smem_address_check.py startup SMEM address controls passed exit 0 out/pe-env/Scripts/python.exe -B tests/startup_gfx2hlsl_smem_offset_check.py exit 0 ``` Four mutations to `tools/startup/gfx2hlsl.py`, each reverted, one per fix the description claims: | mutation | `smem_address` | `smem_offset` (old check) | |---|---|---| | register-addressed load drops the immediate again (`extra = imm or 0` → `extra = 0`) | **red** | green | | `if value > 0xfffff` → `> 0x1fffff` (negative 21-bit accepted) | **red** | green | | the overlapping-`soffset` save (`emit('a = ...')`) removed | **red** | green | | sampling from the heap without adding the immediate | **red** | green | The right-hand column matters as much as the left: the older `smem_offset` check stays green under all four, i.e. these are regressions the repo did not previously catch. That is exactly what "previously ignored `mods`" means, and the new fixture distinguishes each fix separately rather than failing as a block. ## One dead assertion in the new fixture ```python assert '0X10' or True # uppercase hex in synthetic assembly is also accepted: st_upper = ProbeStage() st_upper.one('s_buffer_load_dword', 's_buffer_load_dword s24, s[16:19], s8 offset:0X2A') assert '+ 42)' in st_upper.lines[0], st_upper.lines ``` `'0X10' or True` is always truthy, so that line asserts nothing; the real check is the `'+ 42)'` on the next two lines. Worth deleting (or making it `assert '0X2A' in st_upper.lines[0]` if the intent was to pin the token spelling). ## Two questions 1. **`0x100000..0x1fffff` refusal vs. the reference.** The doc row says the negative encodings are refused rather than translated as `-1..-524288`. Refusing is the conservative choice and I agree with it for now; if the ISA-level answer is "add the sign-extended offset", then this PR turns a wrong result into a named unsupported, which the row should say explicitly so a future reader knows it is a gap and not a decision. 2. **`m0` as `soffset` with an immediate.** The controls cover `m0 + offset:0x14`; is `m0` also checked for the destination-overlap case (it cannot overlap, so a `pass` on that path is fine — I just could not tell whether the branch is exercised). ## Scope `AGENTS.md` and `docs/experiments.md` gain one line each, both consistent with how the other checks are listed; `CMakeLists.txt` adds `controls`, `_warp` and `_hardware` registrations with `SKIP_RETURN_CODE 77` like their neighbours. The workflow change adds the new file to both the binary-parity matrix and the Linux check list, so it runs on both CI paths. ## Verdict Reviewed. Every fix in the description is pinned by a mutation that also proves the old check missed it. My only concrete request is the dead `assert '0X10' or True`. ## Notes - AI-assisted review.
consolelogkyo commented 2026-11-24 21:01:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by consolelogkyo on 2026-11-24T20:41:35Z.


Thanks for the thorough review and mutation table, @ChazY11! Rebased onto origin/main (3cc12064) to resolve the list conflicts in .github/workflows/windows.yml and AGENTS.md, and folded in the cleanups from your and @tedin7's reviews:

  • Dead assertion removed: deleted the leftover assert '0X10' or True line before the offset:0X2A check (and replaced the copied old_s_buffer_load_dword helper with a live in-process monkeypatch on smem_mods).
  • Negative 21-bit signed OFFSET (0x100000..0x1fffff): clarified in docs/experiments.md (and the PR description) that hardware s_load_* sign-extends the 21-bit immediate, so refusing 0x100000..0x1fffff here is an explicit translator gap (turning a silent +1..2 MiB misread into a named Unsupported) rather than a permanent policy.
  • m0 on the destination-overlap check: the m0 + offset:0x10 loop in controls() already runs across all five s_buffer_load_dword* widths (1, 2, 4, 8, 16), where reg_range('m0') is None so the overlap branch is skipped; pinned that invariant explicitly with assert len(st_m0.lines) == width and all(not line.startswith('a =') for line in st_m0.lines).

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7143928578 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1881#issuecomment-7143928578). Originally posted by [consolelogkyo](https://github.com/consolelogkyo) on 2026-11-24T20:41:35Z. --- Thanks for the thorough review and mutation table, @ChazY11! Rebased onto `origin/main` (`3cc12064`) to resolve the list conflicts in `.github/workflows/windows.yml` and `AGENTS.md`, and folded in the cleanups from your and @tedin7's reviews: - **Dead assertion removed:** deleted the leftover `assert '0X10' or True` line before the `offset:0X2A` check (and replaced the copied `old_s_buffer_load_dword` helper with a live in-process monkeypatch on `smem_mods`). - **Negative 21-bit signed `OFFSET` (`0x100000..0x1fffff`):** clarified in `docs/experiments.md` (and the PR description) that hardware `s_load_*` sign-extends the 21-bit immediate, so refusing `0x100000..0x1fffff` here is an explicit translator gap (turning a silent `+1..2` MiB misread into a named `Unsupported`) rather than a permanent policy. - **`m0` on the destination-overlap check:** the `m0 + offset:0x10` loop in `controls()` already runs across all five `s_buffer_load_dword*` widths (`1`, `2`, `4`, `8`, `16`), where `reg_range('m0')` is `None` so the overlap branch is skipped; pinned that invariant explicitly with `assert len(st_m0.lines) == width and all(not line.startswith('a =') for line in st_m0.lines)`. AI-assisted.
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!1874
No description provided.