cpu: add dedicated cpu_amd_monitor_rdpru_aot lifter for MONITORX, MWAITX, and RDPRU #2422

Merged
Ammmae0x merged 5 commits from upstream-pr/2430 into main 2026-11-27 22:14:53 +00:00
Ammmae0x commented 2026-11-25 16:33:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-25T16:33:19Z.


Change

Add a dedicated standalone AOT lifter (tools/cpu_amd_monitor_rdpru_aot.py) for the three AMD Zen 2 user-mode instructions MONITORX (0F 01 FA), MWAITX (0F 01 FB), and RDPRU (0F 01 FD), together with a source-built MASM differential fixture (tests/cpu/amd_monitor_rdpru_aot.{asm,def}), verification suite (tests/cpu/amd_monitor_rdpru_aot_check.py), and CTest registration (cpu_aot_amd_monitor_rdpru in CMakeLists.txt).

  • Supported AMD user-mode instructions (std::uint64_t lifted_<name>(word rcx, word rdx, word r8)):
    • RDPRU (0F 01 FD): statically validates ECX in {0, 1} (0 = MPERF, 1 = APERF), reads a volatile monotonic 64-bit counter with std::atomic_signal_fence(std::memory_order_seq_cst) (preventing /O2 CSE across repeated reads and DCE of overwritten reads), zero-extends EAX -> RAX and EDX -> RDX, and preserves RCX and RFLAGS.
    • MONITORX (0F 01 FA): requires a proven flat caller-owned [rcx|rdx|r8] linear address in RAX and statically proven ECX == 0, EDX == 0; probes 1-byte readability (preserving #PF fault ordering relative to surrounding [r8] stores) while preserving all GPRs and RFLAGS.
    • MWAITX (0F 01 FB): requires defined RAX hints and statically validated ECX in {0, 1} (rejecting ECX[1] timer mode, which implicitly reads nonvolatile EBX, and all reserved bits ECX[31:2]); emits a fenced PAUSE wait hint preserving GPRs, RFLAGS, and surrounding store ordering.
  • Bounded volatile GPR transport: mov (reg-reg, reg-imm, bounded 64-byte [r8 + disp] 32/64-bit stores), lea r64, [rcx|rdx|r8], xor/or/shl/add/cmp (32/64-bit with CF/ZF/SF/OF model), setb/sete/sets/seto, and terminal ret.
  • Fail-closed rejections: rejects MONITOR/MWAIT/RDTSC/RDTSCP, 16/32-bit MONITORX address-size overrides, VEX/EVEX/non-legacy/vector encodings, nonvolatile GPRs, undefined/out-of-range ECX on RDPRU, non-flat/unowned RAX or non-zero/undefined ECX/EDX on MONITORX, undefined/timer/reserved ECX on MWAITX, undefined GPR/flag reads, stores outside [r8] or beyond 64 bytes, branches, prefixes, missing ret, and trailing instructions after ret.

Verification

Verified on rebased commit 0cc1337a (based on upstream/main b442b57f) in both dev (Debug + explicit /O2 /W4 /LD target) and release (/O2) presets:

  • cmake --build --preset dev --target cpu_amd_monitor_rdpru_aot_original cpu_amd_monitor_rdpru_aot_original_lifted cpu_amd_monitor_rdpru_aot_original_lifted_o2 cpu_amd_monitor_rdpru_aot_altered cpu_amd_monitor_rdpru_aot_altered_lifted -> exit 0 (0 /W4 warnings on /O2).
  • ctest --preset dev -R "^cpu_aot_amd_monitor_rdpru$" -E "cpu_native_archive_" --output-on-failure -V -> all unconditional checks passed (6 AMD MONITORX/MWAITX/RDPRU sequences accepted; 41 rejection controls passed; /O2 disassembly verified: RDPRU anti-CSE (2 reads in twice), anti-DCE (1 read in unused), MWAITX PAUSE barriers kept; lifted Debug (555 checks) + /O2 (555 checks) + NULL fault-ordering passed; 6 altered-build + 5 mutant controls caught); capability skip (exit 77) on native AMD differential because host lacks CPUID Fn8000_0001:ECX[29] (MWAITX=0) and Fn8000_0008:EBX[4] (RDPRU=0).
  • cmake --build --preset release --target cpu_amd_monitor_rdpru_aot_original cpu_amd_monitor_rdpru_aot_original_lifted cpu_amd_monitor_rdpru_aot_original_lifted_o2 cpu_amd_monitor_rdpru_aot_altered cpu_amd_monitor_rdpru_aot_altered_lifted -> exit 0.
  • ctest --preset release -R "^cpu_aot_amd_monitor_rdpru$" -E "cpu_native_archive_" --output-on-failure -V -> identical unconditional pass (6/41, /O2 barriers, 555 + 555 + NULL fault + 6 altered + 5 mutants), capability skip (exit 77) on native AMD differential.
  • out/pe-env/Scripts/python.exe -B tests/form_coverage_check.py -> form coverage checks passed (exit 0).
  • out/pe-env/Scripts/python.exe -B tests/docs_links_check.py -> Self-test passed. Checked 19 Markdown files and 465 links. (exit 0).
  • out/pe-env/Scripts/python.exe -B tests/bidi_controls_check.py -> Self-test passed. Checked 1729 tracked source, script and build/CI files: no bidirectional controls. (exit 0).
  • Spot mutation audit on tools/cpu_amd_monitor_rdpru_aot.py: 8/8 mutations killed (each exit 1, verified neither 0 nor 77) across translator guards (RDPRU out-of-range ECX, MWAITX ECX[1] timer guard, MONITORX flat-pointer guard, legacy MONITOR/MWAIT/RDTSC/RDTSCP rejection) and rebuilt C++ / /O2 semantics (RDPRU 32->64 zero extension, MWAITX PAUSE barrier, MONITORX readability probe, RDPRU lo/hi swap).

Evidence and follow-up

All fixtures (tests/cpu/amd_monitor_rdpru_aot.asm, .def, _check.py) are source-built under the repository MIT license with ; coverage: record cpu_aot_amd_monitor_rdpru and ALTER_AMD_EXT altered-build controls; no external binaries or game files are used. On non-AMD hosts lacking MWAITX/RDPRU, all translator, /O2 disassembly, lifted Debug//O2, fault-ordering, altered-build, and mutant checks run unconditionally before returning exit 77 without writing FORM_COVERAGE_RECORD; on AMD Zen 2+ hosts with both CPUID bits set, the native differential suite also runs and records covered forms. Contributors can run ctest --preset dev -R "^cpu_aot_amd_monitor_rdpru$" -V (or --preset release).

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:5495187762 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-25T16:33:19Z. --- ## Change Add a dedicated standalone AOT lifter (`tools/cpu_amd_monitor_rdpru_aot.py`) for the three AMD Zen 2 user-mode instructions `MONITORX` (`0F 01 FA`), `MWAITX` (`0F 01 FB`), and `RDPRU` (`0F 01 FD`), together with a source-built MASM differential fixture (`tests/cpu/amd_monitor_rdpru_aot.{asm,def}`), verification suite (`tests/cpu/amd_monitor_rdpru_aot_check.py`), and CTest registration (`cpu_aot_amd_monitor_rdpru` in `CMakeLists.txt`). - **Supported AMD user-mode instructions (`std::uint64_t lifted_<name>(word rcx, word rdx, word r8)`)**: - `RDPRU` (`0F 01 FD`): statically validates `ECX in {0, 1}` (`0` = MPERF, `1` = APERF), reads a volatile monotonic 64-bit counter with `std::atomic_signal_fence(std::memory_order_seq_cst)` (preventing `/O2` CSE across repeated reads and DCE of overwritten reads), zero-extends `EAX -> RAX` and `EDX -> RDX`, and preserves `RCX` and `RFLAGS`. - `MONITORX` (`0F 01 FA`): requires a proven flat caller-owned `[rcx|rdx|r8]` linear address in `RAX` and statically proven `ECX == 0`, `EDX == 0`; probes 1-byte readability (preserving `#PF` fault ordering relative to surrounding `[r8]` stores) while preserving all GPRs and `RFLAGS`. - `MWAITX` (`0F 01 FB`): requires defined `RAX` hints and statically validated `ECX in {0, 1}` (rejecting `ECX[1]` timer mode, which implicitly reads nonvolatile `EBX`, and all reserved bits `ECX[31:2]`); emits a fenced `PAUSE` wait hint preserving GPRs, `RFLAGS`, and surrounding store ordering. - **Bounded volatile GPR transport**: `mov` (reg-reg, reg-imm, bounded 64-byte `[r8 + disp]` 32/64-bit stores), `lea r64, [rcx|rdx|r8]`, `xor`/`or`/`shl`/`add`/`cmp` (32/64-bit with CF/ZF/SF/OF model), `setb`/`sete`/`sets`/`seto`, and terminal `ret`. - **Fail-closed rejections**: rejects `MONITOR`/`MWAIT`/`RDTSC`/`RDTSCP`, 16/32-bit `MONITORX` address-size overrides, VEX/EVEX/non-legacy/vector encodings, nonvolatile GPRs, undefined/out-of-range `ECX` on `RDPRU`, non-flat/unowned `RAX` or non-zero/undefined `ECX`/`EDX` on `MONITORX`, undefined/timer/reserved `ECX` on `MWAITX`, undefined GPR/flag reads, stores outside `[r8]` or beyond 64 bytes, branches, prefixes, missing `ret`, and trailing instructions after `ret`. ## Verification Verified on rebased commit `0cc1337a` (based on `upstream/main` `b442b57f`) in both `dev` (Debug + explicit `/O2 /W4 /LD` target) and `release` (`/O2`) presets: - `cmake --build --preset dev --target cpu_amd_monitor_rdpru_aot_original cpu_amd_monitor_rdpru_aot_original_lifted cpu_amd_monitor_rdpru_aot_original_lifted_o2 cpu_amd_monitor_rdpru_aot_altered cpu_amd_monitor_rdpru_aot_altered_lifted` -> exit 0 (0 `/W4` warnings on `/O2`). - `ctest --preset dev -R "^cpu_aot_amd_monitor_rdpru$" -E "cpu_native_archive_" --output-on-failure -V` -> all unconditional checks passed (`6 AMD MONITORX/MWAITX/RDPRU sequences accepted; 41 rejection controls passed`; `/O2 disassembly verified: RDPRU anti-CSE (2 reads in twice), anti-DCE (1 read in unused), MWAITX PAUSE barriers kept`; `lifted Debug (555 checks) + /O2 (555 checks) + NULL fault-ordering passed; 6 altered-build + 5 mutant controls caught`); capability skip (exit 77) on native AMD differential because host lacks `CPUID Fn8000_0001:ECX[29]` (MWAITX=0) and `Fn8000_0008:EBX[4]` (RDPRU=0). - `cmake --build --preset release --target cpu_amd_monitor_rdpru_aot_original cpu_amd_monitor_rdpru_aot_original_lifted cpu_amd_monitor_rdpru_aot_original_lifted_o2 cpu_amd_monitor_rdpru_aot_altered cpu_amd_monitor_rdpru_aot_altered_lifted` -> exit 0. - `ctest --preset release -R "^cpu_aot_amd_monitor_rdpru$" -E "cpu_native_archive_" --output-on-failure -V` -> identical unconditional pass (`6/41`, `/O2` barriers, `555 + 555 + NULL fault + 6 altered + 5 mutants`), capability skip (exit 77) on native AMD differential. - `out/pe-env/Scripts/python.exe -B tests/form_coverage_check.py` -> `form coverage checks passed` (exit 0). - `out/pe-env/Scripts/python.exe -B tests/docs_links_check.py` -> `Self-test passed. Checked 19 Markdown files and 465 links.` (exit 0). - `out/pe-env/Scripts/python.exe -B tests/bidi_controls_check.py` -> `Self-test passed. Checked 1729 tracked source, script and build/CI files: no bidirectional controls.` (exit 0). - Spot mutation audit on `tools/cpu_amd_monitor_rdpru_aot.py`: 8/8 mutations killed (each exit 1, verified neither 0 nor 77) across translator guards (`RDPRU` out-of-range `ECX`, `MWAITX` `ECX[1]` timer guard, `MONITORX` flat-pointer guard, legacy `MONITOR`/`MWAIT`/`RDTSC`/`RDTSCP` rejection) and rebuilt C++ / `/O2` semantics (`RDPRU` 32->64 zero extension, `MWAITX` `PAUSE` barrier, `MONITORX` readability probe, `RDPRU` lo/hi swap). ## Evidence and follow-up All fixtures (`tests/cpu/amd_monitor_rdpru_aot.asm`, `.def`, `_check.py`) are source-built under the repository MIT license with `; coverage: record cpu_aot_amd_monitor_rdpru` and `ALTER_AMD_EXT` altered-build controls; no external binaries or game files are used. On non-AMD hosts lacking `MWAITX`/`RDPRU`, all translator, `/O2` disassembly, lifted Debug/`/O2`, fault-ordering, altered-build, and mutant checks run unconditionally before returning exit 77 without writing `FORM_COVERAGE_RECORD`; on AMD Zen 2+ hosts with both CPUID bits set, the native differential suite also runs and records covered forms. Contributors can run `ctest --preset dev -R "^cpu_aot_amd_monitor_rdpru$" -V` (or `--preset release`). ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
tedin7 commented 2026-11-25 18:23:11 +00:00 (Migrated from github.com)

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

Review: COMMENTED


Review of head 0cc1337a (tooling plus tests: new tools/cpu_amd_monitor_rdpru_aot.py, tests/cpu/amd_monitor_rdpru_aot.asm/.def, tests/cpu/amd_monitor_rdpru_aot_check.py, CMakeLists.txt).

No author Windows results are posted on this PR, so none were checked. I ran no Windows tests, and the new CTest needs the MSVC-built DLLs, so I could not run it on Linux either.

What I checked:

  • No other open or merged PR adds an AOT lifter for these opcodes. #1312 and docs/startup-runtime.md (line 2363 onward) cover the startup host-CPU fallback, which is a different path.
  • The CMake wiring follows the sibling lifters (original/altered fixtures, cpu_translation, an O2 build, FORM_COVERAGE_RECORD, SKIP_RETURN_CODE 77).
  • The lifter rejects the unsafe cases listed in its docstring (timer-mode MWAITX, undefined or out-of-range RDPRU ECX, 16/32-bit overrides, VEX/EVEX). The RDPRU lowering reads the TSC for both MPERF and APERF, the same stand-in the startup doc already states.
  • Syntax parse of both Python files, python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py and git diff --check origin/main...HEAD pass.
  • Code-level mutations were not possible: the check script only runs against Windows-built DLLs.

Findings:

  • P2: tests/cpu/amd_monitor_rdpru_aot_check.py exits 77 (skip) when the host lacks MWAITX or RDPRU (lines ~505-525). If the Windows VM does not expose those AMD CPUID bits, the runtime differential never runs and the CTest reports a skip. The author should show on which host the runtime part ran, and which ctest result (passed or skipped) the translator and O2 checks give.
  • P2: the sibling lifters are listed in docs/experiments.md (for example the SSE4a translator near line 14491). This PR adds no docs entry for the new tool or test. Please add one.
  • P2: docs/coverage/x64_zen2.tsv (lines 479, 490, 510) is not touched. If the coverage recorder is meant to mark these forms as lifted, check that FORM_COVERAGE_RECORD output is consumed for them.

Not a merge candidate yet: it needs a real Windows run, with the head SHA stated, to be useful.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6062819693 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#pullrequestreview-6062819693). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T18:23:11Z. **Review:** COMMENTED --- Review of head 0cc1337a (tooling plus tests: new `tools/cpu_amd_monitor_rdpru_aot.py`, `tests/cpu/amd_monitor_rdpru_aot.asm/.def`, `tests/cpu/amd_monitor_rdpru_aot_check.py`, `CMakeLists.txt`). No author Windows results are posted on this PR, so none were checked. I ran no Windows tests, and the new CTest needs the MSVC-built DLLs, so I could not run it on Linux either. What I checked: - No other open or merged PR adds an AOT lifter for these opcodes. #1312 and `docs/startup-runtime.md` (line 2363 onward) cover the startup host-CPU fallback, which is a different path. - The CMake wiring follows the sibling lifters (original/altered fixtures, `cpu_translation`, an O2 build, `FORM_COVERAGE_RECORD`, `SKIP_RETURN_CODE 77`). - The lifter rejects the unsafe cases listed in its docstring (timer-mode MWAITX, undefined or out-of-range RDPRU ECX, 16/32-bit overrides, VEX/EVEX). The RDPRU lowering reads the TSC for both MPERF and APERF, the same stand-in the startup doc already states. - Syntax parse of both Python files, `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py` and `git diff --check origin/main...HEAD` pass. - Code-level mutations were not possible: the check script only runs against Windows-built DLLs. Findings: - P2: `tests/cpu/amd_monitor_rdpru_aot_check.py` exits 77 (skip) when the host lacks MWAITX or RDPRU (lines ~505-525). If the Windows VM does not expose those AMD CPUID bits, the runtime differential never runs and the CTest reports a skip. The author should show on which host the runtime part ran, and which `ctest` result (passed or skipped) the translator and O2 checks give. - P2: the sibling lifters are listed in `docs/experiments.md` (for example the SSE4a translator near line 14491). This PR adds no docs entry for the new tool or test. Please add one. - P2: `docs/coverage/x64_zen2.tsv` (lines 479, 490, 510) is not touched. If the coverage recorder is meant to mark these forms as lifted, check that `FORM_COVERAGE_RECORD` output is consumed for them. Not a merge candidate yet: it needs a real Windows run, with the head SHA stated, to be useful. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-25 19:45:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T19:45:25Z.

Review: COMMENTED


Review of head b2200ed0 (current main merged in), plus Win2025 receipt.

Code review (no blocking findings)

  • Lifter rejects what it cannot prove: unproven or out-of-range RDPRU ECX, MWAITX timer bit ECX[1] and reserved bits, MONITORX with non-flat RAX or non-zero ECX/EDX, legacy MONITOR/MWAIT/RDTSC, VEX/EVEX, nonvolatile GPRs, stray stores and branches.
  • Test coverage: 6 accepted sequences and 41 rejection controls, a /O2 disassembly check for the RDPRU anti-CSE and anti-DCE barriers, a lifted runtime suite, and altered-build plus mutant controls.
  • Sibling: RDPRU also appears in merged #1312 (shared lowering); this PR is the separate dedicated AOT path, no overlap in files.
  • Not a startup/game claim.

Linux (worktree on this head)

  • python3 tests/docs_links_check.py: pass. python3 tests/bidi_controls_check.py: pass. git diff --check origin/main...HEAD: clean.
  • Translator checks (check_translator, with iced-x86): 6 accepted, 41 rejections pass.
  • Mutation 1: accept RDPRU ECX=2 in the lifter. The suite fails at rdpru_oor_ecx_2.
  • Mutation 2: drop the flat-pointer proof for MONITORX RAX. The suite fails at monitorx_const_rax.

Win2025 (Build 26100, MSVC 14.44, 5-slot pool)

  • Targets built: the 4 fixture/lifted targets plus cpu_amd_monitor_rdpru_aot_original_lifted_o2. The first run without the /O2 target failed on the missing _o2.dll: the planner does not pick up that custom target automatically.
  • ctest --preset dev -R 'amd_monitor_rdpru' and ctest --preset release -R 'amd_monitor_rdpru': cpu_aot_amd_monitor_rdpru exits 77 (skipped: the VM CPU lacks AMD MWAITX/RDPRU). The script reaches that exit only after the translator, /O2 disassembly and lifted runtime/mutant checks passed.
  • So this is a capability skip, not a pass. The native AMD hardware differential has not run on this VM. Whoever merges may want an AMD host run.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6063938666 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#pullrequestreview-6063938666). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T19:45:25Z. **Review:** COMMENTED --- Review of head b2200ed0 (current main merged in), plus Win2025 receipt. **Code review (no blocking findings)** - Lifter rejects what it cannot prove: unproven or out-of-range RDPRU ECX, MWAITX timer bit ECX[1] and reserved bits, MONITORX with non-flat RAX or non-zero ECX/EDX, legacy MONITOR/MWAIT/RDTSC, VEX/EVEX, nonvolatile GPRs, stray stores and branches. - Test coverage: 6 accepted sequences and 41 rejection controls, a /O2 disassembly check for the RDPRU anti-CSE and anti-DCE barriers, a lifted runtime suite, and altered-build plus mutant controls. - Sibling: RDPRU also appears in merged #1312 (shared lowering); this PR is the separate dedicated AOT path, no overlap in files. - Not a startup/game claim. **Linux (worktree on this head)** - `python3 tests/docs_links_check.py`: pass. `python3 tests/bidi_controls_check.py`: pass. `git diff --check origin/main...HEAD`: clean. - Translator checks (`check_translator`, with iced-x86): 6 accepted, 41 rejections pass. - Mutation 1: accept RDPRU ECX=2 in the lifter. The suite fails at `rdpru_oor_ecx_2`. - Mutation 2: drop the flat-pointer proof for MONITORX RAX. The suite fails at `monitorx_const_rax`. **Win2025 (Build 26100, MSVC 14.44, 5-slot pool)** - Targets built: the 4 fixture/lifted targets plus `cpu_amd_monitor_rdpru_aot_original_lifted_o2`. The first run without the /O2 target failed on the missing `_o2.dll`: the planner does not pick up that custom target automatically. - `ctest --preset dev -R 'amd_monitor_rdpru'` and `ctest --preset release -R 'amd_monitor_rdpru'`: `cpu_aot_amd_monitor_rdpru` exits 77 (skipped: the VM CPU lacks AMD MWAITX/RDPRU). The script reaches that exit only after the translator, /O2 disassembly and lifted runtime/mutant checks passed. - So this is a capability skip, not a pass. The native AMD hardware differential has not run on this VM. Whoever merges may want an AMD host run. AI-assisted; commands listed were executed locally.
R0Y00 commented 2026-11-26 01:02:13 +00:00 (Migrated from github.com)

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


The host and lifted controls are accounted for, including the /O2 barriers and fault-ordering cases. One independent piece remains for the native AMD differential: a Windows host that exposes both AMD capabilities, running ctest --preset release --no-tests=error -j 1 -R '^cpu_aot_amd_monitor_rdpru$' -V on the current head. Please report the CPU, capability bits and whether the native branch reached the differential and exited 0. Keep the VM’s exit 77 separate. The lifted counter and wait behavior should stay documented as the bounded approximations measured by this fixture.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7179000358 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#issuecomment-7179000358). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-26T00:40:32Z. --- The host and lifted controls are accounted for, including the `/O2` barriers and fault-ordering cases. One independent piece remains for the native AMD differential: a Windows host that exposes both AMD capabilities, running `ctest --preset release --no-tests=error -j 1 -R '^cpu_aot_amd_monitor_rdpru$' -V` on the current head. Please report the CPU, capability bits and whether the native branch reached the differential and exited 0. Keep the VM’s exit 77 separate. The lifted counter and wait behavior should stay documented as the bounded approximations measured by this fixture.
Ammmae0x commented 2026-11-26 02:05:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-26T01:21:20Z.


Our local Windows build host is 13th Gen Intel(R) Core(TM) i7-13620H (GenuineIntel), which does not expose AMD MWAITX/RDPRU CPUID bits, so we cannot provide the native AMD hardware differential run here. Head b2200ed0 is unchanged and the lifted counter and wait behavior remain documented as bounded approximations. AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7179690927 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#issuecomment-7179690927). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-26T01:21:20Z. --- Our local Windows build host is 13th Gen Intel(R) Core(TM) i7-13620H (GenuineIntel), which does not expose AMD MWAITX/RDPRU CPUID bits, so we cannot provide the native AMD hardware differential run here. Head b2200ed0 is unchanged and the lifted counter and wait behavior remain documented as bounded approximations. AI-assisted.
tedin7 commented 2026-11-26 03:44:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:44:52Z.

Review: COMMENTED


Comment review of head 69127289. It is b2200ed0 plus a merge of main. The PR's own change is identical: the added and removed lines of git diff origin/main...HEAD match the reviewed head exactly (same 5 files, 1611 insertions).

What I checked:

  • The Win2025 WARP receipt for this head is already in the thread. cpu_aot_amd_monitor_rdpru is a capability skip (77), not a native AMD pass.
  • CI is green on this head.

Why I am not merging:

  • @R0Y00 asked for one more piece: a native AMD differential run on a host that exposes both MWAITX and RDPRU. The author said they cannot provide it, and neither can our VM. So the PR stays open for a host that has an AMD CPU.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6068266672 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#pullrequestreview-6068266672). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:44:52Z. **Review:** COMMENTED --- Comment review of head `69127289`. It is `b2200ed0` plus a merge of main. The PR's own change is identical: the added and removed lines of `git diff origin/main...HEAD` match the reviewed head exactly (same 5 files, 1611 insertions). **What I checked:** - The Win2025 WARP receipt for this head is already in the thread. `cpu_aot_amd_monitor_rdpru` is a capability skip (77), not a native AMD pass. - CI is green on this head. **Why I am not merging:** - @R0Y00 asked for one more piece: a native AMD differential run on a host that exposes both MWAITX and RDPRU. The author said they cannot provide it, and neither can our VM. So the PR stays open for a host that has an AMD CPU. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 04:04:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:29:08Z.


Win2025 WARP receipt for head 69127289 after updating with main.

Verified on Windows Server 2025 (Build 26100, MSVC 14.44 + D3D12 WARP), 5-slot pool:

  • Targets built: the 4 fixture/lifted targets plus cpu_amd_monitor_rdpru_aot_original_lifted_o2.
  • ctest --preset dev -R 'amd_monitor_rdpru' and ctest --preset release -R 'amd_monitor_rdpru': cpu_aot_amd_monitor_rdpru exits 77 (capability skip: the VM CPU lacks AMD MWAITX/RDPRU). The script reaches that exit only after the translator, /O2 disassembly and lifted checks passed.
  • This is a capability skip, not a native AMD differential pass. That one run still needs a host that exposes both AMD capabilities.

The PR's own change is identical to the head reviewed earlier (same 5 files); CI is green on this head.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7181759968 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#issuecomment-7181759968). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:29:08Z. --- Win2025 WARP receipt for head 69127289 after updating with main. Verified on Windows Server 2025 (Build 26100, MSVC 14.44 + D3D12 WARP), 5-slot pool: - Targets built: the 4 fixture/lifted targets plus `cpu_amd_monitor_rdpru_aot_original_lifted_o2`. - `ctest --preset dev -R 'amd_monitor_rdpru'` and `ctest --preset release -R 'amd_monitor_rdpru'`: `cpu_aot_amd_monitor_rdpru` exits 77 (capability skip: the VM CPU lacks AMD MWAITX/RDPRU). The script reaches that exit only after the translator, /O2 disassembly and lifted checks passed. - This is a capability skip, not a native AMD differential pass. That one run still needs a host that exposes both AMD capabilities. The PR's own change is identical to the head reviewed earlier (same 5 files); CI is green on this head. AI-assisted; commands listed were executed locally.
tedin7 commented 2026-11-26 04:04:41 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T03:47:31Z.


Native AMD differential for head 69127289: still not available from our pool, so no merge from us.

Checked on the Windows Server 2025 test hosts (Get-CimInstance Win32_Processor):

  • Extra host (slots 6-13): Intel(R) Xeon(R) Platinum 8488C, GenuineIntel. No AMD MWAITX/RDPRU CPUID bits, so cpu_aot_amd_monitor_rdpru would exit 77 here too.
  • Main VM (slots 1-5): already reported above, cpu_aot_amd_monitor_rdpru exits 77 on both dev and release.

No host we control exposes both AMD capabilities, so ctest --preset release --no-tests=error -j 1 -R '^cpu_aot_amd_monitor_rdpru$' -V cannot reach the native branch. The translator, /O2 disassembly and lifted checks pass up to the capability skip (see the receipt above). CI is green on this head.

Leaving the merge to @R0Y00: it needs one run on a Windows machine with an AMD CPU (Zen with MWAITX and RDPRU) and a report of the CPU, capability bits and exit code.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7182026891 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#issuecomment-7182026891). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-26T03:47:31Z. --- Native AMD differential for head 69127289: still not available from our pool, so no merge from us. Checked on the Windows Server 2025 test hosts (`Get-CimInstance Win32_Processor`): - Extra host (slots 6-13): Intel(R) Xeon(R) Platinum 8488C, GenuineIntel. No AMD MWAITX/RDPRU CPUID bits, so `cpu_aot_amd_monitor_rdpru` would exit 77 here too. - Main VM (slots 1-5): already reported above, `cpu_aot_amd_monitor_rdpru` exits 77 on both dev and release. No host we control exposes both AMD capabilities, so `ctest --preset release --no-tests=error -j 1 -R '^cpu_aot_amd_monitor_rdpru$' -V` cannot reach the native branch. The translator, /O2 disassembly and lifted checks pass up to the capability skip (see the receipt above). CI is green on this head. Leaving the merge to @R0Y00: it needs one run on a Windows machine with an AMD CPU (Zen with MWAITX and RDPRU) and a report of the CPU, capability bits and exit code. AI-assisted; commands listed were executed locally.
MasterDomino commented 2026-11-26 06:45:05 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by MasterDomino on 2026-11-26T06:45:05Z.

Review: COMMENTED


Native AMD differential for head 69127289, the run @R0Y00 asked for.

Host: AMD Ryzen 7 9800X3D, Windows 11 build 26300. CPUID Fn8000_0001:ECX[29] (MWAITX) = 1, Fn8000_0008:EBX[4] (RDPRU) = 1.

  • The test: ctest --preset release --no-tests=error -j 1 -R '^cpu_aot_amd_monitor_rdpru$' -V passed, exit 0. The native branch ran: "native AMD hardware differential passed (555 checks, 6 altered-native controls caught)". That came after the 6 accepted / 41 rejection controls, the /O2 barrier check, and the lifted Debug 555 + /O2 555. It repeated 10/10 with --repeat until-fail:10, and the dev preset gives the same result.
  • Neighbours: ctest --preset dev --no-tests=error -R '^cpu_' gave 309 passed, 1 skipped (cpu_aot_sysdesc, already skipped before), 0 failed.
  • Flags: measured on this host, native RDPRU leaves CF/ZF/SF/OF and RCX unchanged for all 10 flag pairs, which matches the lifted model.

One thing before merge: the documented counter doesn't match the code. The lifted RDPRU reads the TSC for both selectors (op_rdpru_read ignores selector), but the tool docstring says it reads the "counter selected by ECX (0 = MPERF, 1 = APERF)". On this host native MPERF and APERF are separate counters from the TSC; in one call sequence MPERF was 0x3c8b6a533876, APERF 0x41c440acfa39 and the TSC 0xf8450f7986f9.

  • What to document: in the docstring and in a short docs/experiments.md entry, say that:
    • both selectors map to a serialized TSC read, monotonic only;
    • MWAITX lowers to a fenced PAUSE (an allowed early wake-up).
  • Why: that's the "bounded approximations measured by this fixture" R0Y00 asked to keep documented. The fixture measures zero-extension, flag and RCX preservation, monotonicity and fault ordering, not counter values.

Smaller points:

  • Not mutants: the five "mutant controls" in check_altered_and_mutants re-assert the unmutated lifted outputs rather than run a mutated model. The altered-build controls are real.
  • Untested flag paths: the accepted 32-bit add/cmp flag paths have no case. Flipping CF in op_cmp32 (a < b → a > b) still passes.
  • CI coverage: PR CI's pr smoke preset doesn't run cpu_aot_*, so the green checks here don't exercise this test. On a windows-2025 runner that hides the AMD bits, it should exit 77 (skip).

Mutations run locally, each caught by the test:

  • dropping the RDPRU zero-extension: "upper 32 bits not zeroed";
  • dropping the MONITORX probe: "did not fault on NULL rcx";
  • dropping the counter volatile: "/O2 … expected 1 RDTSC instruction(s), found 0".

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6069643739 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#pullrequestreview-6069643739). Originally posted by [MasterDomino](https://github.com/MasterDomino) on 2026-11-26T06:45:05Z. **Review:** COMMENTED --- Native AMD differential for head `69127289`, the run @R0Y00 asked for. **Host:** AMD Ryzen 7 9800X3D, Windows 11 build 26300. CPUID Fn8000_0001:ECX[29] (MWAITX) = 1, Fn8000_0008:EBX[4] (RDPRU) = 1. - **The test:** `ctest --preset release --no-tests=error -j 1 -R '^cpu_aot_amd_monitor_rdpru$' -V` passed, exit 0. The native branch ran: "native AMD hardware differential passed (555 checks, 6 altered-native controls caught)". That came after the 6 accepted / 41 rejection controls, the /O2 barrier check, and the lifted Debug 555 + /O2 555. It repeated 10/10 with `--repeat until-fail:10`, and the dev preset gives the same result. - **Neighbours:** `ctest --preset dev --no-tests=error -R '^cpu_'` gave 309 passed, 1 skipped (`cpu_aot_sysdesc`, already skipped before), 0 failed. - **Flags:** measured on this host, native RDPRU leaves CF/ZF/SF/OF and RCX unchanged for all 10 flag pairs, which matches the lifted model. **One thing before merge: the documented counter doesn't match the code.** The lifted RDPRU reads the TSC for both selectors (`op_rdpru_read` ignores `selector`), but the tool docstring says it reads the "counter selected by ECX (0 = MPERF, 1 = APERF)". On this host native MPERF and APERF are separate counters from the TSC; in one call sequence MPERF was 0x3c8b6a533876, APERF 0x41c440acfa39 and the TSC 0xf8450f7986f9. - **What to document:** in the docstring and in a short `docs/experiments.md` entry, say that: - both selectors map to a serialized TSC read, monotonic only; - MWAITX lowers to a fenced PAUSE (an allowed early wake-up). - **Why:** that's the "bounded approximations measured by this fixture" R0Y00 asked to keep documented. The fixture measures zero-extension, flag and RCX preservation, monotonicity and fault ordering, not counter values. **Smaller points:** - **Not mutants:** the five "mutant controls" in `check_altered_and_mutants` re-assert the unmutated lifted outputs rather than run a mutated model. The altered-build controls are real. - **Untested flag paths:** the accepted 32-bit `add`/`cmp` flag paths have no case. Flipping CF in `op_cmp32` (`a < b` → `a > b`) still passes. - **CI coverage:** PR CI's `pr` smoke preset doesn't run `cpu_aot_*`, so the green checks here don't exercise this test. On a windows-2025 runner that hides the AMD bits, it should exit 77 (skip). **Mutations run locally, each caught by the test:** - dropping the RDPRU zero-extension: "upper 32 bits not zeroed"; - dropping the MONITORX probe: "did not fault on NULL rcx"; - dropping the counter `volatile`: "/O2 … expected 1 RDTSC instruction(s), found 0". AI-assisted; commands listed were executed locally.
Ammmae0x commented 2026-11-26 16:03:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-26T16:03:34Z.


Updated PR #2430 (commit 3c33f107) to address @MasterDomino's review findings:

  1. Bounded-approximation documentation: Updated tools/cpu_amd_monitor_rdpru_aot.py docstrings/comments and added a cpu_aot_amd_monitor_rdpru entry in docs/experiments.md explicitly stating that both statically validated RDPRU selectors (ECX=0 MPERF and ECX=1 APERF) map to a serialized host RDTSC read (monotonic progression only, not true hardware MPERF/APERF values) and MWAITX lowers to a fenced _mm_pause() (an allowed early wake-up).
  2. 32-bit ADD/CMP flag paths: Added op_add32_rdpru and op_cmp32_mwaitx across tests/cpu/amd_monitor_rdpru_aot.asm, .def, CMakeLists.txt, and tests/cpu/amd_monitor_rdpru_aot_check.py covering 12 32-bit flag pairs (including inputs with non-zero upper 32 bits).
  3. Compiled C++ mutants: Replaced the in-process assertions with cpu_amd_monitor_rdpru_aot_mutants (6 compiled C++ mutant controls including mut_cmp32_flip_cf flipping op_cmp32 a < b to a > b and mut_rdpru_swap_halves checked against a serial_tsc() bracket).

Verified on Windows 11 x64 (13th Gen Intel Core i7-13620H) on both --preset dev and --preset release (ctest -R "^cpu_aot_amd_monitor_rdpru$" -V): 6 sequences accepted, 41 rejection controls, /O2 RDTSC/PAUSE barrier checks, 579 lifted Debug + 579 /O2 checks, 6 altered-build controls, and 6 compiled C++ mutant controls passed before exiting 77 (capability skip: Intel host lacks MWAITX and RDPRU CPUID bits), plus docs_links_check.py, bidi_controls_check.py, and form_coverage_check.py (all exit 0).

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7197123745 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#issuecomment-7197123745). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-26T16:03:34Z. --- Updated PR #2430 (commit `3c33f107`) to address @MasterDomino's review findings: 1. **Bounded-approximation documentation**: Updated `tools/cpu_amd_monitor_rdpru_aot.py` docstrings/comments and added a `cpu_aot_amd_monitor_rdpru` entry in `docs/experiments.md` explicitly stating that both statically validated `RDPRU` selectors (`ECX=0` MPERF and `ECX=1` APERF) map to a serialized host `RDTSC` read (monotonic progression only, not true hardware MPERF/APERF values) and `MWAITX` lowers to a fenced `_mm_pause()` (an allowed early wake-up). 2. **32-bit `ADD`/`CMP` flag paths**: Added `op_add32_rdpru` and `op_cmp32_mwaitx` across `tests/cpu/amd_monitor_rdpru_aot.asm`, `.def`, `CMakeLists.txt`, and `tests/cpu/amd_monitor_rdpru_aot_check.py` covering 12 32-bit flag pairs (including inputs with non-zero upper 32 bits). 3. **Compiled C++ mutants**: Replaced the in-process assertions with `cpu_amd_monitor_rdpru_aot_mutants` (6 compiled C++ mutant controls including `mut_cmp32_flip_cf` flipping `op_cmp32` `a < b` to `a > b` and `mut_rdpru_swap_halves` checked against a `serial_tsc()` bracket). Verified on Windows 11 x64 (13th Gen Intel Core i7-13620H) on both `--preset dev` and `--preset release` (`ctest -R "^cpu_aot_amd_monitor_rdpru$" -V`): 6 sequences accepted, 41 rejection controls, `/O2` `RDTSC`/`PAUSE` barrier checks, 579 lifted Debug + 579 `/O2` checks, 6 altered-build controls, and 6 compiled C++ mutant controls passed before exiting 77 (capability skip: Intel host lacks `MWAITX` and `RDPRU` CPUID bits), plus `docs_links_check.py`, `bidi_controls_check.py`, and `form_coverage_check.py` (all exit 0). AI-assisted.
tedin7 commented 2026-11-27 09:35:59 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-27T09:35:59Z.

Review: COMMENTED


Test result on head 3c33f107d (Windows Server 2025 runner, dev build, ctest -R ^cpu_aot_amd_monitor_rdpru): FAIL, so this is not mergeable yet.

  • The first parts pass: "6 AMD MONITORX/MWAITX/RDPRU sequences accepted; 41 rejection controls passed" and the /O2 disassembly checks.
  • Then main() at tests/cpu/amd_monitor_rdpru_aot_check.py:618 calls bind(lifted_o2_path, "lifted_") and fails with AttributeError: function 'lifted_op_add32_rdpru' not found. The /O2 library (cpu_amd_monitor_rdpru_aot_original_lifted_o2.dll, built by the custom cl /O2 /LD command in CMakeLists.txt) does not export that function, although the regular lifted library does.
  • Please check the export list for the /O2 build (for example that op_add32_rdpru and op_cmp32_mwaitx are exported there, or that the /O2 compile sees the same export macro as the normal target) and push a fix.

AI-assisted; commands listed were executed locally.
Commands: x2w_pipe.py win2025 2430 --regex '^cpu_aot_amd_monitor_rdpru' (dev leg ran; it failed before the release leg).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6086122829 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#pullrequestreview-6086122829). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-27T09:35:59Z. **Review:** COMMENTED --- Test result on head 3c33f107d (Windows Server 2025 runner, dev build, `ctest -R ^cpu_aot_amd_monitor_rdpru`): FAIL, so this is not mergeable yet. - The first parts pass: "6 AMD MONITORX/MWAITX/RDPRU sequences accepted; 41 rejection controls passed" and the /O2 disassembly checks. - Then `main()` at `tests/cpu/amd_monitor_rdpru_aot_check.py:618` calls `bind(lifted_o2_path, "lifted_")` and fails with `AttributeError: function 'lifted_op_add32_rdpru' not found`. The /O2 library (`cpu_amd_monitor_rdpru_aot_original_lifted_o2.dll`, built by the custom `cl /O2 /LD` command in `CMakeLists.txt`) does not export that function, although the regular lifted library does. - Please check the export list for the /O2 build (for example that `op_add32_rdpru` and `op_cmp32_mwaitx` are exported there, or that the /O2 compile sees the same export macro as the normal target) and push a fix. AI-assisted; commands listed were executed locally. Commands: `x2w_pipe.py win2025 2430 --regex '^cpu_aot_amd_monitor_rdpru'` (dev leg ran; it failed before the release leg).
Ammmae0x commented 2026-11-27 15:44:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Ammmae0x on 2026-11-27T15:44:24Z.


Updated PR #2430 at commit 79b32343 to fix the stale cpu_amd_monitor_rdpru_aot_original_lifted_o2.dll export issue reported by @tedin7:

  • CMake dependency wiring: Added add_dependencies(cpu_amd_monitor_rdpru_aot_mutants cpu_amd_monitor_rdpru_aot_original_lifted_o2) in CMakeLists.txt so building only the $<TARGET_FILE:...> targets referenced by add_test(NAME cpu_aot_amd_monitor_rdpru ...) automatically rebuilds cpu_amd_monitor_rdpru_aot_original_lifted_o2.dll with lifted_op_add32_rdpru and lifted_op_cmp32_mwaitx.
  • Verification: Rebuilt the 5 test $<TARGET_FILE:...> targets (after removing the stale _o2.dll) and ran ctest --preset dev --no-tests=error -R "^cpu_aot_amd_monitor_rdpru$" -V and ctest --preset release --no-tests=error -R "^cpu_aot_amd_monitor_rdpru$" -V on Windows 11 x64 (Intel host): 6 sequences accepted, 41 rejection controls, /O2 barriers, 579 Debug + 579 /O2 lifted checks + NULL fault-ordering, 6 altered-build controls, and 6 compiled C++ mutants passed before capability skip (exit 77: host lacks AMD MWAITX/RDPRU CPUID bits).

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7222422691 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#issuecomment-7222422691). Originally posted by [Ammmae0x](https://github.com/Ammmae0x) on 2026-11-27T15:44:24Z. --- Updated PR #2430 at commit `79b32343` to fix the stale `cpu_amd_monitor_rdpru_aot_original_lifted_o2.dll` export issue reported by @tedin7: - **CMake dependency wiring**: Added `add_dependencies(cpu_amd_monitor_rdpru_aot_mutants cpu_amd_monitor_rdpru_aot_original_lifted_o2)` in `CMakeLists.txt` so building only the `$<TARGET_FILE:...>` targets referenced by `add_test(NAME cpu_aot_amd_monitor_rdpru ...)` automatically rebuilds `cpu_amd_monitor_rdpru_aot_original_lifted_o2.dll` with `lifted_op_add32_rdpru` and `lifted_op_cmp32_mwaitx`. - **Verification**: Rebuilt the 5 test `$<TARGET_FILE:...>` targets (after removing the stale `_o2.dll`) and ran `ctest --preset dev --no-tests=error -R "^cpu_aot_amd_monitor_rdpru$" -V` and `ctest --preset release --no-tests=error -R "^cpu_aot_amd_monitor_rdpru$" -V` on Windows 11 x64 (Intel host): 6 sequences accepted, 41 rejection controls, `/O2` barriers, 579 Debug + 579 `/O2` lifted checks + NULL fault-ordering, 6 altered-build controls, and 6 compiled C++ mutants passed before capability skip (exit 77: host lacks AMD MWAITX/RDPRU CPUID bits). AI-assisted.
pigalot commented 2026-11-27 22:14:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T22:14:25Z.

Review: APPROVED


Independently reviewed 79b32343 integrated over main 886a5a28 (tree f02a43c3), including the native AMD differential R0Y00 asked for. The merge is clean and git diff --cached --check origin/main is clean.

Native AMD run on the current head. The host is an AMD Ryzen 7 9800X3D on Windows 11 build 26200. The check runs the native branch only when CPUID Fn8000_0001:ECX[29] (MWAITX) and Fn8000_0008:EBX[4] (RDPRU) are both set, and it ran here.

cmake --build --preset <dev|release> --target cpu_amd_monitor_rdpru_aot_original cpu_amd_monitor_rdpru_aot_original_lifted cpu_amd_monitor_rdpru_aot_original_lifted_o2 cpu_amd_monitor_rdpru_aot_altered cpu_amd_monitor_rdpru_aot_altered_lifted cpu_amd_monitor_rdpru_aot_mutants
ctest --test-dir out/build/<dev|release> --no-tests=error -j 1 -V -R '^cpu_aot_amd_monitor_rdpru$'

Both presets pass with exit 0 and no skip:

  • 6 AMD MONITORX/MWAITX/RDPRU sequences accepted; 41 rejection controls passed;
  • lifted Debug (579 checks) + /O2 (579 checks) + NULL fault-ordering passed; 6 altered-build + 6 compiled C++ mutant controls caught;
  • native AMD hardware differential passed (579 checks, 6 altered-native controls caught).

--repeat until-fail:10 passes 10/10 in each preset. The test is new and is not registered on main.

Earlier findings, checked at this head.

  • tedin7, stale /O2 export on 3c33f107: addressed. I deleted cpu_amd_monitor_rdpru_aot_original_lifted_o2.dll and built only the five $<TARGET_FILE:...> targets of the test. The new add_dependencies rebuilt the DLL, and the test passed.
  • MasterDomino, docs: addressed. The tool docstring, the op_rdpru_read comment and the new docs/experiments.md entry say that both selectors map to a serialized TSC read and that MWAITX lowers to a fenced _mm_pause(). op_rdpru_read ignores selector, as documented.
  • MasterDomino, mutants: addressed. The "mutant controls" are now six compiled C++ mutants emitted from the lifted functions, each asserted to break its property.
  • MasterDomino, 32-bit flags: addressed. op_add32_rdpru and op_cmp32_mwaitx cover the 32-bit add/cmp flag paths.

Mutants of my own in tools/cpu_amd_monitor_rdpru_aot.py. Each was applied alone, the six targets rebuilt in dev, the test run, and the source restored (git diff --quiet clean). All are killed:

Mutant Result
op_add32 OF forced to false killed
op_cmp32 OF forced to false killed
op_cmp32 SF forced to false killed
op_add32 CF r < a → r > a killed
MWAITX timer guard ext & 0x2 removed killed

form_coverage_check, docs_links_check (114 files, 612 links) and bidi_controls_check pass.

Non-blocking. The new docs/experiments.md entry reports only the Intel run that skips (77). A line with this native AMD result would document what the fixture measures when both capabilities are present.

Verdict: approve on 79b32343.

Environment: AMD Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10. No GPU tests ran.
CI: Build and test on Windows, Assemble and translate gfx1013 fixtures and Run platform-independent Python checks on Linux pass on 79b32343.

This reply was AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6093846585 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2430#pullrequestreview-6093846585). Originally posted by [pigalot](https://github.com/pigalot) on 2026-11-27T22:14:25Z. **Review:** APPROVED --- Independently reviewed `79b32343` integrated over `main` `886a5a28` (tree `f02a43c3`), including the native AMD differential R0Y00 asked for. The merge is clean and `git diff --cached --check origin/main` is clean. **Native AMD run on the current head.** The host is an AMD Ryzen 7 9800X3D on Windows 11 build 26200. The check runs the native branch only when CPUID `Fn8000_0001:ECX[29]` (MWAITX) and `Fn8000_0008:EBX[4]` (RDPRU) are both set, and it ran here. ```powershell cmake --build --preset <dev|release> --target cpu_amd_monitor_rdpru_aot_original cpu_amd_monitor_rdpru_aot_original_lifted cpu_amd_monitor_rdpru_aot_original_lifted_o2 cpu_amd_monitor_rdpru_aot_altered cpu_amd_monitor_rdpru_aot_altered_lifted cpu_amd_monitor_rdpru_aot_mutants ctest --test-dir out/build/<dev|release> --no-tests=error -j 1 -V -R '^cpu_aot_amd_monitor_rdpru$' ``` Both presets pass with exit 0 and no skip: - `6 AMD MONITORX/MWAITX/RDPRU sequences accepted; 41 rejection controls passed`; - `lifted Debug (579 checks) + /O2 (579 checks) + NULL fault-ordering passed; 6 altered-build + 6 compiled C++ mutant controls caught`; - `native AMD hardware differential passed (579 checks, 6 altered-native controls caught)`. `--repeat until-fail:10` passes 10/10 in each preset. The test is new and is not registered on `main`. **Earlier findings, checked at this head.** - **tedin7, stale `/O2` export on `3c33f107`:** addressed. I deleted `cpu_amd_monitor_rdpru_aot_original_lifted_o2.dll` and built only the five `$<TARGET_FILE:...>` targets of the test. The new `add_dependencies` rebuilt the DLL, and the test passed. - **MasterDomino, docs:** addressed. The tool docstring, the `op_rdpru_read` comment and the new `docs/experiments.md` entry say that both selectors map to a serialized TSC read and that MWAITX lowers to a fenced `_mm_pause()`. `op_rdpru_read` ignores `selector`, as documented. - **MasterDomino, mutants:** addressed. The "mutant controls" are now six compiled C++ mutants emitted from the lifted functions, each asserted to break its property. - **MasterDomino, 32-bit flags:** addressed. `op_add32_rdpru` and `op_cmp32_mwaitx` cover the 32-bit `add`/`cmp` flag paths. **Mutants of my own** in `tools/cpu_amd_monitor_rdpru_aot.py`. Each was applied alone, the six targets rebuilt in `dev`, the test run, and the source restored (`git diff --quiet` clean). All are killed: | Mutant | Result | |---|---| | `op_add32` OF forced to false | killed | | `op_cmp32` OF forced to false | killed | | `op_cmp32` SF forced to false | killed | | `op_add32` CF `r < a` → `r > a` | killed | | MWAITX timer guard `ext & 0x2` removed | killed | `form_coverage_check`, `docs_links_check` (114 files, 612 links) and `bidi_controls_check` pass. **Non-blocking.** The new `docs/experiments.md` entry reports only the Intel run that skips (77). A line with this native AMD result would document what the fixture measures when both capabilities are present. **Verdict:** approve on `79b32343`. Environment: AMD Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974; MSVC 19.52.37029; Python 3.12.10. No GPU tests ran. CI: `Build and test on Windows`, `Assemble and translate gfx1013 fixtures` and `Run platform-independent Python checks on Linux` pass on `79b32343`. This reply was 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!2422
No description provided.