From a0d9b85dbf8ddd09b4553cb3c57c8a0a2de74f9a Mon Sep 17 00:00:00 2001 From: Arths17 Date: Tue, 24 Nov 2026 22:42:19 -0600 Subject: [PATCH 1/2] Run benchmark report tests in workspace CI and record migration review Signed-off-by: Arths17 --- CHANGELOG.md | 2 + crates/loader/benches/dbt_bench.rs | 6 +- crates/loader/tests/dbt_benchmark_report.rs | 8 ++ docs/README.md | 1 + docs/testing/README.md | 1 + docs/testing/migration-pr-review.md | 96 +++++++++++++++++++++ 6 files changed, 112 insertions(+), 2 deletions(-) create mode 100644 crates/loader/tests/dbt_benchmark_report.rs create mode 100644 docs/testing/migration-pr-review.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c427c11..583987b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ remains unsupported. - Extended the read-only RDNA2 planning CLI (`python3 -m qa rdna2`) with family/status filters, compact summaries, Codex-ready manifests under `artifacts/`, active-claim exclusion (family claims exclude those families; path-only claims block overlapping permitted files), coverage reconcile against `semantic_coverage` without inflating counts, and inventory diffs. Covered by `tests/qa/test_rdna2_plan.py`; planning only, no GPU production edits. ### Fixed +- Restored the DBT benchmark report-test fixture after the cache-invalidation counter was added. Its existing percentile, JSON and comparison tests now run in ordinary workspace CI instead of requiring a separate benchmark test-harness command. - DBT cache hits now compare an executable-generation token instead of rereading every instruction byte. Address-space or executable-memory changes trigger byte and execute-permission revalidation before a translation can be reused; changed code is retranslated. Ordinary data writes retain the fast path. Tests cover cloned spaces, loader bypass writes, split writes, remapping and bounded cache exhaustion. Same-dispatch self-modification and discarded-code reclamation remain unsupported. - Gate A2 checks the cross-compiler driver before invoking it, then checks its helpers before fixture compilation. CI also verifies the driver architecture before requesting its version. - Non-canonical 64-bit guest data addresses now raise `#GP` instead of a memory fault in both the interpreter and native DBT, including accesses that cross the canonical-address boundary. The synthetic architectural test is enabled again. @@ -41,6 +42,7 @@ remains unsupported. - Added a Python 3 fallback for `timeout` in `scripts/test-gpu.sh`, so the native Metal suite runs on stock macOS without GNU coreutils while preserving bounded execution and the usual timeout exit status. ### Added +- Recorded the migrated PR integration decisions, native verification and scope exclusions in the testing documentation. - Added `xenora-bench startup` (#178), which measures Metal startup in fresh processes and in repeated submissions within one process, phase by phase (launch, device and queue, translation, library, pipeline, submission, GPU, readback), with median, p90, p99 and maximum. Every sample must produce the fixture's diff --git a/crates/loader/benches/dbt_bench.rs b/crates/loader/benches/dbt_bench.rs index ee113ee..3c08b0b 100644 --- a/crates/loader/benches/dbt_bench.rs +++ b/crates/loader/benches/dbt_bench.rs @@ -14,8 +14,9 @@ //! refused, with exit status 1, unless both runs used the same host, workload, //! build settings and sample counts. //! -//! The benchmark target disables Cargo's test harness. To run the percentile -//! unit tests, build with +//! Report, comparison and percentile tests run in ordinary workspace tests +//! through `tests/dbt_benchmark_report.rs`. The benchmark target itself disables +//! Cargo's test harness. To run its tests directly, build with //! `cargo rustc --locked -p xenora-loader --bench dbt_bench --message-format=json -- --test` //! and run the executable named by the benchmark's compiler-artifact message. @@ -982,6 +983,7 @@ mod tests { blocks_compiled: 626, cache_hits: 0, cache_misses: 626, + blocks_invalidated: 0, native_bytes_emitted: 245_168, dbt_dispatches: 626, instructions_executed: 10_002, diff --git a/crates/loader/tests/dbt_benchmark_report.rs b/crates/loader/tests/dbt_benchmark_report.rs new file mode 100644 index 0000000..3afbe06 --- /dev/null +++ b/crates/loader/tests/dbt_benchmark_report.rs @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +//! Run the benchmark's report, comparison and percentile tests in normal CI. +//! Timing runs remain confined to the standalone benchmark entry point. + +#[allow(dead_code)] +#[path = "../benches/dbt_bench.rs"] +mod benchmark; diff --git a/docs/README.md b/docs/README.md index 3f623cc..89e2f40 100644 --- a/docs/README.md +++ b/docs/README.md @@ -45,6 +45,7 @@ Historical phase checkpoints retain their original evidence scope. ## Testing, validation, and benchmarks +- [Migrated pull-request integration review](testing/migration-pr-review.md) — Merge decisions, integration fixes, native verification and excluded concurrent work. - [Testing and acceptance index](testing/README.md) — Entry point for test procedures, evidence and review records. - [AMD RDNA2 desktop GPU (gfx1030) form acceptance](testing/shader-form-acceptance.md) — Independence, command, log and promotion rules for fixture-verified instruction forms. - [Engineering progress](progress.md) — Verification commands, metric definitions, and open release gates. diff --git a/docs/testing/README.md b/docs/testing/README.md index 79d549e..d2103a0 100644 --- a/docs/testing/README.md +++ b/docs/testing/README.md @@ -1,5 +1,6 @@ # Testing and acceptance +- [Migrated pull-request integration review](migration-pr-review.md) — Merge decisions, fixes, native verification and remaining scope limits. - [AMD RDNA2 desktop GPU (gfx1030) form acceptance](shader-form-acceptance.md) — Rule and evidence required to promote a form from local results to `fixture verified`. - [Test inventory comparison](test-inventory.md) — Detect missing or newly ignored Cargo tests across commits. - [Persistent resource and translated rendering acceptance](x9-acceptance.md) — Native ARM64 results and unsupported cases. diff --git a/docs/testing/migration-pr-review.md b/docs/testing/migration-pr-review.md new file mode 100644 index 0000000..e45d22b --- /dev/null +++ b/docs/testing/migration-pr-review.md @@ -0,0 +1,96 @@ +# Migrated pull-request integration review + +Reviewed on November 24, 2026 (America/Chicago). The initial inventory contained +23 open pull requests under `Arths17`, including the development-plan PR. +Twenty-two were merged after their updated heads passed the applicable GitHub +checks. Imported records retain their original author attribution and commits. + +The maintainer authorized per-merge admin overrides for the review restriction. +The ARM64 build/test requirement, one-approval rule, code-owner review requirement +and enforcement for admins remain configured. Failed or pending checks were +resolved before merging. The conditional `verify` comment job is normally skipped; +that skip is not independent semantic verification. + +## Results + +All links below refer to the BetterXen repository. + +| PR | Result | Integration work | +| --- | --- | --- | +| [#263](https://github.com/MacosPorters/betterxen/pull/263) | Pending | Pending: overlaps the contributor's live PR #290, excluded by the maintainer. | +| [#264](https://github.com/MacosPorters/betterxen/pull/264) | Merged; checks passed | Identification fixture runs in ordinary tests; benchmark-harness lint fixed. | +| [#265](https://github.com/MacosPorters/betterxen/pull/265) | Merged; checks passed | Bounded native texture staging; planner and Metal readback tests. | +| [#266](https://github.com/MacosPorters/betterxen/pull/266) | Merged; checks passed | Startup measurement harness; unit tests and correctness smoke run. | +| [#267](https://github.com/MacosPorters/betterxen/pull/267) | Merged; checks passed | Bounded flat draws and repeated-frame regressions. | +| [#268](https://github.com/MacosPorters/betterxen/pull/268) | Merged; checks passed | Windows x64 calling conventions; writable-home-slot regression and nonvolatile vector-register negative controls. | +| [#269](https://github.com/MacosPorters/betterxen/pull/269) | Merged; checks passed | Executable generations with source revalidation; original cache assertions preserved. | +| [#270](https://github.com/MacosPorters/betterxen/pull/270) | Merged; checks passed | ARM64 shift encoding and operand checks; draft marked ready. | +| [#271](https://github.com/MacosPorters/betterxen/pull/271) | Merged; checks passed | Floating-point unit initialization, combined decoder generation and preserved tests. | +| [#272](https://github.com/MacosPorters/betterxen/pull/272) | Merged; checks passed | Dynamic binary translation (DBT) report comparison and input validation. | +| [#273](https://github.com/MacosPorters/betterxen/pull/273) | Merged; checks passed | C startup service integration and registry regeneration. | +| [#274](https://github.com/MacosPorters/betterxen/pull/274) | Merged; checks passed | Instruction-length faults and precise retirement. | +| [#275](https://github.com/MacosPorters/betterxen/pull/275) | Merged; checks passed | Flag-transfer instructions; combined fixtures and supported-case expectations retained. | +| [#276](https://github.com/MacosPorters/betterxen/pull/276) | Merged; checks passed | Explicitly unsupported service stubs and combined registry. | +| [#277](https://github.com/MacosPorters/betterxen/pull/277) | Merged; checks passed | Guest arguments and environment with combined services. | +| [#278](https://github.com/MacosPorters/betterxen/pull/278) | Merged; checks passed | Packed texture footprints; CPU and native GPU checks. | +| [#279](https://github.com/MacosPorters/betterxen/pull/279) | Merged; checks passed | Loop instructions; regenerated tables and corrected description to 3,600 comparisons. | +| [#280](https://github.com/MacosPorters/betterxen/pull/280) | Merged; checks passed | Process termination and exit callbacks. | +| [#281](https://github.com/MacosPorters/betterxen/pull/281) | Merged; checks passed | Formatted output integrated with startup and arguments. | +| [#282](https://github.com/MacosPorters/betterxen/pull/282) | Merged; checks passed | File streams; combined registry and dependency readiness. | +| [#283](https://github.com/MacosPorters/betterxen/pull/283) | Merged; checks passed | Hosted C fixture; driver architecture checked before execution. | +| [#284](https://github.com/MacosPorters/betterxen/pull/284) | Merged; checks passed | Thread-local storage (TLS) template-copy integration and preserved changelog entries. | +| [#288](https://github.com/MacosPorters/betterxen/pull/288) | Merged; checks passed | Development phases, README and migration-check record. | + +PR #263 remains open to avoid competing with the contributor's live PR #290. +PR #290 was excluded from branch edits, reviews and merge operations as requested. +Its filesystem security and integration acceptance are left to that workstream. + +## Verification and evidence scope + +The integrated runtime candidate was +`5366b9398668128fdbb0b0879840dfa072bfa352`. Its GitHub native Rust workflow passed, +including workspace formatting, strict Clippy, tests and the hosted C fixture. +Local native results below concern the reported Apple M4 host running macOS 27.0 +(class A host observations); they establish no Xbox-hardware or commercial-game +execution result. + +| Check | Observed result | +| --- | --- | +| `scripts/test-gpu.sh` | 124 passed, 0 failed; 2 manual timing tests ignored. Metal API and GPU validation enabled. | +| Packed block-compressed texture GPU target | 1 passed, 0 failed, 0 ignored, with both validation layers enabled. | +| `scripts/demo.sh` | All three original fixtures matched Metal, reference and known-answer outputs. | +| `scripts/audit/native.sh` | 110 executables/loadable dependencies checked with `file`, `lipo` and `otool`; ARM64 architecture and permitted linkage checks passed. | +| Status, claims and dependency audits | Passed. | + +The cache fix also passed an isolated local workspace run at `44ac976`: 917 +passed, 0 failed, 35 ignored, plus strict Clippy. Its three alternating CPU +benchmark pairs used native release executables and identical original inputs: +per-run warm medians were 87.334–88.333 microseconds with per-byte validation and +15.625–18.791 microseconds with generation validation. Machine idleness was not +controlled. These measurements do not close the formal performance gate; their +candidate scope and cold results are recorded in PR #269. + +A supplemental benchmark test-harness command exposed a missing initialization +for the newly added cache-invalidation counter. The follow-up initializes that +fixture and runs the existing report, JSON, comparison and percentile tests via +an ordinary integration-test target, preserving their assertions. This lets +workspace CI detect future benchmark-test compilation failures. All 14 existing +tests passed through both the ordinary integration target and the documented +manual harness command; strict workspace Clippy passed as well. + +Raw final native logs, cache benchmark JSON and the PR-state inventory are kept +under ignored `artifacts/pr-integration/` in the lead checkout. PR checks and merge +records remain linked from each GitHub record. + +## Remaining acceptance + +This is an integration and execution record. Independent semantic and security +acceptance remains separate from implementer-run checks and administrative merge +permission. No release gates were redefined or releases created. Commercial Xbox +game execution remains unsupported. + +Active-block self-modifying code is tracked separately in +[issue #291](https://github.com/MacosPorters/betterxen/issues/291); native-code cache +reclamation remains [issue #95](https://github.com/MacosPorters/betterxen/issues/95). +The source fixture programs, desktop instruction evidence and native Mac results +retain their existing boundaries. From 146d2dd467e8146c649b67acf55326f1a3649750 Mon Sep 17 00:00:00 2001 From: Arths17 Date: Tue, 24 Nov 2026 22:46:05 -0600 Subject: [PATCH 2/2] Correct Win64 call-entry alignment wording Signed-off-by: Arths17 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 583987b..af426af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,7 +69,7 @@ remains unsupported. - Added opt-in shader IR common-subexpression elimination (`CompileOptions::eliminate_common_subexpressions` / `compile_with`) that reuses the first result of an equivalent pure vector unary or binary (#142). Equivalence is the same operation and the same operand values in the same order; constant operands match by bit pattern. Loads, stores, constant definitions, lane masks, merges, branches and other side-effecting or execution-mask-dependent ops are left in place. The pass runs after constant folding, so folded results stay constants and a later pure op on two equal folded constants can still be reused. Default `compile` keeps the historical IR. Covered by hand-derived known-answer compiler tests for reuse (and/xor, not, exact float add), for rejected loads, swapped subtracts, lane masks, lane merges and VCC selects, and for the four combinations with constant folding (1 + 2 = 3, and 1.0 + 2.0 = 3.0), and a check that the 13 golden fixtures, none of which repeats an expression, compile unchanged with the pass on. No speedup is claimed. - The loader now maps an image's PE headers at its image base (#333): the first `SizeOfHeaders` bytes of the file, read-only, in whole 4 KiB pages that are zero past `SizeOfHeaders`. Programs read their own headers this way; the mingw-w64 C runtime does so before `main`, and until now that read faulted. When startup relocates an image it writes the load base into the mapped `ImageBase` field after the relocations, so an entry aimed at that field cannot move it twice; this is Xenora's policy and has not been compared with Windows. A load is refused with the new `PeError::InvalidHeaderSize` when `SizeOfHeaders` is zero, ends before the section table, runs past the file, or its pages would reach into a section, and when the bytes handed to the loader are not the PE32+ headers that were parsed. The page rule refuses images with sub-page section alignment whose first section starts inside the header page, which loaded before. The header pages count toward the 256 MiB mapping budget, which is checked before anything is mapped. `ParsedPe::parse` and the static probe are unchanged. `tests/pe_headers.rs` covers guest reads at the preferred and a relocated base, a relocation aimed at `ImageBase`, the write and execute faults and each refusal with original hand-built images; the image in `pe_mapping_limits.rs` now carries a valid `SizeOfHeaders`. Awaiting independent re-review. - Added 35 known-answer cases for MOV with an immediate operand, opcodes C6 /0 and C7 /0 (#194), to `cpu_known_answers.rs`: byte, word, dword and qword stores through base, SIB, R12, R13, RSP and RBP addressing with 8-bit and 32-bit displacements; the imm32 sign extension of the 64-bit form; the register forms, including AH and a REX-selected SIL; unmapped and read-only store faults at each width; and #UD for reg field 1. Expected values come from the Intel SDM and were worked out by hand. The interpreter and the DBT already agreed with all of them, so this is new coverage and fixes no defect. The 16-bit forms covered are those that already run, and #118 stays open. Not compared with x86 hardware; awaiting independent review. -- Added Win64 service-call ABI tests in `crates/loader/tests/runtime_services.rs` for #201. A dispatch-level test and a DBT guest-call test verify 16-byte-aligned call entry (`RSP % 16 == 8`), caller-owned 32-byte shadow space accessibility/integrity, return-value/stack/RIP return state, and preservation of RBX/RBP/RDI/RSI/R12-R15 and XMM6-XMM15 across registered service calls. Expected values are derived from the Microsoft x64 calling convention, not from current implementation behavior. +- Added Win64 service-call ABI tests in `crates/loader/tests/runtime_services.rs` for #201. A dispatch-level test and a DBT guest-call test verify stack alignment before CALL and at callee entry (`RSP % 16 == 8`), accessibility of the caller-allocated 32-byte shadow space, return-value/stack/RIP return state, and preservation of RBX/RBP/RDI/RSI/R12-R15 and XMM6-XMM15 across registered service calls. Expected values are derived from the Microsoft x64 calling convention, not from current implementation behavior. - `dbt_bench` can compare two of its JSON documents when `XENORA_DBT_BENCH_COMPARE=,` is set (#114). It prints each median with its change and whether the change exceeds the larger recorded IQR, and lists changed DBT counters. It refuses, with exit status 1 and the differing field named, to compare runs from different CPUs, operating systems or architectures, with unknown host fields, or with different workloads, sample counts, debug assertions or build labels. A new optional `XENORA_DBT_BENCH_BUILD_LABEL` records build settings the benchmark cannot see, such as LTO. No benchmark runs in this mode. - LAHF and SAHF run in both engines, and guest CPUID reports them in leaf `8000_0001h`, ECX bit 0 (#387; Intel SDM Vol. 2A LAHF, Vol. 2B SAHF). The DBT runs them through the shared semantics. The four known answers from #155 that both engines refused are now verified, with twelve more cases, and the independent reference in `tests/x86_integer.rs` covers both instructions. - LOOP, LOOPE, LOOPNE and JRCXZ run in both engines (#396; Intel SDM Vol. 2A, LOOP/LOOPcc and Jcc). The count is RCX; the address-size prefix stays rejected, so JECXZ and the ECX-counted forms are still refused. The DBT runs them through the shared semantics and ends its block at each. The three known answers from #155 that both engines refused are now verified, with eleven more cases, and `tests/cpu_loop.rs` checks a loop that spans translated blocks against a step-by-step model for every count, ZF match point and step budget.