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
No Branch/Tag specified
main
codex/indirect-large-backed-views
codex/word3-preflight-check
codex/vertex-table-two-records
codex/live-index-alias
codex/copied-vertex-buffer-srv
codex/windows-stage-test-output
codex/preserve-live-srv-retirement
codex/share-render-target-tracking
codex/sgd5-negative-offset-fixture
coverage-dashboard
codex/mesh-loose-root
codex/mesh86-cache-padding
codex/xmem-scatter-preflight
codex/mesh-depth-ps
codex/indirect-dispatch-refresh
codex/compute-container-index
codex/startup-compute-formatted-load
codex/compute-indirect-producer
codex/compute-atomic-soffset
codex/mesh-dual-handoff
codex/startup-run-sh-watcher-control
codex/queue31-page-alias
codex/indexed-indirect-compute-root
codex/typed-buffer-view-metadata
codex/translated-indexed-address-alias
codex/fixed-mesh-create-result
codex/xmem-section-lease
codex/startup-slot86-mesh-cache
codex/restore-mesh-barrier-iteration
codex/translated-indirect-upload-index
codex/xapu-completion-opt-in
codex/translated-indexed-rect
codex/translated-indexed-indirect
codex/startup-mesh-lds-integration
codex/startup-console-ms24
codex/startup-slot57-mesh-request
codex/indirect-copy-provenance
codex/present-color-producer-trace
codex/compute-dispatch-binding-trace
codex/translated-indirect-table-buffers
codex/indirect-copy-provenance-base
codex/mix-half-literal-source
codex/translated-indirect-draw
codex/xmem-scatter-diagnostics
codex/slot148-recording-upload
codex/slot70-loading-art-verified
codex/command-list-upload-arena
codex/recover-failed-command-list
codex/startup-heap-timing-notes
codex/align-audio-input-timeline
codex/synthetic-depth-export-control
codex/startup-texture1d-on-windows
codex/1629-packed-position-fixture
codex/cpu-srv-refresh
codex/stream-root-srv-draw
codex/audio-mixer-timer
codex/startup-reload-published-shader
codex/priority-integrate-1284
codex/guest-sixteen-page-record
codex/aot-placed-dxr-batch
codex/guest-directory-selection
codex/gamesave-enumerate-read
codex/readme-archive-to-pixels
codex/pe-placed-view-draw
codex/archive-directory-gpu
codex/slot133-dxr-build
codex/materialize-placed-vertex-view
codex/dstorage-directory-offsets
codex/xg-nine-bc-copy
codex/xg-slot10-bc64-arrays
codex/dxr-guest-address-readback
codex/gpu-va-high-bits
codex/clarify-diagnostic-startup-scope
codex/xg-six-levels
codex/typed-derived-blend
codex/english-legal-text-progress
codex/address-bc-4ks
codex/dstorage-bounded-file-read
codex/wide-srv-offsets-menu
codex/startup-memory-srv
codex/bound-view-tail
codex/language-selector-readback
codex/setup-menu-progress
codex/cpu-plane-refresh
codex/startup-ubyte-vertex
codex/presenter-window-selection
codex/startup-uniform-buffer-lane
codex/intro-loop-timing
codex/static-clzero-loops
codex/document-rtx-intro
codex/startup-insertq
codex/nv12-startup-texture
codex/stream-stage-draw
codex/startup-null-uav-format
codex/startup-draw-capture
codex/shorten-windows-checks
codex/dstorage-rfc1950
codex/startup-dump-fence
codex/pr1135-review-base
codex/startup-stream-requests
codex/startup-chroma-view
codex/readme-graphics-pipeline-streams
codex/static-crt-free-tls
codex/arc-140t-rtx-5080-laptop-gpu-reports
codex/main-startup-progress-entry
codex/signed-dxil-catalogue
codex/reloc-free-preferred-base
codex/quad-dpp-bit-mask
codex/raw-srv-bounds
codex/rx9070-31044-hardware-report
codex/gpu-page-source-provenance
codex/runtime-placeholder-interior
codex/gpu-copy-queue-tile-order
codex/pe-pin-external-providers
codex/xmem-placeholder-reservations
codex/xmem-shared-physical-pages
codex/pe-package-startup
codex/xmem-tools-memory-query
codex/cpu-stack-output-import
codex/pe-load-security-cookie
codex/record-three-bvh-retests
codex/cpu-rbp-frame-anchor
codex/xmem-default-startup
codex/record-rtx-3050-ti-9597
codex/docs-readme-start-here
codex/check-compute-mad24-truncation
codex/docs-discord-community
codex/bound-rcx-branch-mutants
codex/rtx5060ti-bvh-62114
codex/837-neutral-readme-disclaimer
codex/record-rtx-3070-ti
codex/title-neutral-public-wording
codex/exe-shadow-frame-submissions
codex/exe-shadow-runtime-chain
codex/readme-polish
codex/gpu-coverage-nov23
codex/spirv-minlod
codex/shadow-shim-device
codex/exe-two-shadow-frames
codex/shim-dispatch-cleanup
codex/fix-spirv-cache-probe
codex/sampler-use
codex/ballot-bit-extract
codex/packed-fma-release
codex/cpu-packed-fma-o2
codex/publish-coverage-dashboard
codex/mesh-cbv-binding-order
codex/spirv-window-fixture
codex/ps-e32-float-uint
codex/ps-cbuffer-reads
codex/fixed-profile-rescan
codex/shim-compute-integration
codex/readme-visible-coverage
codex/readme-research-navigation
codex/integrate-pr-256
codex/indexed-mesh
codex/sampled-coverage
codex/first-ms
codex/dual-ps
codex/ps-attribute
codex/compute-first
codex/ps-export
codex/readme-research-status
codex/ps-layout
codex/blast-window
codex/chart-caption
codex/reviewer-roles
codex/blast-aot
codex/archive-program
codex/crc-stream-program
codex/exe-image-data-chain
codex/local-cpu-fixture-coverage
codex/exe-bound-frame-chain
codex/exe-mapped-comparison
codex/contribution-dependencies
codex/exe-entry-aot
codex/bink-frame-heap-integration
docs/hardware-seven-reports
codex/bink-custom-heap
codex/bink-heap-callers
codex/discussions-entry-points
codex/gpu-community-batch-64
codex/ffx-scratch-writers
codex/generic-project-documentation
codex/ffx-dispatch-rcas
codex/four-windows-gpu-reports
codex/title-neutral-project-wording
codex/community-coverage-provenance
codex/rcas-packed-texels
codex/community-gpu-retests
codex/community-build-and-gpu-reports
codex/ffx-provider-loop
codex/ffx-recurrent-views
codex/ffx-recurrent-resource
codex/amd-wave64-reports
codex/ffx-backend-slots
codex/upscaler-device-init
codex/ffx-context-lifecycle
codex/ffx-version-query
codex/ffx-provider-contract
codex/typed-object-callback
codex/cpu-ordinal-import
codex/chained-cpu-ranges
codex/cpu-import-call
codex/cpu-direct-call
codex/cpu-leaf-aot
codex/community-project-status
codex/script-state-path-replay
codex/script-state-evidence
codex/bc7-resident-tail
codex/bcpack-mip-tail
codex/bc7-texture-draw
codex/asset-ranges
codex/pixel-constants
codex/pixel-aot
codex/pre-exe-workloads
codex/root-signature-device-coverage
engineering/packed-bvh-leaves
engineering/bvh-build-and-update
engineering/intake-root-roundtrip
community/gpu-check-release
community/english-contributor-entry
gpu-check-v0.1.0
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
jccto its own fallthrough was accepted, but its translation did not compile (merged).pe_mapfault inside the map, whereLoadLibraryExWmaps or refuses the file.b9935bc).7fb6a9aadopted the rule)./O2in 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
tools/fuzz_cpu.py, a source generator plus runner. It needs only ML64,link,cland the existing Python environment, writes underout/, and adds no new dependency.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.docs/experiments.md, for contributors to run before larger translator changes.pe_mapheader 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_aotfirst? 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.
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 (/Odand/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.0xA9020xA9020xCCD1There 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.
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/O2builds, 313 inputs each. Default run: 0.37 s and 12,520 comparisons in both dev and release. Long run: 96 functions at seed0xCCD1, 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.
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.
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.
PUSHof RBX, RSI, RDI and R12–R15, andSUB/ADD RSPby multiples of 8, with real.pushreg/.allocstack/.saveregunwind directives. There is no RBP anchor and noLEAVE, so #907 and #895 can changeFramewithout breaking it.PUSH/POPand through MSVC'sMOV [rsp+8], rbxhome-space save. Each register is overwritten from the arguments before use, so the generator never reads an entry value.cpu_aot_stack_framesnotes, so I won't use it.It would be a separate CTest,
cpu_aot_fuzz_frames, with its own seed stream. The existing smoke at0xA902keeps its 20 functions and 12,520 comparisons byte-identical. There are no calls or call graphs.AI-assisted (Claude Code).
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:
It would be a separate CTest (
cpu_aot_fuzz_calls) with its own seed stream, leavingcpu_aot_fuzz_smokeandcpu_aot_fuzz_framesbyte-identical, with the same manual seed and function-count options as #927 and adocs/experiments.mdparagraph 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,devandreleasepresets.AI-assisted.
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.
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.
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.
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.
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 rspintools/fuzz_cpu.pyand a separate CTest,cpu_aot_fuzz_rsp, with its own seed (0xB0D1, 36 exports).SUB/ADD RSPby 8 to 48 bytes,PUSH/POPof saved registers that hold data, two branch arms that reach the same depth in different ways, aSUB RSPthat aligns RSP for a direct call, and RBP-anchored frames that end withLEAVEorPOP 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.ADD RSPreleased, a join reached at two depths, a read below RSP, andSUB RSP, 4.[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
emitoutput stays byte-identical. On #1329: the switch area has merged since it was listed, so this adds oneAREASand oneMUTANTSentry and a separate CMake block aftercpu_aot_fuzz_scalar_fp. No open PR touchestools/fuzz_cpu.py. x87,pe_mapheader mutation and bad-pointer fault equivalence stay out. Environment: Windows 11 build 26300, MSVC 19.51, ML64 14.51,devandreleasepresets.AI-assisted.
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 loopsintools/fuzz_cpu.pyand a separate CTest,cpu_aot_fuzz_loops, with its own seed so the existing seed streams stay unchanged./O2comparison on RAX plus the buffer, as in the other areas.--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.
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.
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 x87intools/fuzz_cpu.pyand 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.lowerwithx87=True): loads of floats, integers, constants and ST(i), arithmetic in every operand form, unary operations, stores,FCOMIwithSETcc, status-word compares throughFNSTSW AX, andFCMOVcc. The generator tracks the stack depth, so nothing overflows or underflows. Four refused controls are included, and a planted mutant that lowersFSUBRasFSUBmust 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,
devandreleasepresets.AI-assisted.
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 bitsintools/fuzz_cpu.pyand a separate CTest,cpu_aot_fuzz_bits, with its own seed so the existing seed streams and emitted cases stay unchanged.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.
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 existingcpu_aot_switch_bit_testsfixture 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).