tooling: add a deterministic differential fuzz test for the CPU translators #440

Open
opened 2026-11-22 03:48:40 +00:00 by grahamster2 · 15 comments
grahamster2 commented 2026-11-22 03:48:40 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by grahamster2 on 2026-11-22T03:48:40Z.


Proposal

Add a deterministic differential fuzz test for the CPU translators to the suite, so every PR runs native code and its translation side by side on generated functions, not only on hand-written fixtures.

Why

Out-of-tree differential runs found these, none of which a fixture or CI caught:

  • #413: a jcc to its own fallthrough was accepted, but its translation did not compile (merged).
  • #418: two header layouts made pe_map fault inside the map, where LoadLibraryExW maps or refuses the file.
  • #425: after a call, frame bytes below the callee's home space stayed defined, so a reload returned the old value where native returns the return address (fixed before merge in b9935bc).
  • #420: released frame bytes kept their state (7fb6a9a adopted the rule).
  • #437 and its follow-up comment: dead guest reads removed at /O2 in three translators. @bosseurdinternet's execution tool found the first one.

The generators produce only forms each translator documents as accepted: leaf ALU at all widths, flags producer→consumer pairs, loops, frames with PUSH and MOV saves, spills at partial overlaps, mid-body RSP changes, chains of calls, shared callees and tail jumps. So a refusal of an accepted shape is reported as an over-refusal, and any value difference is a translator bug. Each function is assembled with ML64, translated, built with cl, and compared on RAX plus a 256-byte buffer over a few hundred inputs. Planted translator faults (a skipped volatile clobber, the wrong callee, a dropped flag) are detected.

Shape, for you to accept or narrow

  1. tools/fuzz_cpu.py, a source generator plus runner. It needs only ML64, link, cl and the existing Python environment, writes under out/, and adds no new dependency.
  2. CTest cpu_aot_fuzz_smoke: a few fixed seeds × about 20 functions per area (leaf, frames, calls), so it takes seconds in the Windows job and is deterministic. A failure prints the seed, the minimized MASM and native vs translated values.
  3. A manual long-run mode, documented in docs/experiments.md, for contributors to run before larger translator changes.
  4. Optional later: pe_map header mutation, x87 and shared-lifter areas, and a bad-pointer mode that checks fault equivalence (the #437 class).

Questions: is an in-tree fuzz test welcome, and with what CI time budget? Should the smoke test cover only cpu_switch_aot first? Should generated failures turn into fixed fixtures through a documented workflow, or stay seed-only?

I'd send it as one PR after your answer.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6538105844 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446). Originally posted by [grahamster2](https://github.com/grahamster2) on 2026-11-22T03:48:40Z. --- ## Proposal Add a deterministic differential fuzz test for the CPU translators to the suite, so every PR runs native code and its translation side by side on generated functions, not only on hand-written fixtures. ## Why Out-of-tree differential runs found these, none of which a fixture or CI caught: - #413: a `jcc` to its own fallthrough was accepted, but its translation did not compile (merged). - #418: two header layouts made `pe_map` fault inside the map, where `LoadLibraryExW` maps or refuses the file. - #425: after a call, frame bytes below the callee's home space stayed defined, so a reload returned the old value where native returns the return address (fixed before merge in `b9935bc`). - #420: released frame bytes kept their state (`7fb6a9a` adopted the rule). - #437 and its follow-up comment: dead guest reads removed at `/O2` in three translators. @bosseurdinternet's execution tool found the first one. The generators produce only forms each translator documents as accepted: leaf ALU at all widths, flags producer→consumer pairs, loops, frames with PUSH and MOV saves, spills at partial overlaps, mid-body RSP changes, chains of calls, shared callees and tail jumps. So a refusal of an accepted shape is reported as an over-refusal, and any value difference is a translator bug. Each function is assembled with ML64, translated, built with `cl`, and compared on RAX plus a 256-byte buffer over a few hundred inputs. Planted translator faults (a skipped volatile clobber, the wrong callee, a dropped flag) are detected. ## Shape, for you to accept or narrow 1. `tools/fuzz_cpu.py`, a source generator plus runner. It needs only ML64, `link`, `cl` and the existing Python environment, writes under `out/`, and adds no new dependency. 2. CTest `cpu_aot_fuzz_smoke`: a few fixed seeds × about 20 functions per area (leaf, frames, calls), so it takes seconds in the Windows job and is deterministic. A failure prints the seed, the minimized MASM and native vs translated values. 3. A manual long-run mode, documented in `docs/experiments.md`, for contributors to run before larger translator changes. 4. Optional later: `pe_map` header mutation, x87 and shared-lifter areas, and a bad-pointer mode that checks fault equivalence (the #437 class). Questions: is an in-tree fuzz test welcome, and with what CI time budget? Should the smoke test cover only `cpu_switch_aot` first? Should generated failures turn into fixed fixtures through a documented workflow, or stay seed-only? I'd send it as one PR after your answer.
RonLogic commented 2026-11-24 06:48:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RonLogic on 2026-11-22T12:10:35Z.


I measured the proposed CI budget with a local, source-built register-alias sample on Windows 11 build 26300.9974, x64 MSVC 19.52.37029.0, at 0f8e7fa. One ML64 DLL held all the generated exports. One translation and two C++ builds (/Od and /O2) compared RAX and 16 output bytes against native execution. The generated chains mixed partial-register ALU operations and shifts, then used one CMP for SETcc and CMOVcc.

Seed Functions Input pairs per function Assemble, translate, build both Compare both
0xA902 20 313 0.67 s 0.05 s
0xA902 96 313 0.94 s 0.12 s
0xCCD1 384 313 4.22 s 0.40 s

There were no differences in this leaf-only sample. Batching exports into one native DLL and one translation kept the small configuration under one second on this machine. Frame and call generation still need their own timing and diagnostics. This is a timing data point for your proposed harness.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7078927169 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7078927169). Originally posted by [RonLogic](https://github.com/RonLogic) on 2026-11-22T12:10:35Z. --- I measured the proposed CI budget with a local, source-built register-alias sample on Windows 11 build 26300.9974, x64 MSVC 19.52.37029.0, at `0f8e7fa`. One ML64 DLL held all the generated exports. One translation and two C++ builds (`/Od` and `/O2`) compared RAX and 16 output bytes against native execution. The generated chains mixed partial-register ALU operations and shifts, then used one CMP for SETcc and CMOVcc. | Seed | Functions | Input pairs per function | Assemble, translate, build both | Compare both | | --- | ---: | ---: | ---: | ---: | | `0xA902` | 20 | 313 | 0.67 s | 0.05 s | | `0xA902` | 96 | 313 | 0.94 s | 0.12 s | | `0xCCD1` | 384 | 313 | 4.22 s | 0.40 s | There were no differences in this leaf-only sample. Batching exports into one native DLL and one translation kept the small configuration under one second on this machine. Frame and call generation still need their own timing and diagnostics. This is a timing data point for your proposed harness. AI-assisted.
triggered02 commented 2026-11-24 06:49:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-23T16:18:31Z.


Opened #894 as the smoke shape discussed: 20 generated leaf functions on cpu_switch_aot, one native DLL, one translation, default and /O2 builds, 313 inputs each. Default run: 0.37 s and 12,520 comparisons in both dev and release. Long run: 96 functions at seed 0xCCD1, 1.09 s and 60,096 comparisons. Scope, seed, promotion path and follow-ups are in the PR. Happy to narrow the first smoke or adjust the seed/CI budget.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7106933173 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7106933173). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-23T16:18:31Z. --- Opened #894 as the smoke shape discussed: 20 generated leaf functions on `cpu_switch_aot`, one native DLL, one translation, default and `/O2` builds, 313 inputs each. Default run: 0.37 s and 12,520 comparisons in both dev and release. Long run: 96 functions at seed `0xCCD1`, 1.09 s and 60,096 comparisons. Scope, seed, promotion path and follow-ups are in the PR. Happy to narrow the first smoke or adjust the seed/CI budget. AI-assisted.
R0Y00 commented 2026-11-24 06:49:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T17:11:30Z.


#894 landed the first deterministic smoke. Both Windows jobs run it, and the reviewed commit independently matched 12,520 native/default/O2 comparisons for 20 generated leaf functions. The manual seed and function-count options are documented, and invalid reproduction filters now fail. This issue stays open for the proposed frame and call generators. A focused next fixture could start with fixed frames, include a saved/restored register and a partial spill overlap, and demonstrate a planted error before adding call graphs.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7108286843 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7108286843). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T17:11:30Z. --- #894 landed the first deterministic smoke. Both Windows jobs run it, and the reviewed commit independently matched 12,520 native/default/O2 comparisons for 20 generated leaf functions. The manual seed and function-count options are documented, and invalid reproduction filters now fail. This issue stays open for the proposed frame and call generators. A focused next fixture could start with fixed frames, include a saved/restored register and a partial spill overlap, and demonstrate a planted error before adding call graphs.
denn0x commented 2026-11-24 06:49:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by denn0x on 2026-11-23T17:18:33Z.


I'd like to take the fixed-frame generator suggested above, unless @triggered02 (who wrote #894) or @grahamster2 (who has the out-of-tree generators) already has it in progress. If so, I'll step back and review.

Scope: only the four items listed above.

  • Fixed RSP frames. PUSH of RBX, RSI, RDI and R12–R15, and SUB/ADD RSP by multiples of 8, with real .pushreg/.allocstack/.savereg unwind directives. There is no RBP anchor and no LEAVE, so #907 and #895 can change Frame without breaking it.
  • Saved and restored registers. Through PUSH/POP and through MSVC's MOV [rsp+8], rbx home-space save. Each register is overwritten from the arguments before use, so the generator never reads an entry value.
  • Partial spill overlaps. Stores of 8, 4, 2 and 1 bytes, read back as differently sized and offset pieces.
  • A planted error. A mutated translation shifts the frame index of one overlapping reload. The test fails unless that mutant gives at least one mismatch at the default seed. A dropped restore isn't visible in RAX and the buffer, as cpu_aot_stack_frames notes, so I won't use it.

It would be a separate CTest, cpu_aot_fuzz_frames, with its own seed stream. The existing smoke at 0xA902 keeps its 20 functions and 12,520 comparisons byte-identical. There are no calls or call graphs.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7108466298 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7108466298). Originally posted by [denn0x](https://github.com/denn0x) on 2026-11-23T17:18:33Z. --- I'd like to take the fixed-frame generator suggested above, unless @triggered02 (who wrote #894) or @grahamster2 (who has the out-of-tree generators) already has it in progress. If so, I'll step back and review. **Scope:** only the four items listed above. - **Fixed RSP frames.** `PUSH` of RBX, RSI, RDI and R12–R15, and `SUB`/`ADD RSP` by multiples of 8, with real `.pushreg`/`.allocstack`/`.savereg` unwind directives. There is no RBP anchor and no `LEAVE`, so #907 and #895 can change `Frame` without breaking it. - **Saved and restored registers.** Through `PUSH`/`POP` and through MSVC's `MOV [rsp+8], rbx` home-space save. Each register is overwritten from the arguments before use, so the generator never reads an entry value. - **Partial spill overlaps.** Stores of 8, 4, 2 and 1 bytes, read back as differently sized and offset pieces. - **A planted error.** A mutated translation shifts the frame index of one overlapping reload. The test fails unless that mutant gives at least one mismatch at the default seed. A dropped restore isn't visible in RAX and the buffer, as `cpu_aot_stack_frames` notes, so I won't use it. It would be a separate CTest, `cpu_aot_fuzz_frames`, with its own seed stream. The existing smoke at `0xA902` keeps its 20 functions and 12,520 comparisons byte-identical. There are no calls or call graphs. AI-assisted (Claude Code).
roansystemlabs commented 2026-11-24 06:50:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-24T01:29:15Z.


I'd like to take the next follow-up after #927: direct calls, unless @grahamster2 or @denn0x already has it in progress (if so, I'll step back and review).

Scope, one focused slice, no call graphs yet:

  • Direct calls and tail jumps between generated functions in one batched native DLL, using only shapes the jump-table translator documents as accepted (#425), with callees drawn from the existing leaf and fixed-frame generators.
  • Shared callees: two callers reaching the same callee with different arguments, and volatile registers clobbered across the call.
  • Planted error: a mutated translation that retargets one call to the wrong callee; the test fails unless that mutant produces at least one mismatch at the default seed.

It would be a separate CTest (cpu_aot_fuzz_calls) with its own seed stream, leaving cpu_aot_fuzz_smoke and cpu_aot_fuzz_frames byte-identical, with the same manual seed and function-count options as #927 and a docs/experiments.md paragraph with timings and comparison counts in dev and release. Recursion, indirect calls, mid-body RSP changes and fault equivalence stay out. Environment: Windows 11 26200, MSVC 19.44, dev and release presets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119147148 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7119147148). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-24T01:29:15Z. --- I'd like to take the next follow-up after #927: direct calls, unless @grahamster2 or @denn0x already has it in progress (if so, I'll step back and review). Scope, one focused slice, no call graphs yet: - **Direct calls and tail jumps** between generated functions in one batched native DLL, using only shapes the jump-table translator documents as accepted (#425), with callees drawn from the existing leaf and fixed-frame generators. - **Shared callees**: two callers reaching the same callee with different arguments, and volatile registers clobbered across the call. - **Planted error**: a mutated translation that retargets one call to the wrong callee; the test fails unless that mutant produces at least one mismatch at the default seed. It would be a separate CTest (`cpu_aot_fuzz_calls`) with its own seed stream, leaving `cpu_aot_fuzz_smoke` and `cpu_aot_fuzz_frames` byte-identical, with the same manual seed and function-count options as #927 and a `docs/experiments.md` paragraph with timings and comparison counts in dev and release. Recursion, indirect calls, mid-body RSP changes and fault equivalence stay out. Environment: Windows 11 26200, MSVC 19.44, `dev` and `release` presets. AI-assisted.
tedin7 commented 2026-11-24 06:50:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T01:30:09Z.


Claiming Stage 3 of the CPU fuzzer: a "calls" generator (call chains, shared callees, tail jumps) in tools/fuzz_cpu.py with a native-versus-lifted check and a --mutant negative control. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119161361 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7119161361). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T01:30:09Z. --- Claiming Stage 3 of the CPU fuzzer: a "calls" generator (call chains, shared callees, tail jumps) in tools/fuzz_cpu.py with a native-versus-lifted check and a --mutant negative control. Environment: Linux with LLVM 19 locally; I rely on the Ubuntu LLVM 15 job and the Windows WARP jobs for the rest. AI-assisted.
R0Y00 commented 2026-11-24 06:50:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T01:45:10Z.


@roansystemlabs, please take the first direct-call PR since your claim came in first. @tedin7, the two claims cover the same generator. Please coordinate on one PR. An independent review of the shared-callee and tail-jump cases, or a second run of the wrong-callee mutation, would be useful. Keep the existing seed streams unchanged and include one case where two callers reach the same callee with different values and observe the expected volatile-register clobbers.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119412291 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7119412291). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T01:45:10Z. --- @roansystemlabs, please take the first direct-call PR since your claim came in first. @tedin7, the two claims cover the same generator. Please coordinate on one PR. An independent review of the shared-callee and tail-jump cases, or a second run of the wrong-callee mutation, would be useful. Keep the existing seed streams unchanged and include one case where two callers reach the same callee with different values and observe the expected volatile-register clobbers.
roansystemlabs commented 2026-11-24 06:50:05 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-24T01:50:50Z.


Thanks, @R0Y00. I'll open the first direct-call PR shortly, with the shared-callee case extended so two callers reach the same callee with different values and the expected volatile-register clobbers are observed.

@tedin7, thanks for the parallel work in #1129. To end with one PR: would you review the shared-callee and tail-jump cases on mine and run the wrong-callee mutation independently on your Linux/LLVM setup? If your call-chain generator goes beyond what mine covers, it could follow as the next slice on top. I'll link the PR here as soon as it's up.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119501743 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7119501743). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-24T01:50:50Z. --- Thanks, @R0Y00. I'll open the first direct-call PR shortly, with the shared-callee case extended so two callers reach the same callee with different values and the expected volatile-register clobbers are observed. @tedin7, thanks for the parallel work in #1129. To end with one PR: would you review the shared-callee and tail-jump cases on mine and run the wrong-callee mutation independently on your Linux/LLVM setup? If your call-chain generator goes beyond what mine covers, it could follow as the next slice on top. I'll link the PR here as soon as it's up. AI-assisted.
roansystemlabs commented 2026-11-24 06:50:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-24T02:09:49Z.


The direct-call PR is up: https://github.com/R0Y00/Xbox2Windows/pull/1164

@tedin7, a review of the shared-callee and tail-jump cases or an independent run of the wrong-callee mutation on your setup would be very welcome there.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7119818184 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7119818184). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-24T02:09:49Z. --- The direct-call PR is up: https://github.com/R0Y00/Xbox2Windows/pull/1164 @tedin7, a review of the shared-callee and tail-jump cases or an independent run of the wrong-callee mutation on your setup would be very welcome there. AI-assisted.
RenzoWit35 commented 2026-11-24 11:03:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RenzoWit35 on 2026-11-24T10:52:06Z.


I'd like to take the mid-body RSP changes area, unless someone already has it in progress (if so, I'll step back and review).

Scope, one generator for cpu_switch_aot: --area rsp in tools/fuzz_cpu.py and a separate CTest, cpu_aot_fuzz_rsp, with its own seed (0xB0D1, 36 exports).

  • RSP moves after the prologue. SUB/ADD RSP by 8 to 48 bytes, PUSH/POP of saved registers that hold data, two branch arms that reach the same depth in different ways, a SUB RSP that aligns RSP for a direct call, and RBP-anchored frames that end with LEAVE or POP RBP. Stores and reloads reach the same frame bytes through different [RSP+d] and [RBP+d] displacements. The generator reads only bytes the translator treats as defined.
  • Refused controls. A reload of bytes that ADD RSP released, a join reached at two depths, a read below RSP, and SUB RSP, 4.
  • Planted error. A mutated translation resolves every [RSP+d] against the RSP left by the prologue's allocation, as if no later adjustment had moved RSP. The test fails unless that mutant gives at least one mismatch at the default seed.

The smoke, frames, calls, chains, switches and scalar_fp areas keep their seeds, and their emit output stays byte-identical. On #1329: the switch area has merged since it was listed, so this adds one AREAS and one MUTANTS entry and a separate CMake block after cpu_aot_fuzz_scalar_fp. No open PR touches tools/fuzz_cpu.py. x87, pe_map header mutation and bad-pointer fault equivalence stay out. Environment: Windows 11 build 26300, MSVC 19.51, ML64 14.51, dev and release presets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7129350581 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7129350581). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T10:52:06Z. --- I'd like to take the mid-body RSP changes area, unless someone already has it in progress (if so, I'll step back and review). Scope, one generator for `cpu_switch_aot`: `--area rsp` in `tools/fuzz_cpu.py` and a separate CTest, `cpu_aot_fuzz_rsp`, with its own seed (`0xB0D1`, 36 exports). - **RSP moves after the prologue.** `SUB`/`ADD RSP` by 8 to 48 bytes, `PUSH`/`POP` of saved registers that hold data, two branch arms that reach the same depth in different ways, a `SUB RSP` that aligns RSP for a direct call, and RBP-anchored frames that end with `LEAVE` or `POP RBP`. Stores and reloads reach the same frame bytes through different `[RSP+d]` and `[RBP+d]` displacements. The generator reads only bytes the translator treats as defined. - **Refused controls.** A reload of bytes that `ADD RSP` released, a join reached at two depths, a read below RSP, and `SUB RSP, 4`. - **Planted error.** A mutated translation resolves every `[RSP+d]` against the RSP left by the prologue's allocation, as if no later adjustment had moved RSP. The test fails unless that mutant gives at least one mismatch at the default seed. The smoke, frames, calls, chains, switches and scalar_fp areas keep their seeds, and their `emit` output stays byte-identical. On #1329: the switch area has merged since it was listed, so this adds one `AREAS` and one `MUTANTS` entry and a separate CMake block after `cpu_aot_fuzz_scalar_fp`. No open PR touches `tools/fuzz_cpu.py`. x87, `pe_map` header mutation and bad-pointer fault equivalence stay out. Environment: Windows 11 build 26300, MSVC 19.51, ML64 14.51, `dev` and `release` presets. AI-assisted.
roansystemlabs commented 2026-11-24 12:03:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-24T11:14:38Z.


Claiming the loops area next. It isn't covered by an open PR or a claim here; if someone already has it in progress, I'll step back and review instead.

Scope, one generator for cpu_switch_aot: --area loops in tools/fuzz_cpu.py and a separate CTest, cpu_aot_fuzz_loops, with its own seed so the existing seed streams stay unchanged.

  • Counted loops with a backward conditional branch, loop-carried values in registers and in the 256-byte buffer, data-dependent early exits, and one nested loop, all bounded so every input terminates.
  • Native vs default vs /O2 comparison on RAX plus the buffer, as in the other areas.
  • A planted translator fault (--mutant, a retargeted back edge) that must report mismatches, as the negative control.

I'll verify it on Windows 11 with MSVC 19.44 in Debug and Release, with several runs and the exact CTest filter in the PR.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7129845006 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7129845006). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-24T11:14:38Z. --- Claiming the **loops** area next. It isn't covered by an open PR or a claim here; if someone already has it in progress, I'll step back and review instead. Scope, one generator for `cpu_switch_aot`: `--area loops` in `tools/fuzz_cpu.py` and a separate CTest, `cpu_aot_fuzz_loops`, with its own seed so the existing seed streams stay unchanged. - Counted loops with a backward conditional branch, loop-carried values in registers and in the 256-byte buffer, data-dependent early exits, and one nested loop, all bounded so every input terminates. - Native vs default vs `/O2` comparison on RAX plus the buffer, as in the other areas. - A planted translator fault (`--mutant`, a retargeted back edge) that must report mismatches, as the negative control. I'll verify it on Windows 11 with MSVC 19.44 in Debug and Release, with several runs and the exact CTest filter in the PR. AI-assisted.
R0Y00 commented 2026-11-24 12:03:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T11:22:57Z.


The bounded loops generator can proceed independently of #1409's mid-body RSP cases. Please use a distinct seed and preserve the existing generators' emitted cases. In the back-edge control, keep execution bounded even under the mutation, then require a native/AOT mismatch at the fixed test seed. If both PRs touch the same CMake or generator registration, let's update the second after #1409 lands.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7130023965 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7130023965). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T11:22:57Z. --- The bounded loops generator can proceed independently of #1409's mid-body RSP cases. Please use a distinct seed and preserve the existing generators' emitted cases. In the back-edge control, keep execution bounded even under the mutation, then require a native/AOT mismatch at the fixed test seed. If both PRs touch the same CMake or generator registration, let's update the second after #1409 lands.
RenzoWit35 commented 2026-11-24 17:02:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by RenzoWit35 on 2026-11-24T16:44:01Z.


I'd like to take the x87 area, which has no claim or PR yet. If someone already has it in progress, I'll step back and review.

Scope: --area x87 in tools/fuzz_cpu.py and a separate CTest, cpu_aot_fuzz_x87, with its own seed (0x8087, 40 exports). It emits straight-line code through the x87 profile of the shared lowering (ffx_version_query.lower with x87=True): loads of floats, integers, constants and ST(i), arithmetic in every operand form, unary operations, stores, FCOMI with SETcc, status-word compares through FNSTSW AX, and FCMOVcc. The generator tracks the stack depth, so nothing overflows or underflows. Four refused controls are included, and a planted mutant that lowers FSUBR as FSUB must be detected.

The existing areas' seeds, MASM output and translations stay byte-identical. It leaves out FXTRACT, FSCALE, the checked entry (FLDCW, FNINIT, FPREM, FBLD), FFREE, and x87 state across branches or calls.

Environment: Windows 11 build 26300, MSVC 14.51 / ML64 14.51, dev and release presets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7138122810 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7138122810). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T16:44:01Z. --- I'd like to take the x87 area, which has no claim or PR yet. If someone already has it in progress, I'll step back and review. Scope: `--area x87` in `tools/fuzz_cpu.py` and a separate CTest, `cpu_aot_fuzz_x87`, with its own seed (`0x8087`, 40 exports). It emits straight-line code through the x87 profile of the shared lowering (`ffx_version_query.lower` with `x87=True`): loads of floats, integers, constants and ST(i), arithmetic in every operand form, unary operations, stores, `FCOMI` with `SETcc`, status-word compares through `FNSTSW AX`, and `FCMOVcc`. The generator tracks the stack depth, so nothing overflows or underflows. Four refused controls are included, and a planted mutant that lowers `FSUBR` as `FSUB` must be detected. The existing areas' seeds, MASM output and translations stay byte-identical. It leaves out `FXTRACT`, `FSCALE`, the checked entry (`FLDCW`, `FNINIT`, `FPREM`, `FBLD`), `FFREE`, and x87 state across branches or calls. Environment: Windows 11 build 26300, MSVC 14.51 / ML64 14.51, `dev` and `release` presets. AI-assisted.
roansystemlabs commented 2026-11-24 18:02:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by roansystemlabs on 2026-11-24T17:34:57Z.


Claiming a bits area next. It isn't covered by an open PR or a claim here; if someone already has it in progress, I'll step back and review instead.

Scope, one generator for cpu_switch_aot: --area bits in tools/fuzz_cpu.py and a separate CTest, cpu_aot_fuzz_bits, with its own seed so the existing seed streams and emitted cases stay unchanged.

  • BT/BTS/BTR/BTC on register and memory bases with register and immediate offsets, read only through B/AE; POPCNT, LZCNT and TZCNT with only the conditions the translator documents; BSF/BSR including a zero source (destination left unchanged); BSWAP at 32 and 64 bits; flags from SHL/SHR/SAR by an immediate.
  • Refused controls for the documented limits (a register bit offset into memory, a condition the producer leaves undefined, a shift count whose CF is undefined).
  • A planted translator fault that must report a native/AOT mismatch at the fixed test seed.

Verification on Windows 11 with MSVC 19.44 (Intel i7-10700, BMI1/ABM present), Debug and Release, several runs, with the exact CTest filter in the PR. If it ends up touching the same registration as #1667, I'll rebase after that lands.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7139407793 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7139407793). Originally posted by [roansystemlabs](https://github.com/roansystemlabs) on 2026-11-24T17:34:57Z. --- Claiming a **bits** area next. It isn't covered by an open PR or a claim here; if someone already has it in progress, I'll step back and review instead. Scope, one generator for `cpu_switch_aot`: `--area bits` in `tools/fuzz_cpu.py` and a separate CTest, `cpu_aot_fuzz_bits`, with its own seed so the existing seed streams and emitted cases stay unchanged. - BT/BTS/BTR/BTC on register and memory bases with register and immediate offsets, read only through B/AE; POPCNT, LZCNT and TZCNT with only the conditions the translator documents; BSF/BSR including a zero source (destination left unchanged); BSWAP at 32 and 64 bits; flags from SHL/SHR/SAR by an immediate. - Refused controls for the documented limits (a register bit offset into memory, a condition the producer leaves undefined, a shift count whose CF is undefined). - A planted translator fault that must report a native/AOT mismatch at the fixed test seed. Verification on Windows 11 with MSVC 19.44 (Intel i7-10700, BMI1/ABM present), Debug and Release, several runs, with the exact CTest filter in the PR. If it ends up touching the same registration as #1667, I'll rebase after that lands. AI-assisted.
louisdibiasi commented 2026-11-25 01:01:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by louisdibiasi on 2026-11-24T23:14:06Z.


I'd like to investigate the register-offset memory forms of BT, BTS, BTR and BTC in cpu_switch_aot. #1209 left this bit-string addressing as a follow-up; the existing cpu_aot_switch_bit_tests fixture currently checks that it is refused. I plan a source-built native-versus-translated fixture for signed offsets across word boundaries, carry, memory writes and adjacent bytes, with a planted addressing fault as a negative control. I'll preserve refusal for any forms whose frame or fault semantics I cannot model.

I see that #1784 adds a fuzzing refusal control for the same form. If that PR is still open when this is ready, I'll coordinate the control and shared lifter changes with its author; if someone is already implementing the lowering, I'll step back. I haven't identified a measured startup blocker for this form, so I am not claiming one.

Environment: x64 Windows 11, MSVC and the project's local Python environment. AI-assisted (Codex).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7147168150 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/446#issuecomment-7147168150). Originally posted by [louisdibiasi](https://github.com/louisdibiasi) on 2026-11-24T23:14:06Z. --- I'd like to investigate the register-offset memory forms of BT, BTS, BTR and BTC in `cpu_switch_aot`. #1209 left this bit-string addressing as a follow-up; the existing `cpu_aot_switch_bit_tests` fixture currently checks that it is refused. I plan a source-built native-versus-translated fixture for signed offsets across word boundaries, carry, memory writes and adjacent bytes, with a planted addressing fault as a negative control. I'll preserve refusal for any forms whose frame or fault semantics I cannot model. I see that #1784 adds a fuzzing refusal control for the same form. If that PR is still open when this is ready, I'll coordinate the control and shared lifter changes with its author; if someone is already implementing the lowering, I'll step back. I haven't identified a measured startup blocker for this form, so I am not claiming one. Environment: x64 Windows 11, MSVC and the project's local Python environment. AI-assisted (Codex).
Sign in to join this conversation.
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#440
No description provided.