Files
xenia-rs/audit-runs/phase-c2-MmAllocatePhysicalMemoryEx/re-validation.md
MechaCat02 ef93a4fa14 handoff: VSync/event-wedge fixes + iterate 2.A–2.BC research notes
Source changes (dormant parity infra, retained from iterate 2.AI/2.AO):
- xenia-kernel/exports.rs: nt_create_event manual_reset polarity +
  related event wiring
- xenia-gpu/mmio_region.rs: D1MODE_VBLANK_VLINE_STATUS hardcode parity

Also lands the audit-runs/ analysis notes (.md/.txt/.json digests) for the
iterate 2.x VSync/0x10e8/0x1004 wedge investigation. Raw trace dumps
(.jsonl/.gz/.csv/.stdout) and agent worktrees (.claude/) are gitignored as
regenerable local artifacts — see memory + HANDOFF for the running findings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 07:19:08 +02:00

112 lines
3.9 KiB
Markdown

# Phase C+2 — re-validation
## Gate 1 — Determinism (cvar-OFF)
3 fresh runs of `xrs-phaseC2 check -n 50000000 --stable-digest --out …`:
| run | digest md5 |
|-----|------------|
| 1 | 608d8e8d293250698207a7d8fc0c18df |
| 2 | 608d8e8d293250698207a7d8fc0c18df |
| 3 | 608d8e8d293250698207a7d8fc0c18df |
| Phase C+1 baseline | 608d8e8d293250698207a7d8fc0c18df |
**Result**: ✅ byte-identical to C+1 baseline. Expected: this session only
modified `tools/diff-events/diff_events.py` (Python diff tool); zero ours
engine code touched.
## Gate 2 — Phase B `image_canonical_sha256`
Not re-snapshotted. Inferred OK by Gate 1 (no image-loading or memory-
layout code modified).
## Gate 3 — Phase A matched-prefix extension (THE KEY METRIC)
Re-ran the existing capture pair (canary from `phase-c-first-divergence/
phase-a/canary.jsonl`; ours from `phase-c1-keQuerySystemTime/ours.jsonl`)
through the upgraded diff tool. No fresh engine runs needed — diff tool
change is comparison-side only.
| chain | C+1 matched (pre-canonicalize) | C+2 matched (post-canonicalize) | Δ |
|-------|--------------------------------|--------------------------------|----|
| canary tid=6 → ours tid=1 (main) | 161 | **102014** | **+101853** |
| canary tid=4 → ours tid=11 | 5 | 5 | 0 |
| canary tid=7 → ours tid=2 | 2 | 2 | 0 |
| canary tid=12 → ours tid=7 | 2 | 2 | 0 |
| canary tid=14 → ours tid=9 | 11 | 11 | 0 |
| canary tid=15 → ours tid=10 | — (no div) | — (no div) | 0 |
**Main thread matched prefix: 161 → 102014. Gate 3 ✅** (strictly greater
than 161, as required).
The new divergence at idx=102014 on tid=6→tid=1 is `RtlImageXexHeaderField`
returning `805433576` (`0x3001F0E8`) in canary vs `0` in ours — the next
Phase C+3 target. Off-thread divergences (tid=4/7/12/14) are unchanged by
this fix because their divergences are not allocator-related.
## Gate 4 — Build
No engine build required (Python tool only). `python3 -c 'import
xenia-rs.tools.diff-events.diff_events'` not applicable (script, not
package). The tool runs end-to-end on three input pairs (validation
checks below) without traceback.
## Gate 5 — Phase A determinism (emitter)
Emitter unchanged. The Phase A capture files used as input are byte-
identical to those used in C+1 (no re-emit). Gate vacuous; recorded
N/A.
## Gate 6 — Backward compatibility (diff-tool flag)
```
python3 diff_events.py --no-canonicalize-allocators \
--canary ...canary.jsonl --ours ...c1-ours.jsonl
```
Result table:
| canary_tid | ours_tid | matched | canary_total | ours_total | first_divergence_at |
|---|---|---|---|---|---|
| 4 | 11 | 5 | 47573 | 9 | 5 |
| 6 | 1 | 161 | 329948 | 108492 | 161 |
| 7 | 2 | 2 | 29 | 33 | 2 |
| 12 | 7 | 2 | 6689 | 3 | 2 |
| 14 | 9 | 11 | 1371603 | 75 | 11 |
| 15 | 10 | 15 | 863209 | 15 | — |
**Matches the C+1 pre-fix table byte-for-byte. ✅** The new flag reproduces
the legacy behavior exactly.
## Gate 7 — Self-diff sanity (no false positive)
```
python3 diff_events.py --validate-identical \
--canary phase-a-diff-harness/canary-sanity.jsonl \
--ours phase-a-diff-harness/canary-sanity.jsonl
exit code: 0
```
A stream diffed against itself reports zero divergences. The
canonicalization is *idempotent under self-diff* — both sides assign the
same ordinals on the same stream, so the sentinels match. ✅
```
python3 diff_events.py --validate-identical \
--canary phase-c1-keQuerySystemTime/ours.jsonl \
--ours phase-c1-keQuerySystemTime/ours.jsonl
exit code: 0
```
## Summary
| gate | result |
|---|---|
| 1. cvar-OFF determinism (3 ours runs vs C+1 baseline) | ✅ all 4 = `608d8e8d…` |
| 2. Phase B `image_canonical_sha256` | ✅ (inferred from gate 1) |
| 3. Phase A main matched prefix > 161 | ✅ **161 → 102014** (+101853) |
| 4. Build clean | ✅ (Python only) |
| 5. Phase A determinism | ✅ (emitter unchanged; vacuous) |
| 6. `--no-canonicalize-allocators` backward-compat | ✅ byte-identical to C+1 |
| 7. Self-diff sanity | ✅ exit 0 both cases |