diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f049222..bbdcb0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,12 +8,18 @@ on: permissions: contents: read +concurrency: + group: native-rust-${{ github.ref }} + cancel-in-progress: true + jobs: native-rust: + name: ARM64 CPU and build checks runs-on: macos-26 timeout-minutes: 15 env: CARGO_BUILD_JOBS: 3 + PYTHONDONTWRITEBYTECODE: 1 CARGO_BUILD_TARGET: aarch64-apple-darwin RUSTUP_TOOLCHAIN: 1.100.0-aarch64-apple-darwin steps: @@ -29,16 +35,24 @@ jobs: run: | rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal --component rustfmt --component clippy rustc -vV + - name: Check generated status and PE fixtures + run: | + python3 scripts/audit/status.py --check + for fixture in x2 x3 x4; do + python3 "experiments/x1/fixtures/$fixture.py" --check || exit 1 + done - name: Check formatting and lint run: | cargo fmt --all -- --check cargo clippy --locked --workspace --all-targets -- -D warnings + cargo fmt --manifest-path experiments/x1/Cargo.toml -- --check + cargo clippy --locked --manifest-path experiments/x1/Cargo.toml --all-targets --all-features -- -D warnings - name: Run CPU tests and dependency checks run: | cargo test --locked --workspace + cargo test --locked --manifest-path experiments/x1/Cargo.toml scripts/audit/dependencies.sh scripts/audit/claims.sh - python3 scripts/audit/status.py --check - name: Inspect native CLI run: | cargo build --locked -p xenora diff --git a/.gitignore b/.gitignore index eb1c637..e65d15b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Rust and local builds /target/ +/experiments/x1/target/ /build/ /cmake-build-*/ /fuzz/target/ diff --git a/AGENTS.md b/AGENTS.md index 3df104d..3010fdc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -34,6 +34,8 @@ Never introduce Rosetta 2, x86-64 host executables, MoltenVK, Vulkan runtime dep - Contributors who have seen leaked or confidential Xbox materials must not contribute. State this in CONTRIBUTING.md and require a DCO sign-off (Signed-off-by) on contributions. - Include a plain statement in docs/legal.md: Xenora does not circumvent console security or DRM, does not load encrypted or protected content, and is a research project built from public documentation. Add a note that this is not legal advice and that contributors should know their local laws, including anti-circumvention provisions such as DMCA section 1201. - Before copying or adapting any upstream code: verify the exact license of that file (not just the repo), check GPL-3.0-or-later compatibility, preserve copyright notices, record source repository and exact commit, document modifications, include required attribution. Never remove upstream copyright notices. If licensing is uncertain, stop using that code until resolved. +- Keep Xenora's emulator implementation original. Never copy, port, translate or adapt emulator source from Leonida, KyTx, AnyPS5 or similar projects. +- Validate the technical compatibility and safety of user-provided files. Do not ask for ownership receipts, accounts or acquisition provenance as part of file loading. Contributor provenance and licensing obligations still apply. - Never place restricted material in the repository or its Git history. - Do not push, publish, or change remote visibility without explicit user authorization. Prepare locally and report readiness. @@ -43,6 +45,26 @@ No AI slop (section 29). Read docs/interfaces.md and docs/progress.md before implementation. +## Changelog maintenance + +- At the start of every engineering task, read `CHANGELOG.md` alongside the relevant project documentation. Review the existing `[Unreleased]` entries before implementation to avoid duplicating completed work. +- Update the changelog in the same task for every meaningful addition, modification, fix, removal or security change, including work implemented by another agent. Use `Added`, `Changed`, `Fixed`, `Removed` or `Security` as appropriate. +- Write concise entries that explain the effect for users or contributors. Distinguish implemented behavior, local verification and independent acceptance. Never invent release dates, versions, benchmark results, passing tests or compatibility claims. +- Omit trivial formatting and intermediate steps unless they materially affect maintainability. Keep unreleased changes under `[Unreleased]` until a release is authorized. +- Before concluding the task, check whether the changelog needs an update and make it when warranted. Rewrite historical entries only to correct factual errors. Preserve existing content when tightening the prose. + +## Public documentation and terminology + +- Write public documentation so readers can understand it without earlier agent conversations. Keep `README.md` and `docs/README.md` accessible to new contributors. +- Introduce descriptive names before internal identifiers such as X1, G10 or P2-04. Define specialist abbreviations on first meaningful use. +- Write changelog entries around actual behavior and its effect on users or contributors. Distinguish implementation, synthetic demonstrations, independent verification and real Xbox execution. +- Review terminology whenever editing documentation. Use concise, precise explanations and preserve evidence scope. +- Update `docs/README.md` whenever you add, remove, rename or substantially reorganize documentation. + +## Subagent reasoning + +**Every spawned subagent must use LOW reasoning effort.** Explicitly select LOW and verify the resolved configuration. Never use Medium, High or Extra High. If LOW cannot be guaranteed, proceed without that subagent. The lead agent may use the user-selected reasoning setting. + ## Checkout commands - Format: `cargo fmt --all -- --check` diff --git a/CHANGELOG.md b/CHANGELOG.md index 546e869..b241daf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,38 @@ # Changelog -Notable project changes will be recorded here. Entries describe implemented and verified changes, not roadmap promises. Releases should identify their exact revision and known limitations; experimental interfaces may change. +Notable changes are grouped using [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). +Experimental interfaces may change. Authorized releases should identify their +exact revision and known limitations. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] -## Unreleased +Guest execution uses original, purpose-built test programs. Commercial Xbox game execution +remains unsupported. ### Added +- Added a public documentation index for architecture, validation, and contributor references. + +- Added a bounded x86-64 guest interpreter on native ARM64 macOS (X1), plus a loader for original fixed-base 64-bit Portable Executable (PE32+) fixtures and an experimental add-one service (X2). +- Added guest-to-GPU command submission for a validated synthetic compute workload (X3) and guest-driven Metal rendering to an offscreen 8×8 RGBA8 texture (X4). Independent review confirmed the compute output and every pixel for both rendering inputs on Apple M5. +- Added a typed shader intermediate representation and Metal Shading Language generation for a bounded subset of 32-lane AMD RDNA 2 compute on the desktop gfx1030 target, with fixture validation on Apple M5. Expanded the verified vector-register-only forms to include bitwise OR and logical shifts. Arithmetic right shift passed local CPU and Metal checks, with independent acceptance still open. +- Added independent CPU known-answer fixtures, LLVM decoder comparisons, and source and native semantic mutation checks. +- Added a correctness-gated benchmark harness that records stage timings, power source, and thermal state. - Repository contribution guidelines, issue forms, pull request checklist, community expectations and security reporting policy. + +### Changed + +- Added native ARM64 CI and repository audits for dependency direction, claims, and generated status. Expanded CI to check the standalone guest experiment, synthetic PE fixture bytes, and progress asset consistency. +- Reworked the README around demonstrated capabilities and added a deterministic SVG drawn from the reviewed form inventory and guest acceptance records. +- Made reading and updating the changelog mandatory for engineering work. + +### Fixed + +- Validate branch targets, buffer bindings, and program termination throughout a shader fixture, including instructions skipped by a resolved branch. +- Include arithmetic right shift in fixture reassembly checks and let bootstrap continue when optional LLVM discovery fails. + +### Removed + +- Removed the superseded Phase 01 continuation prompt and redundant planning instructions. Candidate verification records remain in the assurance documentation. + +- Removed the speculative seven-phase roadmap from the README. diff --git a/README.md b/README.md index 8055115..4e1e135 100644 --- a/README.md +++ b/README.md @@ -1,96 +1,75 @@ - # Xenora -**Xbox architecture. Apple Silicon. Native Metal.** +**Xbox Series X|S emulation research for Apple Silicon** -Xenora is an experimental, open-source recompilation framework for Xbox Series X|S targeting native ARM64 execution on macOS. Its graphics subsystem, **XenoMetal**, is designed to translate RDNA shader machine code into Metal Shading Language (MSL) for execution on Apple GPUs. +Xenora is an original Rust project targeting native ARM64 macOS. It runs small x86-64 guest programs written for testing and translates a bounded subset of AMD RDNA 2 compute shaders for the desktop gfx1030 target to Metal Shading Language (MSL). Commercial game execution and proprietary Xbox containers are unsupported. -Xenora takes a Metal-first approach rather than relying on a Vulkan runtime, MoltenVK, Rosetta 2 or a Windows compatibility layer. +[![Native Rust checks](https://github.com/ranveersoni98/Xenora/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/ranveersoni98/Xenora/actions/workflows/ci.yml) -> [!IMPORTANT] -> Xenora is an early-stage research project. Game execution, proprietary Xbox containers and full guest execution-mask divergence are unsupported. -## XenoMetal +## Current status -XenoMetal is the graphics translation subsystem of Xenora. Its intended scope includes shader decoding, recompilation, GPU resource translation and native Metal execution. +| Milestone | Demonstrated with original fixtures | +| --- | --- | +| Native guest instruction execution (X1) | Bounded x86-64 interpreter on ARM64 macOS, with checked register, flag and memory results. | +| Executable loading (X2) | Loads fixed-base 64-bit Portable Executable (PE32+) test images and dispatches an experimental add-one service. | +| Guest-to-GPU command submission (X3) | An interpreted guest program submits a validated synthetic compute command to the native Metal backend. Three output words and guest completion were checked. | +| Guest-driven Metal rendering (X4) | An original guest command renders an offscreen 8×8 RGBA8 target on Apple M5. For fixture parameters 17 and 93, independent review checked every pixel against `[x, y, parameter, 255]`. | -The synthetic compute fixtures run through this pipeline. An independent CPU interpreter executes the original binary for comparison. +The [guest execution baseline](docs/testing/phase-02-baseline.md#implementation-checkpoint) records independent acceptance of X1–X4 and class A native evidence for X3 and X4 on Apple M5. + +The [gfx1030 form inventory](docs/shaders/instruction-coverage.md) tracks decoding, lowering, reference execution, CPU tests and Metal readback separately. The verified compute fixtures cover restricted operand forms, including vector-register-only `v_or_b32_e32`, `v_lshlrev_b32_e32` and `v_lshrrev_b32_e32` (class A, Apple M5). Arithmetic right shift (`v_ashrrev_i32_e32`) passed local CPU and Apple M5 readback checks (class A). Independent acceptance remains open. + +Per-lane control flow and handling of the execution and vector condition masks (EXEC and VCC) and authentic Xbox command and service interfaces remain open. The recorded Apple M5 runs establish behavior for the tested fixtures on that host. + +## Architecture ```mermaid flowchart TD - A[RDNA shader machine code] --> P[Fixture parser] - P --> B[Instruction decoder] - B --> C[Shader IR] - C --> D[Semantic validation] - D --> E[Metal Shading Language] - E --> F[Native Metal backend] - F --> G[Apple GPU] + subgraph CPU["Guest Execution"] + A["Synthetic PE32+ Executable"] --> B["Bounded x86-64 Interpreter"] + B --> C["Synthetic Service Dispatch"] + C --> D["Typed GPU Command"] + end + + subgraph GPU["Native Metal Execution"] + D --> E["Apple Metal"] + E --> F["GPU Readback"] + end + + subgraph SHADER["RDNA2 Shader Translation"] + G["gfx1030 Fixture"] --> H["RDNA Decoder"] + H --> I["Validated Shader IR"] + I --> J["MSL Generation"] + J --> E + end + + subgraph VERIFY["Independent Verification"] + G --> K["Separate CPU Reference"] + K --> L["Expected Results"] + F --> M{"Results Match?"} + L --> M + end ``` -Run `scripts/demo.sh` to execute three original gfx1030 compute fixtures on Apple Silicon. Integer addition, bitwise and scalar branch, and restricted FP32 outputs matched the independent CPU reference and hand-derived values on Apple M5 (class A, CLAIM-METAL-M5-RDNA-DEMO). Run `scripts/test-gpu.sh` for native Metal correctness, including offscreen rendering with original MSL (class A, CLAIM-METAL-M5-NATIVE-SUITE). The [status file](docs/status.toml) records the verified scope. SPIR-V may be used as an optional compiler intermediate representation without introducing a Vulkan runtime dependency. +The guest fixtures submit compute or draw commands with project-defined resource and argument layouts. The gfx1030 fixtures exercise a separate shader translation path. The offscreen render uses an original Metal shader. Xenora runs natively without Rosetta, Wine, CrossOver, MoltenVK or a Vulkan runtime. See the [interface contracts](docs/interfaces.md). -## Host and guest compatibility +## Build and test - -| Feature | Target | Implementation | Correctness | Hardware | Evidence | Limits | -| --- | --- | --- | --- | --- | --- | --- | -| native-compute | arm64 macOS | implemented | initial-native-suite-passed | verified on Apple M5 | A | Trusted MSL with bounded word buffers and an original native offscreen rendering test on Apple M5. | -| synthetic-gfx1030 | gfx1030 Wave32 | three-fixture-demo-implemented | three-way-output-passed | verified on Apple M5 | A, B | Synthetic memory contract, statically resolved forward control flow, exact positive normal FP32 only. | -| xbox-execution | Xbox Series X\|S | unsupported | untested | unverified | U | Game execution, proprietary guest containers and full guest execution-mask divergence are unsupported. The console launch ABI is unknown. | - - -## Development roadmap - -The following describes the project's intended development stages, not a claim that the features are already implemented. - -| Phase | Focus | -| --- | --- | -| 01 | Native Metal foundations, RDNA decoding, shader IR, MSL generation and reference validation | -| 02 | Upstream research, selective integration and expanded instruction coverage | -| 03 | Graphics pipelines, texture addressing, resource binding and wave semantics | -| 04 | Shader optimization, pipeline caching and Apple Silicon performance | -| 05 | Native x86-64 to ARM64 CPU recompilation | -| 06 | Guest runtime and publicly documented system interfaces | -| 07 | Integrated execution and compatibility validation using authorized test programs | - -## Development and testing - -Xenora targets the native Rust `aarch64-apple-darwin` toolchain and Apple's Xcode and Metal development tools. The gfx1030 oracle tests check the production and reference decoders against Homebrew LLVM AMDGPU. - -Run the standard Rust checks from the workspace root: +Use native Apple Silicon macOS, Rust 1.100.0 for `aarch64-apple-darwin`, Xcode with Metal tools, and Python 3.11 or later. Native Homebrew LLVM is needed for fixture reassembly. ```sh +scripts/bootstrap.sh +cargo build --locked -p xenora cargo fmt --all -- --check -cargo clippy --workspace --all-targets -- -D warnings -cargo test --workspace +cargo clippy --locked --workspace --all-targets -- -D warnings +cargo test --locked --workspace +cargo test --locked --manifest-path experiments/x1/Cargo.toml +scripts/assemble-fixture.sh --check ``` -Run `scripts/bootstrap.sh` to check the native toolchain and `scripts/assemble-fixture.sh --check` to verify the synthetic gfx1030 fixture with LLVM. The [Phase 01 checkpoint](docs/progress.md) records the implementation and validation status. +On a Metal-capable Apple Silicon host, run `scripts/test-gpu.sh` for native correctness and `scripts/demo.sh` for the three baseline shader fixtures. The [guest experiment guide](experiments/x1/README.md) covers X1–X4 reproduction. The CI badge covers the hosted Rust and repository checks. Hardware results are recorded in the [validation evidence](tests/validation/README.md). -## Research and documentation +## Contributing and license -Xenora draws on publicly available technical specifications and documentation, including: - -- [AMD GPU architecture programming documentation](https://gpuopen.com/amd-gpu-architecture-programming-documentation/) -- [AMD machine-readable ISA](https://gpuopen.com/machine-readable-isa/) -- [Apple Metal documentation](https://developer.apple.com/documentation/metal/) -- [Metal resources and specifications](https://developer.apple.com/metal/resources/) -- [Microsoft Game Development Kit](https://learn.microsoft.com/en-us/gaming/gdk/) -- [DirectX specifications](https://microsoft.github.io/DirectX-Specs/) -- [LLVM AMDGPU documentation](https://llvm.org/docs/AMDGPUUsage.html) - -Public RDNA 2 specifications do not establish every Xbox-specific GPU behavior. Unknown or undocumented semantics must remain explicitly identified rather than assumed to be equivalent. - -## Contributing - -Contributions in GPU architecture research, Rust systems programming, shader compilers, Metal development, independent testing and technical documentation are welcome. - -Changes should include a clear technical rationale, relevant specification references, meaningful tests and accurate documentation. Upstream code and fixtures must have verified provenance and compatible licensing. AI-assisted contributions are subject to the same review, correctness and attribution requirements as other contributions. - -## License - -Xenora is licensed under the [GNU General Public License, version 3 or later](LICENSE). Third-party components retain their applicable licenses and copyright notices. - -Xenora does not distribute proprietary game binaries, console firmware, encryption keys or restricted Xbox SDK material. The project does not aim to circumvent DRM or console security mechanisms. - -Xenora is an independent project and is not affiliated with or endorsed by Microsoft, Xbox, AMD or Apple. All third-party trademarks belong to their respective owners. +See the [contribution guide](CONTRIBUTING.md) for Developer Certificate of Origin (DCO) sign-off and public-source requirements, and the [legal policy](docs/legal.md) for permitted inputs. Xenora is licensed under the [GNU GPL v3 or later](LICENSE). Third-party notices are listed separately in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md). diff --git a/benchmarks/results/apple-m5/run-1795338391/report.md b/benchmarks/results/apple-m5/run-1795338391/report.md index d16e007..e0bb028 100644 --- a/benchmarks/results/apple-m5/run-1795338391/report.md +++ b/benchmarks/results/apple-m5/run-1795338391/report.md @@ -20,7 +20,7 @@ Generated by `xenora-bench`. Every timed fixture passed its correctness test in | Thermal | no warnings recorded | | Repetitions | 7 measured, 2 warm-up | -> **Protocol note.** The machine was not confirmed on AC power. The [benchmark protocol](../../docs/testing/benchmarks.md) requires AC power, so these timings are not protocol-compliant release evidence. +> **Protocol note.** The machine was not confirmed on AC power. The [benchmark protocol](../../../../docs/testing/benchmarks.md) requires AC power, so these timings are not protocol-compliant release evidence. ## Coverage diff --git a/benchmarks/src/main.rs b/benchmarks/src/main.rs index 7e27d59..0d068a5 100644 --- a/benchmarks/src/main.rs +++ b/benchmarks/src/main.rs @@ -677,7 +677,7 @@ fn report_markdown(metadata: &Metadata, results: &[FixtureResult]) -> String { let _ = writeln!( out, "> **Protocol note.** The machine was not confirmed on AC power. \ - The [benchmark protocol](../../docs/testing/benchmarks.md) requires AC power, \ + The benchmark protocol in `docs/testing/benchmarks.md` requires AC power, \ so these timings are not protocol-compliant release evidence." ); } diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..e4dda38 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,46 @@ +# Xenora documentation + +## Getting started + +Start with the [project README](../README.md) for scope and build commands, +then read the [interface contracts](interfaces.md). Reproduce an +[original guest test program](../experiments/x1/README.md) or run the +[independent validation suite](../tests/validation/README.md) before changing +either path. The [changelog](../CHANGELOG.md) records notable changes. + +## Architecture and technical design + +- [Interface contracts](interfaces.md) — Shader inputs, guest services, and native command submission. +- [Fixture memory model](adr/0003-demo-memory-model.md) and [CPU boundary](adr/0004-cpu-boundary.md) — Buffer bindings, guest address translation, and dependency direction. + +## RDNA 2 decoding and shader translation + +- [Instruction coverage](shaders/instruction-coverage.md) — Desktop gfx1030 instruction forms, operand limits, and CPU and GPU results. +- [Metal Shading Language generation](shaders/msl.md) and [independent CPU reference](shaders/reference-interpreter.md) — Translation rules and separate CPU execution models. + +## Native Metal backend + +- [Compute interface](interfaces.md#gfx1030-compute-fixtures) — Resource limits, dispatch, completion, and profiling. +- [Apple GPU evidence](research/apple-gpu.md) and [host lab record](research/host-lab.md) — Observed behavior and historical floating-point results. + +## Guest CPU and runtime experiments + +- [Guest experiment guide](../experiments/x1/README.md) — Bounded x86-64 execution, executable loading, experimental services, native compute, and offscreen rendering. +- [Guest CPU research](research/cpu-boundary.md) — Public specifications and unresolved console requirements. + +## Testing, validation, and benchmarks + +- [Engineering progress](progress.md) — Verification commands, metric definitions, and open release gates. +- [Baseline acceptance](testing/phase-02-baseline.md), [Phase 01 assurance](testing/phase01-assurance.md), and [independent reviews](testing/review-log.md) — Candidate-specific results and release findings. +- [Mutation testing](testing/mutation.md) and [benchmark protocol](testing/benchmarks.md) — Test sensitivity, benchmark inputs, and timing requirements. + +## Research and engineering decisions + +- [Public sources](research/sources.md), [RDNA 2 notes](research/rdna2.md), and [Xbox GPU evidence](research/xbox-gpu.md) — Specifications, evidence scope, and unknown console behavior. +- [Shader inputs](research/shader-containers.md) and [risk register](risk-register.md) — Input provenance and unresolved engineering risks. + +## Security, licensing, and contributions + +- [Threat model](threat-model.md) and [security reporting](../SECURITY.md) — Execution limits and disclosure instructions. +- [Legal scope](legal.md), [dependency licensing](licenses.md), and [third-party notices](../THIRD_PARTY_NOTICES.md) — Input policy, attribution, and redistribution findings. +- [Contribution guidelines](../CONTRIBUTING.md) — Original authorship, Developer Certificate of Origin sign-off, and evidence requirements. diff --git a/docs/assets/xenora-progress.svg b/docs/assets/xenora-progress.svg new file mode 100644 index 0000000..56667fe --- /dev/null +++ b/docs/assets/xenora-progress.svg @@ -0,0 +1,21 @@ + +Xenora · recorded progress +Decoded gfx1030 forms: 19 of 19. Accepted Metal forms · Apple M5: 18 of 19. Accepted guest milestones · X1–X4: 4 of 4 + + +RECORDED FIXTURE PROGRESS +Decoded gfx1030 forms +19 / 19 + + +Accepted Metal forms · Apple M5 +18 / 19 + + +Accepted guest milestones · X1–X4 +4 / 4 + + +Scope: tracked instruction forms and four synthetic guest milestones. + + diff --git a/docs/handoff/NEXT_AGENT_PROMPT.md b/docs/handoff/NEXT_AGENT_PROMPT.md deleted file mode 100644 index c520c9f..0000000 --- a/docs/handoff/NEXT_AGENT_PROMPT.md +++ /dev/null @@ -1,86 +0,0 @@ -# Ready-to-paste next-thread prompt - -Continue Xenora in the **same existing local workspace** -`/Users/ranveersoni/Developer/Xenora`. -Repository: https://github.com/ranveersoni98/Xenora. -Xenora is an original GPL-3.0-or-later Rust research emulator for -native Apple Silicon ARM64 macOS and native Metal. The strategic target -is Xbox Series X|S software execution, with GTA VI's genuine intro/title -screen a stretch goal. Current evidence is for original synthetic programs. - -**THIS IS A CONTINUATION OF EXISTING VERIFIED WORK. DO NOT RESTART XENORA OR REIMPLEMENT COMPLETED X1–X4 MILESTONES.** - -Before editing or launching agents, read `docs/handoff/START_HERE.md`, -`SESSION_2026-11-23.md`, `VERIFIED_EVIDENCE.md` and `NEXT_PRIORITIES.md` -in that directory, plus `AGENTS.md`, `docs/interfaces.md` and -`docs/progress.md`. The preserved authoritative V3 and dual-track prompts -and historical V4 are under `artifacts/handoff/specifications/`. Use the -handoff's current policy corrections over historical upstream-reuse -language. Existing G1–G15 and P2-01–P2-10 criteria remain binding. - -Inspect `git status --short --branch`, `git rev-parse HEAD`, -`git branch -vv`, `git worktree list`, tracked and staged diffs, and -nonignored untracked files. The handoff base was -`4b9a4cecf35c8d4d90d8ecdb9c1510e7bd260102` on `main` tracking -`origin/main`, with significant unstaged and untracked work, including -the entire guest experiment. Check actual state. Preserve code, fixtures, -logs and hashes. Do not reset, clean, stash, rebase, rewrite history or -discard user edits. No push, publication, release, tag or remote changes -without authorization. Do not append false human DCO attestations or -use a human identity to certify work. - -Baseline: Phase 01 passed 11 gates, including G9. G10 controlled -benchmarks, G11 redistribution, G12 human DCO attestations and G15 -final independent candidate review remain open. These are release -requirements. X1 performed bounded x86-64 interpretation, X2 loaded -original fixed-base PE32+ and dispatched a synthetic service, X3 -independently proved original PE-driven native compute, and X4 -independently verified original guest-driven 8×8 RGBA8 Metal draw. -VGPR-only gfx1030 OR and both logical shifts passed LLVM, independent -CPU expectations and validated Metal readback. ASHR is implemented -with LLVM-only acceptance evidence at handoff. - -**First task:** independently verify `v_ashrrev_i32_e32` in the existing -decoder, IR, reference and MSL implementation. Use the exact targeted -commands in `docs/handoff/NEXT_PRIORITIES.md` and fixture instructions -in `fixtures/rdna2/ashr.md`. Check signed and unsigned interpretations, -count wrap, aliasing and malformed or unsupported cases. Run Rust, -LLVM and real Metal checks and keep exact output and exit evidence. -Fix any actual failures with focused regressions, reconcile the fixture -and status integration, then proceed with integration assurance and -original Wave64/EXEC fixtures followed by bounded mask semantics. Grow -guest semantics and mappings incrementally. Defer full ARM64 -recompilation until correctness and profiling justify it. - -Maintain Xenora's independently authored Rust architecture, decoder, -typed IR, compiler and native Metal backend. Use public specifications -and original fixtures. Never copy, port, translate or import another -emulator's code, tables, internal metadata or architecture. Leonida -and KyTx are ecosystem references only. No Rosetta, Wine, CrossOver, -Windows compatibility layer, OpenGL fallback, Vulkan or MoltenVK runtime. -Use runtime capability detection and verify real native ARM64 linkage. -No restricted source, SDKs, keys, game distributions or circumvention. - -User-provided game files get technical format, bounds, compatibility -and security checks. Do not request ownership receipts, accounts, or -acquisition history, or reject a technically compatible file solely -because its source is unknown. Project-run tests and contributions -follow their own provenance rules. - -Every spawned implementation or review agent must explicitly use -**LOW reasoning**, verified from the resolved settings. If low cannot -be guaranteed, do not spawn. Use nonoverlapping ownership and -independent specification-derived expectations or review. Keep heavy -builds, GPU runs, fuzz and benchmarks serial on the fanless M5, normally -two Cargo jobs. Reuse valid evidence. Do not repeat completed Phase 01 -fuzz or mutation campaigns or accepted guest GPU work without a -specific changed-code risk. Benchmarks need correct workloads and -documented power, thermal and idle conditions. - -Report what changed, exact file paths, base SHA and working-tree -snapshot, named tests, counts, exits, failures, tool and device -conditions, native GPU results, independent review and remaining -blockers. Distinguish tests that ran from skips or pending checks. -Never claim commercial game execution, speedups or closed gates without -matching evidence. After orientation, implement and verify the first -eligible task instead of rewriting the roadmap. diff --git a/docs/handoff/NEXT_PRIORITIES.md b/docs/handoff/NEXT_PRIORITIES.md deleted file mode 100644 index 1c2b6ed..0000000 --- a/docs/handoff/NEXT_PRIORITIES.md +++ /dev/null @@ -1,113 +0,0 @@ -# Next priorities - -## P0 — Finish arithmetic shift acceptance - -Begin with [#19](https://github.com/ranveersoni98/Xenora/issues/19). -The working-tree implementation is VGPR-only gfx1030 Wave32 -`v_ashrrev_i32_e32`. An independently derived signed-shift oracle must -cover sign extension, a nonnegative source, counts modulo 32, aliasing, -register extrema and malformed or unsupported variants. Existing -LLVM evidence is valid for the fixture hash in -[ashr.md](../../fixtures/rdna2/ashr.md). Native Rust and Metal test cases -exist and have no recorded acceptance run. Verify their expected values -independently and use the exact commands below before updating status. - -```sh -export CARGO_BUILD_JOBS=2 -export LLVM_BIN="$(brew --prefix llvm)/bin" -cargo fmt --all -- --check -cargo test --locked -p xenora-semantic-review arithmetic_right_shift_preserves_sign_and_wraps_counts -cargo test --locked -p xenora-decoder --test gfx1030 -- --include-ignored --nocapture -MTL_DEBUG_LAYER=1 MTL_SHADER_VALIDATION=1 MTL_SHADER_VALIDATION_REPORT_TO_STDERR=1 \ - MTL_SHADER_VALIDATION_ABORT_ON_FAULT=1 timeout 30s \ - cargo test --locked -p xenora-semantic-review arithmetic_right_shift_native_metal_known_answers \ - -- --ignored --nocapture --test-threads=1 -``` - -Capture separate exit codes, named test counts, input and output coverage, -fixture hashes, working-tree patch and device validation evidence. A -filtered run that discovers zero tests provides no acceptance evidence. -If a probe fails, keep it as a focused regression and rerun affected -checks. Check the fixture is represented in the standard assembly and -status workflow after acceptance. The current assembly script enumerates -the previous five fixtures and excludes ASHR. - -Then reconcile integration: run workspace format, strict all-feature -Clippy, workspace tests, `scripts/test-gpu.sh`, `scripts/audit/native.sh`, -and the [isolated experiment's tests](../../experiments/x1/README.md) -with and without `metal` as needed by the affected paths. Preserve -independently accepted X1–X4 results and rerun their exact GPU paths -only for an affected integration. Use serial heavy jobs. Prepare -candidate-specific mutation and fuzz plans for changed paths -([#53](https://github.com/ranveersoni98/Xenora/issues/53)); use the -actual inherited acceptance criteria. A targeted campaign supplements -Phase 01 evidence and does not retroactively change it. - -## P1 — Establish lane-state semantics - -Author original 64-lane Wave64/EXEC expected outputs first -([#20](https://github.com/ranveersoni98/Xenora/issues/20)). -Cover full, empty, alternating and asymmetric masks, lanes 0/31/32/63, -nested save/restore, and single scalar side effects. Use AMD specifications -and an independent CPU oracle. Then choose one bounded EXEC/VCC -operation on Wave32 with exact inactive-lane preservation and controlled -rejection. Expand to divergence and Wave64 only after explicit mask -semantics, lane mapping and independent readback are established -([#24](https://github.com/ranveersoni98/Xenora/issues/24)). - -Next, add checked descriptor, buffer and image access with lifetime -tests. Extend stages and render targets through exact pixel checks. -X4's host-authored render pipeline establishes a guest-driven draw; -guest RDNA vertex/fragment translation is a separate milestone. -For each change use public spec, original implementation, independent -oracle, LLVM where applicable, real Metal execution and independent review. - -## P2 — Expand guest execution - -Use [#38](https://github.com/ranveersoni98/Xenora/issues/38) for one -measurable register/flags/fault instruction slice and -[#48](https://github.com/ranveersoni98/Xenora/issues/48) for a checked -mapping/resource-lifetime slice. Preserve the interpreter as a reference, -the bounded loader and explicit service ABI. Expand only as required by -an original test program. Check rejected ranges and store atomicity, -permissions, resource ownership through completion, and repeat results. -Keep production graphics independent of guest CPU code. - -## P3 — Native ARM64 recompilation - -Profile representative interpreter workloads first. Translate one -independently modeled basic block, compare state and fault outcomes -with the interpreter, and verify native code execution. Broader -translation needs executable memory and code publication policy, -invalidation, handling of guest ordering, exceptions and SIMD, and -matched correctness-gated performance results. - -## P4 — Release assurance - -- [G10](https://github.com/ranveersoni98/Xenora/issues/11) complete the - full correctness-gated corpus and controlled idle AC protocol, with - stage timing, cold/warm data, thermal/capability metadata and variability. -- [G11](https://github.com/ranveersoni98/Xenora/issues/12) apply the - [attribution and binary audit](../licenses.md#runtime-redistribution-review) - to the exact archive and source offer, and resolve Apple-derived - redistribution rights. -- [G12](https://github.com/ranveersoni98/Xenora/issues/13) obtain authentic - contributor attestations for the six recorded historical commits. -- [G15](https://github.com/ranveersoni98/Xenora/issues/16) final independent - R1 and R2 reports on the exact candidate with all prerequisites met. - -These gates remain release requirements. Unrelated isolated experiments -can proceed with accurate evidence and provenance. - -## P5 — Genuine Xbox execution - -Remaining work includes Xbox-specific executable and process contracts, -CPU execution and translated state, memory permissions, thread and -system services, command and descriptor decoding, GPU resource lifetime, -coherence and synchronization, shader stages, audio/input, and -compatibility and performance validation. Use public specifications -and suitable project test inputs. The -[user-file policy](../legal.md#user-provided-game-files) applies to -import. Track the technical compatibility path under -[#55](https://github.com/ranveersoni98/Xenora/issues/55). A genuine measured -GTA VI intro/title screen remains a long-term stretch goal. diff --git a/docs/handoff/SESSION_2026-11-23.md b/docs/handoff/SESSION_2026-11-23.md deleted file mode 100644 index ba4737b..0000000 --- a/docs/handoff/SESSION_2026-11-23.md +++ /dev/null @@ -1,145 +0,0 @@ -# Session record — 2026-11-23 - -## Repository state - -The sole local Git worktree is `/Users/ranveersoni/Developer/Xenora` on -`main`, tracking `origin/main`. HEAD, upstream and GitHub main all resolve to -`4b9a4cecf35c8d4d90d8ecdb9c1510e7bd260102` (0 ahead, 0 behind). -There are no staged changes. Before adding the five handoff documents, -the tracked diff was 28 modified files, 742 insertions and 36 deletions, -and there were 36 nonignored untracked files. The tracked diff excludes -all untracked files, including the complete isolated guest experiment. - -Modified files cover contribution and license policies, benchmarks, ISA -generation and code, decoder and LLVM oracle, shader compiler, CPU -reference, claims/status/progress/review docs, fixture manifest and -assembly script, and independent semantic validation. Untracked work -includes all of `experiments/x1/`, original OR, shift and arithmetic shift -fixtures, four Phase 02 reports, and the five handoff files. Exact original -paths are in `artifacts/handoff/pre-handoff-git.txt`. The final inventory -is in `artifacts/handoff/final-git.txt`. - -Relevant baselines: - -- `4b9a4ce` is the tracked continuation baseline used for the working patches. -- `5c47900` is the integrated Phase 01 validation candidate. -- `aff46b0` is the earlier mutation and fixture fuzz checkpoint. -- `cc0daa7` is the benchmark exploratory AC candidate and includes the - skipped-instruction layout fix. -- `095ec65` and `79df119` added mutation and regression coverage. - -The last engineering task notifications reported completion, including -X4 independent acceptance. No separate Git worktree or matching test, -Cargo, fuzzer or mutant process appeared in the final audit. T3 task -history is separate from Git; inspect the task panel before editing if -an agent was launched after this snapshot. - -No implementation commit or push was made. The configured identity is -a human contributor's. The [DCO policy](../../CONTRIBUTING.md) requires -personal certification, and the agent has no personal human attestation -to append. Preserve this working tree; no reset, clean, stash, rebase -or history rewrite. A fresh clone lacks the local working patch, -untracked files and ignored evidence. For transfer, carry the complete -workspace or save a tracked binary diff plus all nonignored untracked -files and selected ignored evidence separately. Check for machine-local -paths before sharing evidence externally. - -## Sequence of work - -1. Reconciled Phase 01 baseline and independent reference results. At - `4b9a4ce`, R2 accepted 13 semantic tests and all 399 source-mutant - outcomes. R1 signed off on the revised Phase 01 claims. Completed - the candidate-specific decoder and reference fuzz refreshes. -2. Inspected locked objc2 attribution and a real native release executable. - Maintainer issue #895 resolves upstream's conditional licensing position. - The compiled binary imports system frameworks and retains some generated - Rust glue, selectors and location metadata. Apple-specific distribution - rights for the actual archive and matching source remain unresolved. -3. Added VGPR/VGPR OR, logical left shift and logical right shift, with - independent fixture semantics and validated native Metal readback. - Arithmetic right shift was implemented from AMD and MSL specifications. - Leonida was a candidate-selection reference. Its code, data and - dependencies were not used. -4. Ran X1 branch traces, verified X2 PE loading and synthetic service, - fixed X3 to run through the X2 loader after independent review found - the flat-fixture bypass, then accepted X3 and X4 independently. -5. Synchronized and consolidated GitHub tracking. Adopted independent - implementation and user-provided file policies. No code was pushed. - -## Phase 01 gates - -| Status | Gates and evidence | -| --- | --- | -| Passed for Phase 01 | G1 native audit, G2 engineering checks, G3 validated Metal tests, G4 three-fixture demo, G5 independent reference, G6 three-way decode, G7 mutation, G8 claims, G9 fuzz, G13 status, G14 CPU boundary. See [evidence](VERIFIED_EVIDENCE.md). | -| G10 open | Finish corpus and per-stage or cold/warm measurement coverage, record capabilities, environment and variability, then run on idle AC-powered host. Existing AC run was exploratory, with idleness unestablished. | -| G11 open | Pinned notice and binary inspection complete. Retained binding material, Apple SDK terms, exact release archive and GPLv3 Corresponding Source require resolution. See [audit](../licenses.md#runtime-redistribution-review). | -| G12 open | History integrity and scoped scans passed. Six post-policy commits require the actual contributor's personal DCO attestations. See [full SHA inventory](../testing/review-log.md#phase-01-evidence-recheck-at-4b9a4ce). | -| G15 open | Obtain final R1 and R2 review on the exact releasable candidate after blockers close. Component reviews alone are insufficient. | - -Phase 01 is not release-ready. V3 defines each gate. The -[continuation ledger](../testing/phase01-continuation.md) contains earlier -historical statuses. The [mutation record](../testing/mutation.md), review -log and [progress](../progress.md) supersede its G5/G7/G8/G9 blockers. - -## Architecture in use - -| Path | Responsibility and interfaces | -| --- | --- | -| [crates/isa/src/lib.rs](../../crates/isa/src/lib.rs), [rdna2.rs](../../crates/isa/src/rdna2.rs), [generator](../../crates/isa/generate_rdna2.py) | Architecture and typed instruction/operand enums. Checked-in opcode masks generated from pinned public AMD XML. | -| [crates/decoder/src/lib.rs](../../crates/decoder/src/lib.rs) | `decode(architecture, bytes)` returns decoded instructions with byte offsets and sizes or typed errors. Register classes and skipped branch targets are checked. | -| [crates/shader/src/lib.rs](../../crates/shader/src/lib.rs) | `compile(architecture, bytes)` lifts into private typed operations and binary operators, verifies initialized registers, transfer ordering and supported control flow, and returns IR text and generated MSL. Current synthetic ABI reserves v0 for lane index and uses two disjoint word buffers. | -| [crates/ref/src/lib.rs](../../crates/ref/src/lib.rs) | Independently decodes original bytes for the production CPU reference and executes the same bounded ABI. `tests/validation/independent_ref.rs` is a separate oracle implementation for semantic checks. | -| [crates/metal/src/compute.rs](../../crates/metal/src/compute.rs), [crates/cli](../../crates/cli) | `NativeCompute::run_words` compiles trusted MSL, allocates bounded buffers, submits synchronously and returns owned words or operation-specific errors. `run_words_profiled` exposes timing stages. CLI drives compute, demo and diagnostics. | -| [experiments/x1/src/cpu.rs](../../experiments/x1/src/cpu.rs), [pe.rs](../../experiments/x1/src/pe.rs) | Isolated private guest `State`, decoded instruction subset, budget and guest-RIP faults. PE parser bounds file and virtual extents and exposes disjoint checked code, data and command views. The interpreter consumes guest bytes as data. | -| [experiments/x1/src/x3.rs](../../experiments/x1/src/x3.rs), [x4.rs](../../experiments/x1/src/x4.rs), [graphics.rs](../../experiments/x1/src/graphics.rs) | X3/X4 typed synthetic commands are read from a separately checked guest section. Trap handlers validate IDs, access, resource and ranges before dispatch. Host buffers and textures remain owned through synchronous completion. Rejections and injected errors preserve pending guest status. X4 uses a real RGBA8 render attachment and reads it back. | -| [fixtures/rdna2](../../fixtures/rdna2), [guest fixtures](../../experiments/x1/fixtures), [benchmarks](../../benchmarks), [tests/validation](../../tests/validation), [testing docs](../testing) | Original binary and assembly fixtures, source generators, correctness-gated benchmark corpus, LLVM comparison, independent CPU and real Metal test entry points, and assurance records. | - -The standalone Cargo experiment `xenora-x1` has a separate lockfile and an -optional `metal` feature. It is outside the production Cargo workspace. -There is no general console process/runtime or guest command ABI in the -production crates. See [interfaces](../interfaces.md) and the -[experiment README](../../experiments/x1/README.md) for exact entry points. - -## Guest milestones - -| Milestone | Accepted behavior and limits | -| --- | --- | -| X0 | Native ARM64 host driver and native M5 capability evidence. Supported GPU generations beyond measured hosts require runtime detection and evidence. | -| X1 | Original flat wrap/non-wrap programs at guest 0x1000 use MOV, ADD, CMP, JNE and an eight-byte store. Exact six/five-instruction traces preserve expected flags/registers and store 42/0xffffffff. Six deterministic fault cases. Bounded interpreter only. | -| X2 | Original fixed-base AMD64 PE32+ at 0x140000000, entry 0x140001000, selector 1 via synthetic UD2, RCX 41 to RAX 42, exact eight-byte store and terminal RIP 0x14000100a. Private guest map, narrow section profile, no relocation or zero-fill support. Independent tests include alternate arguments and faults. | -| X3 | Original PE32+ at 0x400000 enters 0x401000 through shared X2 loader. Guest loads command address and traps at 0x401005. Bounded OR dispatch over 0, 0x12345678 and 0xffffffff returns 0x00ff00ff, 0x12ff56ff and 0xffffffff, then guest stores zero. Earlier flat fixture bypassed PE loading; rejected at review. Corrected fixture and shared loader reject incorrect entry/altered trap before dispatch. | -| X4 | Two original PE fixtures supply p=17 and p=93 to a typed 8×8 RGBA8 draw. Render encoder uses a full-screen triangle and texture readback checks every pixel. Independent review passed 384 pixels over three runs of both fixtures. Invalid resource inputs and injected dispatch errors preserve pending status. Actual GPU fault/allocation failure was outside test coverage. | - -These milestones verify original synthetic programs. X3 is compute -readback. X4 is an actual rendered texture. Neither demonstrates Xbox -ABI, game graphics, or a commercial title launch. - -## GitHub - -Authenticated query confirmed [14 open and 41 closed issues](https://github.com/ranveersoni98/Xenora/issues) -and [seven preserved milestones](https://github.com/ranveersoni98/Xenora/milestones). -Phase 01 has 11 verified completed gate issues and four open. X3 #47/#50 -and X4 #28/#51 are completed for their bounded scopes. Superseded issues -were closed with preserved scope and links. No issue was deleted. -Issue #1 discussion was preserved. #20 requires original fixture authorship -and #55 specifies technical compatibility with user-provided inputs. - -Active backlog is -[#1](https://github.com/ranveersoni98/Xenora/issues/1), -[#11](https://github.com/ranveersoni98/Xenora/issues/11), -[#12](https://github.com/ranveersoni98/Xenora/issues/12), -[#13](https://github.com/ranveersoni98/Xenora/issues/13), -[#16](https://github.com/ranveersoni98/Xenora/issues/16), -[#17](https://github.com/ranveersoni98/Xenora/issues/17), -[#19](https://github.com/ranveersoni98/Xenora/issues/19), -[#20](https://github.com/ranveersoni98/Xenora/issues/20), -[#24](https://github.com/ranveersoni98/Xenora/issues/24), -[#26](https://github.com/ranveersoni98/Xenora/issues/26), -[#38](https://github.com/ranveersoni98/Xenora/issues/38), -[#48](https://github.com/ranveersoni98/Xenora/issues/48), -[#53](https://github.com/ranveersoni98/Xenora/issues/53), and -[#55](https://github.com/ranveersoni98/Xenora/issues/55). -Snapshot and issue-body backups are in `artifacts/handoff/github.json` -and `artifacts/github-cleanup/`. Reread current state before any authorized -metadata edits. The remote source tree does not contain the local X1–X4 -implementation or new GPU slices. diff --git a/docs/handoff/START_HERE.md b/docs/handoff/START_HERE.md deleted file mode 100644 index 8497f06..0000000 --- a/docs/handoff/START_HERE.md +++ /dev/null @@ -1,81 +0,0 @@ -# Start here - -Xenora is an original Rust research emulator for native Apple Silicon macOS. -Its graphics path translates a bounded desktop RDNA2/gfx1030 subset to MSL -and runs it through Apple's Metal API. An isolated ARM64 interpreter -experiment runs original x86-64 programs from flat and fixed-base PE32+ -fixtures and can submit synthetic compute and render commands. The long-term -target is Xbox Series X|S software, with GTA VI's genuine intro/title screen -as a stretch goal. Commercial Xbox execution remains unsupported. - -## Open the same clone - -Use `/Users/ranveersoni/Developer/Xenora` for -[ranveersoni98/Xenora](https://github.com/ranveersoni98/Xenora). At handoff, -`main`, its upstream `origin/main`, and the GitHub default branch all -pointed at `4b9a4cecf35c8d4d90d8ecdb9c1510e7bd260102`. The index was empty -and there were zero commits ahead or behind. Phase 02 implementation, -fixtures, tests and policy changes are in the working tree. See the -[session record](SESSION_2026-11-23.md#repository-state) for the inventory -and transfer requirements. Keep the workspace and its ignored artifacts. - -## Read in order - -1. [Engineering rules](../../AGENTS.md), [interfaces](../interfaces.md) and - [progress](../progress.md). -2. [Session record and architecture](SESSION_2026-11-23.md), - [reproducible evidence](VERIFIED_EVIDENCE.md), and - [priorities](NEXT_PRIORITIES.md). -3. The original Master Engineering Prompt V3 governs Phase 01 architecture, - evidence and G1–G15. Continuation V4 is historical evidence. The Dual-Track - Phase 02 + GTA VI prompt governs Phase 02 scheduling and P2-01–P2-10, - with the policies below taking precedence over its earlier reuse - language. Preserved originals and checksums are in - `artifacts/handoff/specifications/` and - `artifacts/handoff/specifications.sha256` in this clone. The - [bootstrap prompt](NEXT_AGENT_PROMPT.md) works without chat attachments. - -## Code and status - -The main graphics code lives under `crates/{isa,decoder,shader,ref,metal,cli}`. -The isolated CPU and guest-driven GPU driver is under `experiments/x1`. -Independent tests live in `tests/validation`; original AMDGPU fixtures are in -`fixtures/rdna2`. X0 native host capability and X1–X4 synthetic execution are -verified. OR and both logical shifts passed LLVM, reference and Apple M5 -readback. Arithmetic right shift has source and LLVM evidence. Its Rust and -Metal acceptance is the first task for the next session. - -Phase 01 passed 11 of 15 gates. G10 controlled benchmarks, G11 redistribution, -G12 personal DCO attestations and G15 independent release acceptance remain -open. Phase 02 candidate-specific fuzz, mutation and matched performance -evidence also remain open. See the [GitHub backlog](SESSION_2026-11-23.md#github). - -## Host and quick checks - -The tested host is ARM64 Apple M5, macOS 27.3, Xcode 27.2, Rust 1.100.0, -Homebrew LLVM 23.1.6 and Python 3.11 or later. GPU tests need real Metal API -and shader validation. Use `CARGO_BUILD_JOBS=2` and run heavy tasks serially. -Start with `git status --short --branch`, `git diff --check`, -`cargo fmt --all -- --check`, `scripts/audit/claims.sh`, and -`python3 scripts/audit/status.py --check`. See [targeted replay](NEXT_PRIORITIES.md#p0--finish-arithmetic-shift-acceptance) -before any expensive build or run. - -## Standing policies - -Use native ARM64 and Metal, with no Rosetta, Wine, CrossOver, Windows -compatibility layer, OpenGL fallback, Vulkan runtime or MoltenVK. Use original -Rust and public specifications with independent expected results. Leonida, -KyTx and other emulators may inform test selection. Do not copy, translate, -port or import their code, tables, internal metadata or architecture. -Preserve GPL-3.0-or-later, accurate notices, personal DCO and project -test-material provenance. See [contribution policy](../../CONTRIBUTING.md). - -User files are checked for technical safety and compatibility. Xenora -does not investigate origin, demand ownership, receipts or accounts, host -or fetch commercial files, or provide circumvention. Project contributions -and tests follow their [separate provenance rules](../legal.md). - -Every spawned agent must have explicitly requested and confirmed **low** -reasoning. Use independent ownership and reviewers. Keep synthetic, host -hardware, upstream and Xbox claims separate. Do not push or publish without -authorization. diff --git a/docs/handoff/VERIFIED_EVIDENCE.md b/docs/handoff/VERIFIED_EVIDENCE.md deleted file mode 100644 index 8bf588c..0000000 --- a/docs/handoff/VERIFIED_EVIDENCE.md +++ /dev/null @@ -1,88 +0,0 @@ -# Verified evidence - -Scope is the stated candidate and fixture. AMD/MSL public semantics are -class B, measured M5 GPU behavior is class A, and observed LLVM tool -behavior is class E. CPU test runs establish software behavior for the -named inputs. They provide no Xbox hardware evidence. All listed runs -used native ARM64 macOS. Phase 02 and X1–X4 results refer to working-tree -snapshots on `4b9a4ce`, with separate artifact hashes and logs. - -## Phase 01 - -| Gates | Command and observed acceptance | Provenance and raw evidence | -| --- | --- | --- | -| G1–G4 | `scripts/audit/native.sh` checked 15 executables and dependencies. Format, all-feature Clippy and workspace tests passed (54 default tests). `scripts/test-gpu.sh` passed all 12 validated M5 tests. `scripts/demo.sh` matched reference and hand-derived results on all three original fixtures. All exit 0. | `5c47900`, [commands](../../artifacts/assurance-5c47900/commands.log), [exits](../../artifacts/assurance-5c47900/exits.log). | -| G5–G6 | `cargo test --locked -p xenora-semantic-review` passed all 13 tests, exit 0. `cargo test --locked -p xenora-decoder --test gfx1030 -- --include-ignored` verified 303 comparisons across 15 forms, three malformed and six subset probes for Phase 01. R2 signed off. | `4b9a4ce` [oracle review](../../artifacts/mutation/source-4b9a4ce/g5-review.md), `5c47900` [LLVM log](../../artifacts/assurance-5c47900/llvm.log). | -| G7 | `CARGO_BUILD_JOBS=2 scripts/mutation.sh artifacts/mutation/source-4b9a4ce` recorded all 399 outcomes. 359/361 eligible behavioral kills (99.45%), 13 independently proven equivalents, 25 invalid builds. The timeout and reference SIGKILL remain in the denominator. Native semantic 12/12 and oracle-only 44/44 at code-identical `5c47900`. The source wrapper did not capture its exit; all outcomes and the completion transcript are intact. | R2 [source review](../../artifacts/mutation/source-4b9a4ce/g7-review.md), [campaign](../../artifacts/mutation/source-4b9a4ce/campaign.log), [mutation accounting](../testing/mutation.md). | -| G8, G13–G14 | `scripts/audit/claims.sh`, `python3 scripts/audit/status.py --check` and `scripts/audit/dependencies.sh` passed. R1 accepted 22 claims and scoped prose for Phase 01. The transitive audit covered five graphics crates. | [Claims review](../../artifacts/r1-phase01-g8-g12.md), [CPU boundary ADR](../adr/0004-cpu-boundary.md), [dependency output](../../artifacts/assurance-5c47900/dependencies.log). | - -### G9 native parser fuzz campaigns - -Run replay commands only for a justified changed candidate. Each target -completed without an unresolved crash or hang. - -| Command | Executions / elapsed / exit | Candidate and evidence | -| --- | --- | --- | -| `scripts/fuzz.sh instruction_stream 600` | 123,522,954 / 601 s / 0 | `4b9a4ce`, [decoder log](../../artifacts/g9/4b9a4ce-20261123T041525Z/instruction_stream.log) | -| `scripts/fuzz.sh reference 600` | 240,077,291 / 601 s / 0 | `4b9a4ce`, [reference log](../../artifacts/g9/4b9a4ce-20261123T041525Z/reference.log) | -| `scripts/fuzz.sh fixture 600` | 244,422,168 / 601 s / 0 | `aff46b0`, identical Phase 01 fuzz inputs, [fixture log](../../artifacts/assurance-aff46b0/fuzz/fixture.log), SHA-256 `ea81caf9495b57fc617d6470d3cac0488e59d1d727f16bbe8eda470987333a28` | - -The first two runs have [ARM64 binary provenance](../../artifacts/g9/4b9a4ce-20261123T041525Z/executable-provenance.log) -and [matching post-run executable and transcript hashes](../../artifacts/g9/4b9a4ce-20261123T041525Z/final.sha256). -Raw `.exit`, timing and environment files sit beside the logs. Do not -transfer G9 to changed Phase 02 sources. - -## GPU slices - -All four forms use only VGPR sources and destination under the bounded -Wave32 compute ABI. Propagation and lowering are in -[shader](../../crates/shader/src/lib.rs), encodings in -[ISA masks](../../crates/isa/src/rdna2.rs) and -[decoder](../../crates/decoder/src/lib.rs), CPU semantics in -[reference](../../crates/ref/src/lib.rs), independent expectations in -[validation](../../tests/validation/known_answers.rs) and -[LLVM comparator](../../crates/decoder/tests/gfx1030.rs). - -| Form and original fixture | Implementation and evidence | -| --- | --- | -| `v_or_b32_e32`, [or.s](../../fixtures/rdna2/or.s) | Bitwise OR preserves unchecked input bits according to the mask. Independently authored CPU equivalents and LLVM encodings passed. The first checkpoint had 56 default tests and 312 LLVM comparisons across 16 forms. Validated M5 dispatch matched all 131 words. [OR log](../../artifacts/phase02-or/or-gpu.log). | -| `v_lshlrev_b32_e32`, `v_lshrrev_b32_e32`, [shifts.s](../../fixtures/rdna2/shifts.s) | Shift unsigned src1 by src0 modulo 32; independent tests cover count wrap, high bits and aliases. The combined checkpoint had 58 default tests, 324 LLVM comparisons across 18 forms, 5 malformed and 19 subset probes. All 12 native regressions and both OR/shift native tests passed, 131 exact words each. All recorded exits were 0, with validated M5 runs. [LLVM](../../artifacts/phase02-shifts/llvm.log) · [readback](../../artifacts/phase02-shifts/fixtures-gpu.log) · [native audit](../../artifacts/phase02-shifts/native.log). | -| `v_ashrrev_i32_e32`, [ashr.s](../../fixtures/rdna2/ashr.s) | Implemented signed src1 shift with five-bit count. ARM64 LLVM reproduced the fixture word `0x31ffff01` and binary byte for byte (class E). Reference and native tests exist but no corresponding Rust or GPU acceptance log was found. Independent acceptance remains open. [Reproduction and expected vectors](../../fixtures/rdna2/ashr.md) · [disassembly](../../artifacts/phase02-ashr/disassembly.log). | - -The first two slices used separate independent fixture derivation. -Continue with [exact acceptance commands](NEXT_PRIORITIES.md#p0--finish-arithmetic-shift-acceptance). -Phase 02 changed-code fuzz/mutation, matched timing and final independent -candidate review remain pending. - -## Guest experiments - -Run from the repo root. For all X1–X4, use -`cargo test --locked --manifest-path experiments/x1/Cargo.toml --target aarch64-apple-darwin`. -Add `--features metal` for X3/X4 coverage. The runner uses the same manifest -and target with `cargo run`, followed by `-- x2`, `-- x3` or `-- x4`. -X1 uses no argument. Set `MTL_DEBUG_LAYER=1` and `MTL_SHADER_VALIDATION=1` for -GPU runs and use the [README](../../experiments/x1/README.md) for the full -environment, fixture regeneration and native checks. - -| Milestone | Expected and observed result | Evidence / review | -| --- | --- | --- | -| X0 | Thin ARM64 driver, macOS system dependencies, measured Apple M5 GPU runs. | [Native driver audit](../../artifacts/x4-review/native.log). | -| X1 | Eight tests passed, including six faults. Original flat programs retired six/five instructions and stored 42 / 0xffffffff with exact RIP, flags and memory. ARM64 driver linked only against libSystem. | [Tests](../../artifacts/x1/tests.log), [trace](../../artifacts/x1/trace.log), [native](../../artifacts/x1/native.log). | -| X2 | Reviewed fixed-base PE loader reached 0x140001000. Three guest instructions invoked service 1, returned 42 from argument 41, and stored `2a 00 00 00 00 00 00 00`. Independent 16 tests passed, including 0, 255 and max argument rollover and fault preservation. | [Independent oracle](../../artifacts/x2-review/checks.md), [native trace](../../artifacts/x2-review/native-trace.log), [tests](../../artifacts/x2-review/tests.log). | -| X3 | Corrected PE-to-Metal chain independently accepted. 21 tests passed; invalid entry and altered trap reached no dispatch. Five validated fresh runs matched `00ff00ff 12ff56ff ffffffff` and zero guest status. | [Review](../../artifacts/x3-pe.pQUnzE/review.md), [build/tests](../../artifacts/x3-pe.pQUnzE/review-build.log), [GPU](../../artifacts/x3-pe.pQUnzE/review-gpu.log). Earlier flat fixture alone did not pass acceptance. | -| X4 | Original PE draws for p=17 and p=93. Three fresh GPU processes each rendered both 8×8 RGBA8 textures, 384 total pixels all equal to `[x,y,p,255]`. 24 feature tests passed; invalid inputs blocked draw and an injected failure preserved pending status. Three recorded process exits were 0. | [Independent review](../../artifacts/x4-review/review.md), [oracle](../../artifacts/x4-review/oracle.log), [tests](../../artifacts/x4-review/tests.log), [native evidence](../../artifacts/x4-review/native.log). Actual GPU allocation or execution failure was not induced. | - -## Retention - -All linked raw logs under `artifacts/` are ignored and untracked. -Keep these directories in the same clone: `assurance-5c47900`, -`assurance-aff46b0/fuzz`, `mutation/source-4b9a4ce`, `g9`, `g11`, -`phase02-or`, `phase02-shifts`, `phase02-ashr`, `x1`, `x2`, -`x2-review`, `x3`, `x3-review`, `x3-pe.pQUnzE`, `x4`, -`x4-review`, `github-roadmap`, `github-cleanup` and `handoff`, -plus the standalone R1 logs. The G9 executables are under -`fuzz/target/aarch64-apple-darwin/release/`; their hashes survive in -the logs if binaries are rebuilt later. Transfer these records separately -when moving machines. Keep raw logs and binary outputs out of published -commits. The old GitHub synchronization scripts are historical evidence -and should not be reapplied to the consolidated backlog. diff --git a/docs/interfaces.md b/docs/interfaces.md index 28f9b28..e46feb2 100644 --- a/docs/interfaces.md +++ b/docs/interfaces.md @@ -1,4 +1,6 @@ -# Phase 01 interfaces +# Interfaces + +## gfx1030 compute fixtures The first input is little-endian gfx1030 machine code for a compute fixture with optional statically resolved forward scalar branches. The synthetic ABI starts with full Wave32 EXEC and binds VGPR 0 to the lane index. Resource operands select documented synthetic bindings. The parser must require explicit target identification and validate all lengths before allocating. Console containers and AMDHSA initialization require separate contracts. @@ -8,4 +10,12 @@ The compiler lifts decoded instructions to typed operations and verifies registe The native backend exposes `NativeCompute::new()` and `run_words(source, entry, input)` for trusted MSL. It binds input at index 0 and output at index 1, dispatches one invocation per word and returns owned readback after completion. `run_words_profiled` returns the same output plus measured library, pipeline, GPU and host durations for the benchmark harness; those timings are single submissions, not distributions. The caller runs generated MSL in a bounded child process. Raw MSL is a trusted developer input. Errors report the operation and backend detail. Across other stages, diagnostics carry a stage, error kind, optional byte offset and human-readable context. -A future guest command stream must submit validated resource handles and ranges through an explicit address translation boundary. The graphics side owns mappings and the lifetime of in-flight views. Completion and fence signaling flow back across the command boundary. Guest addresses are never host pointers. +## Synthetic guest experiment + +The separate [X1–X4 driver](../experiments/x1/README.md) loads fixed-base +PE32+ fixtures, interprets a bounded x86-64 subset and dispatches synthetic +services. X3 and X4 validate fixed-size command records from read-only +guest bytes before issuing compute or draw work. Their command formats and +Metal shaders are authored for the experiment. + +A general guest command stream must submit validated resource handles and ranges through an explicit address translation boundary. The graphics side owns mappings and the lifetime of in-flight views. Completion and fence signaling flow back across the command boundary. Guest addresses are never host pointers. diff --git a/docs/progress.md b/docs/progress.md index d57130d..9311dfe 100644 --- a/docs/progress.md +++ b/docs/progress.md @@ -1,7 +1,23 @@ -# Phase 01 checkpoint +# Engineering progress **NOT RELEASE-READY.** The three-fixture demo checkpoint was pushed at `96cff7c66e55f1e4693ace19577c207795258d5c` and its [Native Rust checks](https://github.com/ranveersoni98/Xenora/actions/runs/45001680455) passed. See the [current assurance report](testing/phase01-assurance.md) for candidate evidence and the [historical engineering report](testing/phase01-checkpoint.md) for the initial checkpoint. +## Reading the progress graphic + +- **Decoded forms** counts rows marked decoded in the [status registry](status.toml), out of all rows in that reviewed gfx1030 instruction inventory. +- **Accepted Metal forms** counts rows with accepted native fixture readback, over the same inventory. See the [form-by-form results](shaders/instruction-coverage.md) and [implementation checkpoint](testing/phase-02-baseline.md#implementation-checkpoint) for class A evidence from Apple M5. Arithmetic shift has its own [fixture record](../fixtures/rdna2/ashr.md). +- **Accepted guest milestones** counts the recorded fixture demonstrations for native guest instruction execution (X1), executable loading (X2), guest-to-GPU command submission (X3), and guest-driven Metal rendering (X4), out of those four milestones. See the [guest acceptance record](testing/phase-02-baseline.md#track-b--guest-execution). + +The denominators describe this repository's fixture scope. Xbox compatibility remains unmeasured. After updating the registry with reviewed evidence, run `python3 scripts/audit/status.py` to regenerate the tables and [SVG](assets/xenora-progress.svg). CI uses the same command with `--check`. + + +| Feature | Target | Implementation | Correctness | Hardware | Evidence | Limits | +| --- | --- | --- | --- | --- | --- | --- | +| native-compute | arm64 macOS | implemented | initial-native-suite-passed | verified on Apple M5 | A | Trusted MSL with bounded word buffers and an original native offscreen rendering test on Apple M5. | +| synthetic-gfx1030 | gfx1030 Wave32 | three-fixture-demo-implemented | three-way-output-passed | verified on Apple M5 | A, B | Synthetic memory contract, statically resolved forward control flow, exact positive normal FP32 only. | +| xbox-execution | Xbox Series X\|S | unsupported | untested | unverified | U | Game execution, proprietary guest containers and full guest execution-mask divergence are unsupported. The console launch ABI is unknown. | + + ## Reproduce Run on native Apple Silicon with Rust 1.100.0, Xcode 27.2, Python 3.11 or later and LLVM 23.1.6. The verified host was Apple M5 with macOS 27.3. Metal's safe and precise compile options must be available. Use up to four Cargo jobs total across at most two builds, one GPU workload and one fuzz or mutation campaign at a time. The final checkpoint used two Cargo jobs. @@ -30,9 +46,9 @@ GPU prerequisites and the separate guest execution milestones. ## Remaining work -Use the [copy-ready continuation handoff](testing/phase01-continuation.md) for exact evidence, gate statuses and commands. +See the [assurance checkpoint](testing/phase01-assurance.md) for the original gate ledger and commands, and the [independent review](testing/review-log.md#phase-01-evidence-recheck-at-4b9a4ce) for later findings. -1. Preserve the G5, G6 and G7 sign-offs. The [integrated review](testing/mutation.md#integrated-source-campaign-at-4b9a4ce) confirmed 359 of 361 non-equivalent source mutants killed, all 44 independent-oracle kills and all 12 native semantic kills. The form-by-form validation report is in `tests/validation/README.md`. -2. G9 passes for the Phase 01 candidate. Native decoder and reference runs at `4b9a4ce` exited 0 after 123,522,954 and 240,077,291 executions respectively, each in 601 seconds. The fixture run at `aff46b0` exited 0 after 244,422,168 executions in 601 seconds. The fuzz source, dependencies, script and fixture inputs are identical between these commits. Logs and executable hashes are under `artifacts/g9/4b9a4ce-20261123T041525Z/`. Phase 02 source changes require their own assurance. +1. The independent reference (G5), LLVM decoder comparison (G6), and mutation testing (G7) passed at the Phase 01 candidate. The [integrated review](testing/mutation.md#integrated-source-campaign-at-4b9a4ce) confirmed 359 of 361 non-equivalent source mutants killed, all 44 independent-oracle kills and all 12 native semantic kills. The form-by-form validation report is in the [validation inventory](../tests/validation/README.md). +2. Parser fuzzing (G9) passed for the Phase 01 candidate. Native decoder and reference runs at `4b9a4ce` exited 0 after 123,522,954 and 240,077,291 executions respectively, each in 601 seconds. The fixture run at `aff46b0` exited 0 after 244,422,168 executions in 601 seconds. The fuzz source, dependencies, script and fixture inputs are identical between these commits. Logs and executable hashes are under `artifacts/g9/4b9a4ce-20261123T041525Z/`. Phase 02 source changes require their own assurance. 3. Finish benchmark corpus and protocol coverage before rerunning on AC and an idle system. Preserve the [exploratory battery and AC records](testing/benchmarks.md). -4. Close independent claims, status, history and review findings against the integrated candidate. Verify the [runtime redistribution blockers](licenses.md#runtime-redistribution-review) before claiming G11. +4. Close independent claims, status, history and review findings against the integrated candidate. Verify the [runtime redistribution blockers](licenses.md#runtime-redistribution-review) before closing the redistribution gate (G11). diff --git a/docs/research/phase02-collaboration.md b/docs/research/phase02-collaboration.md index 748701c..2bb3dac 100644 --- a/docs/research/phase02-collaboration.md +++ b/docs/research/phase02-collaboration.md @@ -17,18 +17,6 @@ At KyTx `10f50d3eff0c0df36ee5d7007848a7b0b15072eb`, `Wave64Pair`, the emitter's Request original gfx1030 Wave64 assembly, a mask/lane design note and per-lane expected outputs. Specify an isolated 64-lane synthetic ABI with full initial EXEC, lane-indexed output and a sentinel for inactive writes. Cover full, empty, alternating and asymmetric masks, lanes 0/31/32/63, and nested save, modify and restore of EXEC. Use observable scalar results to catch accidental duplicate scalar effects. Identify encodings with the pinned LLVM oracle (class E) and have R2 derive expected results independently from AMD's public ISA (class B for documented desktop RDNA 2, with Xbox applicability unknown). Require explicit rejection outside the supported subset. Keep the first PR fixture-only. Any later native lowering needs its own exact readback and validation evidence, including the measured pipeline execution width. [AMD RDNA 2 ISA](https://www.amd.com/content/dam/amd/en/documents/radeon-tech-docs/instruction-set-architectures/rdna2-shader-instruction-set-architecture.pdf), [Xenora interface](../interfaces.md) -Five questions for a human follow-up after the existing reply: - -1. Which original compute fixture best distinguishes the low and high EXEC halves? -2. How are EXEC and VCC saved and restored across nested divergence, and which corner cases have output checks? -3. How is a scalar side effect executed once when the vector instruction stream is emitted twice? -4. Where do lane reads, shuffles or LDS communication cross halves, and which cases require separate validation? -5. Which pipeline width, dispatch geometry and Metal validation settings were recorded for a reproducible synthetic case? - -Optional follow-up for maintainer review: - -> Thanks, Tx. Could we start with a small, independently authored gfx1030 Wave64 compute fixture that exercises both EXEC halves and save/restore? A short note on expected lane outputs and the public ISA sections you used would help us validate it independently. Please include provenance and a DCO sign-off, and confirm the terms for the specific files you contribute. - KyTx declares GPL-2.0. Tx's conditional GPL-2.0-or-later offer covers only material they own and can license. Require file-level authorship, explicit compatible terms (GPL-3.0-or-later preferred for new Xenora fixtures), preserved notices and DCO. Inherited GPL-2.0-only code cannot enter the GPL-3.0-or-later combined work under those terms. The separate Kyty MIT notice does not settle a derived file's full provenance. No KyTx submodule is justified for the fixture. [KyTx license and notices](https://github.com/TxCsOffc/KyTx/tree/10f50d3eff0c0df36ee5d7007848a7b0b15072eb/LICENSES), [KyTx license](https://github.com/TxCsOffc/KyTx/blob/10f50d3eff0c0df36ee5d7007848a7b0b15072eb/LICENSE) ## Leonida diff --git a/docs/research/phase02-cpu-feasibility.md b/docs/research/phase02-cpu-feasibility.md index 377e34c..f2a1b18 100644 --- a/docs/research/phase02-cpu-feasibility.md +++ b/docs/research/phase02-cpu-feasibility.md @@ -1,6 +1,6 @@ # Phase 02 Track B CPU feasibility -**Track B status: research.** Start with an original bounded interpreter on `aarch64-apple-darwin`. Keep FEX as a research reference and consider LLVM ORC after the original fixture passes independent semantic review and a representative workload shows a translation need. This review used the local dual-track brief and public sources. Local inspection reported `Darwin arm64` and macOS 27.3 (26C5047e). No CPU engine, loader, JIT or GPU workload was built or run for this report. [Existing CPU research](cpu-boundary.md) · [CPU boundary decision](../adr/0004-cpu-boundary.md) +This historical feasibility study predates the [implemented guest experiments](../../experiments/x1/README.md). This review used the local dual-track brief and public sources. Local inspection reported `Darwin arm64` and macOS 27.3 (26C5047e). No CPU engine, loader, JIT or GPU workload was built or run for this report. [Existing CPU research](cpu-boundary.md) · [CPU boundary decision](../adr/0004-cpu-boundary.md) ## Engine comparison @@ -35,20 +35,3 @@ store: Use a second fixture variant that changes the immediate in the first instruction to `0xfffffffe`. The first variant falls through, executes six instructions, and ends with RAX = 42 and output bytes `2a 00 00 00 00 00 00 00`. CMP leaves ZF and PF set and CF, OF, SF and AF clear. The second takes the branch, executes five instructions, and ends with RAX = `0x00000000ffffffff` and output bytes `ff ff ff ff 00 00 00 00`. CMP leaves SF and PF set and ZF, CF, OF and AF clear. Check RIP, RDI and other GPRs, flags after ADD and CMP, and unchanged bytes outside the store. Check ADD against the independent derivation as well: the wrap case sets CF, PF, AF and ZF, and the non-wrap case sets SF and PF. Mask assertions to the defined arithmetic flags. [AMD64 instruction manual](https://docs.amd.com/v/u/en-US/24594_3.37) Cap code at 64 bytes and execution at 16 retired instructions, and use a checked guest-address range for each memory access. Restrict decoding to the fixture's instruction forms and the branch to a forward decoded boundary. Negative tests cover an unsupported opcode, truncated operand, branch into an operand, budget exhaustion under a reduced test budget, out-of-range output and a store crossing the output boundary. Record fault kind and guest RIP and require faulting instructions to leave registers and output unchanged from pre-instruction state. Record assembler version, native tool architecture, fixture bytes and hash, initial state, trace and terminal state. R2 derives expected results directly from the public ISA and fixture and checks that the oracle is independent of production decode and execution. R1 checks provenance, native binary evidence and claim scope. - -## Evidence milestones - -All X0–X4 entries below are proposed for Track B. The existing Phase 01 compute evidence remains scoped to its own fixtures. Keep any lead-approved experiment isolated from production manifests, cross-track interfaces and release gates. Store run logs in ignored `artifacts/`. [Phase 01 checkpoint](../progress.md) · [Interface contract](../interfaces.md) - -| Stage | Required evidence | -| --- | --- | -| X0 — Native driver | Infrastructure records host OS, architecture and runtime capabilities. Verify the ARM64 slice of the driver and native dependencies with `file`, `lipo -archs` and `otool -L`. Record actual execution of the native driver before counting the gate. | -| X1 — Original instructions | CPU/ISA and Testing run both cases and rejection tests with a reproducible trace and independent expected state. | -| X2 — Loader and service | CPU/Infrastructure document a versioned original little-endian container with bounded code/data sizes, entry offset, and a single numeric service import. Check header, version, checked ranges, disjoint code/data and entry boundary before publishing mappings. Define an explicit synthetic trap and register ABI. A deterministic add-one service returns 42 for argument 41. Check loader state, trap arguments, return register and resume RIP. Reject malformed lengths, overlapping ranges, invalid entry and unknown service IDs. | -| X3 — Guest GPU command | CPU and Metal agree on a versioned synthetic command for one bounded compute dispatch through Track A. Validate opaque handles, access mode, checked offsets and lengths and dispatch bounds before submission. Retain backing allocations until completion and return a fence status to the guest. Capture the guest submit, accepted command, native completion and rejection traces. Keep CPU code out of graphics dependencies. | -| X4 — Synthetic frame | Metal and Testing run an original shader through the guest-driven command path to produce an 8×8 offscreen RGBA8 image. Define pixel (x, y) as the four bytes (x, y, p, 255), with guest parameter p = 17 on the first run and p = 93 on the second. Require completion, read back in row-major order and compare all 256 bytes with an independently generated expectation. Record device capabilities, inputs, image hashes, expected pixels and completion status. A compute buffer test at X3 alone does not establish X4. | -| X5 — Xbox-specific boundaries | Unknown. Xbox and claims establishes public, legally verified format, OS/GDK and graphics command contracts, then requires authorized conformance inputs and independent tests. The shipped CPU family disclosure is Class D. It does not specify an executable container, calling convention, GDK behavior or command stream. [Microsoft hardware disclosure](https://news.xbox.com/en-us/2020/03/16/xbox-series-x-tech/) | -| X6 — First project real-title test | Blocked in this review by unavailable project test input and unknown platform contracts. Once available, record the exact CPU, service and native GPU progress and the first unresolved event without redistributing assets or proprietary traces. | -| X7 — GTA VI intro/title screen | Blocked pending platform support and a suitable project test input. Require the genuine title's execution through Xenora's CPU, service and Metal paths, evidence of live title state, host and attributable build details, capture method and recorded defects. This stretch milestone is outside Phase 02 acceptance. | - -An authentic frame additionally depends on proven guest memory and synchronization behavior, platform services including input/audio, command and descriptor decoding, shader stages and resource formats, resource residency and coherence, authorized assets, and a genuine executable input. The original fixture sequence measures progress on specific interfaces while those title requirements remain open. diff --git a/docs/research/phase02-ecosystem.md b/docs/research/phase02-ecosystem.md index 7b7db01..6b54e76 100644 --- a/docs/research/phase02-ecosystem.md +++ b/docs/research/phase02-ecosystem.md @@ -5,7 +5,7 @@ Historical reuse discussion records the earlier survey. Xenora uses public specifications and original fixtures, with other emulator projects serving only as references for test selection. -Screened the eight A3 leads on 2026-11-23 against section 6 of the dual-track brief. The pins below identify the default-branch snapshots and their latest observed commits in UTC. The OpenScarlett tip changes documentation. A recent tip establishes activity, and its commit message records the subject of that activity. See the companion notes for [KyTx and Leonida](phase02-collaboration.md) and [CPU engine selection and X0–X7](phase02-cpu-feasibility.md). +Screened the eight A3 leads on 2026-11-23 against section 6 of the dual-track brief. The pins below identify the default-branch snapshots and their latest observed commits in UTC. The OpenScarlett tip changes documentation. A recent tip establishes activity, and its commit message records the subject of that activity. See the companion notes for [KyTx and Leonida](phase02-collaboration.md) and [CPU engine selection and original interpreter fixture](phase02-cpu-feasibility.md). GitHub metadata and tree entries establish availability and paths. Pinned text inspection establishes what a selected function does in source. Upstream test counts, captures and README statements remain upstream reports. No upstream code, builds, fixtures or GPU workloads were executed here. Repository-level license labels are provisional for reuse. File-specific grants, origin and transitive terms remain unverified for every code surface below. diff --git a/docs/shaders/instruction-coverage.md b/docs/shaders/instruction-coverage.md index 63c8961..4cf2613 100644 --- a/docs/shaders/instruction-coverage.md +++ b/docs/shaders/instruction-coverage.md @@ -1,12 +1,12 @@ # gfx1030 instruction coverage The decoder accepts an explicitly tagged, little-endian gfx1030 Wave32 -stream under the [synthetic memory ABI](../adr/0003-demo-memory-model.md). +stream with 32 lanes per wave under the [synthetic memory ABI](../adr/0003-demo-memory-model.md). Recognition means that the opcode mask matches. Decode additionally checks operands, flags, instruction width and any literal word. Register initialization and memory safety require verification after decoding. CPU and GPU entries refer to the original synthetic fixture workloads. -The wider LLVM operand matrix exercises decoding only. +The wider LLVM operand matrix exercises decoding only. ABI means application binary interface. VGPRs are vector general-purpose registers and SGPRs are scalar general-purpose registers. | Form | Operands | Size or word | Recognized | Decoded | LLVM | Lowering | Reference | CPU | GPU | @@ -29,6 +29,7 @@ The wider LLVM operand matrix exercises decoding only. | `v_or_b32_e32` | Two VGPR sources and one VGPR destination | `3803FF01` | yes | yes | three-way passed | MSL bitwise OR | implemented | fixture verified | fixture verified on Apple M5 | | `v_lshlrev_b32_e32` | Two VGPR sources and one VGPR destination | `34020501` | yes | yes | three-way passed | MSL logical left shift with a five-bit count | implemented | fixture verified | fixture verified on Apple M5 | | `v_lshrrev_b32_e32` | Two VGPR sources and one VGPR destination | `2DFFFF01` | yes | yes | three-way passed | MSL logical right shift with a five-bit count | implemented | fixture verified | fixture verified on Apple M5 | +| `v_ashrrev_i32_e32` | Two VGPR sources and one VGPR destination | `31FFFF01` | yes | yes | fixture reproduced | MSL signed right shift with a five-bit count | implemented | local known-answer test passed | local Apple M5 readback passed; acceptance pending | ## Automated three-way comparison diff --git a/docs/status.toml b/docs/status.toml index 2521ee8..793a3f8 100644 --- a/docs/status.toml +++ b/docs/status.toml @@ -254,3 +254,21 @@ gpu = "fixture verified on Apple M5" recognized = true decoded = true llvm = "three-way passed" + +[[instruction]] +form = "v_ashrrev_i32_e32" +encoding = "Two VGPR sources and one VGPR destination" +representation = "`31FFFF01`" +lowering = "MSL signed right shift with a five-bit count" +reference = "implemented" +cpu = "local known-answer test passed" +gpu = "local Apple M5 readback passed; acceptance pending" +recognized = true +decoded = true +llvm = "fixture reproduced" + +[guest_milestones] +X1 = "accepted" +X2 = "accepted" +X3 = "accepted" +X4 = "accepted" diff --git a/docs/testing/phase-02-baseline.md b/docs/testing/phase-02-baseline.md index 7f7b33a..7f34948 100644 --- a/docs/testing/phase-02-baseline.md +++ b/docs/testing/phase-02-baseline.md @@ -1,12 +1,12 @@ -# Dual-track baseline +# GPU and guest execution evidence The resumed checkout started clean on main at `4b9a4cecf35c8d4d90d8ecdb9c1510e7bd260102`, tracking origin/main. The diff since `5c479005b0e0631a608a369b9e41327da61bb61e` contains three documentation files. The baseline reuses the implementation evidence from that commit and retains the original attribution for every run. The -[Phase 01 continuation](phase01-continuation.md) records G1–G15 individually. -R1 has also [signed off G8 for Phase 01](review-log.md#phase-01-evidence-recheck-at-4b9a4ce). G9 passed for the Phase 01 candidate. G10–G12 and G15 remain open. Phase 01 is not release-ready. +[Phase 01 assurance checkpoint](phase01-assurance.md) records the original release-gate definitions and results. +The [independent claims audit (G8)](review-log.md#phase-01-evidence-recheck-at-4b9a4ce) and parser fuzzing (G9) passed for the Phase 01 candidate. Controlled benchmarks (G10), redistribution rights (G11), repository hygiene and contributor attestations (G12), and final independent acceptance (G15) remain open. Phase 01 is not release-ready. The resumed host reported arm64, 16 GiB RAM, 276 GiB available disk, macOS 27.3 (26C5047e), Xcode 27.2 (27B52) and Rust 1.100.0. @@ -22,64 +22,26 @@ closes G5 and G7 for the Phase 01 candidate. ## Track A — GPU engineering -The [status manifest](../status.toml) enumerates 15 recognized and -decoded gfx1030 forms. All 15 contribute to the verified fixture path. +At the Phase 01 baseline, 15 recognized and decoded gfx1030 forms +contributed to the verified fixture path. See the [current inventory](../shaders/instruction-coverage.md) for later additions. Forward scalar control is resolved when lifting to IR. The generated MSL embodies that resolution without emitting a dynamic GPU branch. The translated stage is compute, with lane-indexed 32-bit reads and writes to two disjoint buffers. The original native offscreen render test provides -separate backend evidence. Preserve the [FP32 host evidence](../research/host-lab.md) -and the exact positive normal FP32 subset. - -Candidate first slice, pending Phase 01 decoder/compiler assurance: -add the desktop gfx1030 VGPR-only integer OR form to the existing compute -path. An original fixture can take inputs -`[0x00000000, 0xffffffff, 0xaaaaaaaa, 0x80000000]`, OR each with -`0x55555555`, and expect -`[0x55555555, 0xffffffff, 0xffffffff, 0xd5555555]`. -Homebrew LLVM 23.1.6 `llvm-mc -triple=amdgcn-amd-amdhsa -mcpu=gfx1030 --show-encoding` assembled `v_or_b32_e32 v1, v2, v3` to bytes -`02 07 02 38` and the all-`v255` form to `ff ff ff 39`. This is -class E tool evidence. Before implementation, ISA and R2 must check the -AMD definition and independently derive encoding and operand expectations. -Use existing buffer bindings and negative operand tests. Acceptance -requires decoder/IR/MSL integration, independent CPU and GPU readback, -original regressions, changed-code assurance and matched measurements. -Keep the work in a reversible patch with the baseline fixtures available -unchanged. See the implementation checkpoint below for the resulting verification. +separate backend evidence. The [host evidence](../research/host-lab.md) records why translation is limited to the documented subset of 32-bit floating-point operations (FP32). ## Track B — guest execution | Milestone | Baseline status | | --- | --- | -| X0 Native host bootstrap | Native host and Metal capability evidence exists in Phase 01. A standalone guest runtime driver is proposed. | -| X1 First x86-64 instruction | Demonstrated on ARM64 macOS with both known-answer traces and six fault tests. | -| X2 Executable and synthetic service | Independently demonstrated on ARM64 with the original fixed-base PE32+ fixture and synthetic add-one service. | -| X3 Guest GPU command | Independently verified from the original PE through the shared loader, interpreter and native Metal. | -| X4 Guest-driven Metal frame | Independently verified on Apple M5 from original guest PE through RGBA8 texture readback. | -| X5 Authentic Xbox boundaries | Blocked on public or authorized interfaces and test inputs. | -| X6 First real-title validation | Blocked on X5 and suitable project test inputs. User import follows the [game file policy](../legal.md#user-provided-game-files). | -| X7 Genuine GTA VI intro/title screen | Blocked. The runtime path and suitable project test inputs are unavailable. | - -Track B research can proceed while Phase 01 gates remain open. The -[CPU feasibility report](../research/phase02-cpu-feasibility.md) proposes -an original interpreter with a 16-instruction budget, two branch paths -and exact register, flag and memory expectations. Keep the original -CPU test independent of graphics crates until the CPU, loader and -synthetic service contracts are verified. - -The [KyTx and Leonida review](../research/phase02-collaboration.md) -pins the inspected sources and proposes an original Wave64/EXEC -fixture as the first collaboration. It is a separate fixture proposal -from the initial Track A OR slice. Acceptance requires file-level -provenance and independent lane expectations. Leonida's decoder and -loader are design references. No upstream component was adopted. - -The [ecosystem shortlist](../research/phase02-ecosystem.md) screens -eight additional upstream repositories and ranks five original -experiments. Its highest-ranked differential compute experiment can -use the selected OR slice with a bitwise mutation and independently -derived lane outputs. Emulator code, ports, tables and internal metadata are outside scope. +| Native host bootstrap (X0) | Phase 01 recorded native host and Metal capability evidence. | +| Native guest instruction execution (X1) | Demonstrated on ARM64 macOS with both known-answer traces and six fault tests. | +| Executable loading and synthetic service dispatch (X2) | Independently demonstrated on ARM64 with the original fixed-base PE32+ fixture and synthetic add-one service. | +| Guest-to-GPU command submission (X3) | Independently verified from the original PE through the shared loader, interpreter and native Metal. | +| Guest-driven Metal rendering (X4) | Independently verified on Apple M5 from original guest PE through RGBA8 texture readback. | +| Authentic Xbox interfaces (X5) | Blocked on public or authorized interfaces and test inputs. | +| Commercial title validation (X6) | Blocked on authentic Xbox interfaces and suitable project test inputs. User import follows the [game file policy](../legal.md#user-provided-game-files). | +| Historical stretch goal for a commercial title (X7) | Blocked. The runtime path and suitable project test inputs are unavailable. | ## Phase 02 acceptance diff --git a/docs/testing/phase01-assurance.md b/docs/testing/phase01-assurance.md index 047f059..72c8245 100644 --- a/docs/testing/phase01-assurance.md +++ b/docs/testing/phase01-assurance.md @@ -68,3 +68,21 @@ shaders and required a completed output mismatch after a matching unmodified baseline. Compile errors, crashes, validation failures and timeouts cannot count as semantic kills. Game execution, proprietary console containers, full guest execution-mask divergence and a guest CPU runtime are unsupported. + +## Follow-up evidence at 5c47900 + +The affected campaign finished with exit 0 after 601 seconds and +244,422,168 executions. No crash, hang or sanitizer failure was recorded. +It used native nightly Rust and cargo-fuzz 0.13.2. The transcript SHA-256 +is `ea81caf9495b57fc617d6470d3cac0488e59d1d727f16bbe8eda470987333a28`. It ran at aff46b0 with the same fuzz inputs as 5c47900. + +### Integrated candidate checks + +All commands in `artifacts/assurance-5c47900/commands.log` completed with +exit 0. This includes 54 workspace tests, the separate LLVM oracle, 12 +validated GPU tests, three end-to-end demos, 12 semantic mutant kills, +native and dependency audits, and claims and generated status checks. +The oracle-only campaign killed 44/44 in 23 seconds. Each outcome has +a named Rust test failure. All seven prior oracle survivors were killed. +This closes the observed oracle test gaps. The full source score stays +attached to aff46b0 and G7 was open at this checkpoint. The later [integrated campaign](mutation.md#integrated-source-campaign-at-4b9a4ce) records its closure. diff --git a/docs/testing/phase01-continuation.md b/docs/testing/phase01-continuation.md deleted file mode 100644 index 616c838..0000000 --- a/docs/testing/phase01-continuation.md +++ /dev/null @@ -1,115 +0,0 @@ -# Xenora Phase 01 continuation for Sol - -This historical handoff records Phase 01 at the prior checkpoint. The -[dual-track baseline](phase-02-baseline.md) records the active scheduling -and preserves the gates below. See the [integrated R2 review](mutation.md#integrated-source-campaign-at-4b9a4ce) for the subsequent G5 and G7 closure. - -Continue Phase 01 only in `~/Developer/Xenora`. Read the current AGENTS.md, -the Master Engineering Prompt V3 including section 40, and the -[assurance record](phase01-assurance.md). Preserve local commits and ignored -evidence. Do not push, publish, rewrite history, or start Phase 02. - -**NOT RELEASE-READY.** Latest validated implementation candidate -`5c479005b0e0631a608a369b9e41327da61bb61e` was clean on main, four commits -ahead of origin/main before this documentation handoff. Run -`git status --short --branch` and `git rev-parse HEAD` first. - -| Gate | Status | Evidence or blocker | -| --- | --- | --- | -| G1 | PASS | Native audit at aff46b0 checked 15 ARM64 workspace binaries/dependencies, no translation or Vulkan/MoltenVK. Exact integrated rerun in `artifacts/assurance-5c47900/native.log` when available. | -| G2 | PASS | Integrating 5c47900 passed format, all-target/all-feature Clippy with warnings denied, 54 default tests, two LLVM tests opt-in. Logs under `artifacts/r2-review-aff46b0/integrated-*` and exact candidate rerun under `artifacts/assurance-5c47900/`. | -| G3 | PASS | On aff46b0, Apple M5 passed 12 native tests with zero skips and both validation layers active. `artifacts/assurance-aff46b0/gpu.log`. | -| G4 | PASS | All three unchanged original shaders matched CPU reference and known answers on aff46b0. `artifacts/assurance-aff46b0/demo.log`. | -| G5 | BLOCKED | Integrated second-oracle suite passed 13 tests. R1 independently verified the integer FP32 proof and 20 rational boundary expectations. The latest locked candidate and oracle-only checks passed. Record final R2 sign-off. | -| G6 | PASS | R2 signed off on 303 comparisons across 15 forms, three malformed and six subset probes using Homebrew LLVM 23.1.6. Oracle inputs unchanged in 5c47900. | -| G7 | BLOCKED | Full source result applies only to aff46b0. The latest independent oracle-only rerun killed 44/44. The full source campaign on the integrated candidate remains pending. | -| G8 | BLOCKED | Claims lint passed with 20 entries, A4/B6/D7/E2/U1. Register AMD branch displacement and correct interpreter evidence scope, then finish independent prose audit. | -| G9 | BLOCKED | Historical three campaigns totaled 435,803,394 executions in 1,803 seconds. Refreshed fixture passed 244,422,168 executions in 601 seconds. Decoder/reference historical logs lack full candidate provenance. | -| G10 | BLOCKED | Exploratory AC run used cc0daa7, two warmups, 21 reps per size, release and validation off. Idle state unestablished. Complete corpus, stage and cold/warm timings, tool/capability metadata and variability protocol. | -| G11 | BLOCKED | SDK-derived binding redistribution and pinned attribution unresolved. Preserve objc2 and notices. No licensing clearance or binary publication. | -| G12 | BLOCKED | Strict fsck and scoped secret, path and build-artifact scans passed. Post-policy DCO attestations remain outstanding. See latest `hygiene.log`. | -| G13 | PASS | R1 passed generated status and claims consistency checks at 5c47900. CI invokes the check. | -| G14 | PASS | CPU boundary ADR and transitive check across five graphics crates passed. | -| G15 | BLOCKED | R1 and R2 reported independently. Open source revalidation, claims, benchmark and licensing findings prevent final closure. | - -## G7 evidence - -The independently audited aff46b0 campaign generated 399 mutations. Raw -counts were 360 caught, 13 missed, 25 unviable and one timeout. The 13 -misses are proven equivalents and the 25 unviables are rustc failures. -One raw caught mutant was a reference non-progress SIGKILL without a -behavioral assertion. Count 359/361 = **99.45%**, retaining both -non-progress cases in the denominator. Read -[the full report and per-mutant proofs](mutation.md). Raw ledger and -outcomes are in `artifacts/mutation/source-aff46b0/`. - -The 12 semantic GPU mutations returned different outputs by design. -Every unmodified shader matched its independent known answers. The -aff46b0 oracle-only campaign caught 37 of 44. New independent witnesses -for all seven gaps are committed at 5c47900. Do not transfer the old -source score to the changed test suite. - -## Resume in this order - -1. Inspect `artifacts/assurance-aff46b0/fuzz/{environment.log,fixture.log,fixture.exit,fixture.finished}`. - The 600-second fixture job started on clean aff46b0. The relevant - source, dependency, fixture and fuzz inputs are identical at 5c47900 - as checked in `artifacts/assurance-5c47900/fuzz-input-diff.log`. - Preserve raw historical logs under `artifacts/g9/`. -2. Inspect `artifacts/assurance-5c47900/{commands,exits,oracle}.log` - and `artifacts/mutation/oracle-5c47900/mutants.out/`. The oracle-only - campaign and exact-candidate checks were queued after fuzz. If already - complete, use the logs. Preserve both candidate epochs. -3. Run the complete source campaign once against the integrated candidate. - Independently inspect every survivor, timeout, invalid and non-assertion - failure. Close G5/G7 only after appropriate candidate review. -4. Finish G9 provenance, G8 prose audit, G10 protocol and G15 sign-off. - Keep G11 blocked until actual resolution. - -```sh -cd ~/Developer/Xenora -git status --short --branch -git rev-parse HEAD -export CARGO_BUILD_JOBS=2 -export LLVM_BIN="$(brew --prefix llvm)/bin" -export PATH="$LLVM_BIN:$PATH" -candidate="$(git rev-parse --short HEAD)" -cargo test --locked -p xenora-semantic-review -cargo mutants --file crates/ref/src/lib.rs \ - --re ' in (vector_alu|execute_lane)$|replace (vector_alu|execute_lane) ->' \ - --test-package xenora-semantic-review --jobs 2 --timeout 60 \ - --output "artifacts/mutation/oracle-$candidate" -scripts/mutation.sh "artifacts/mutation/source-$candidate" -``` - -Perform needed campaigns serially. If affected fixture evidence is -missing, use `scripts/fuzz.sh fixture 600`. For exact candidate provenance -of the other two targets, use `scripts/fuzz.sh instruction_stream 600` -then `scripts/fuzz.sh reference 600`, capturing individual exit codes. -For remaining short integration and native checks use the commands in -[the assurance checkpoint](phase01-assurance.md). - -The AC report is -[run 1795352394](../../benchmarks/results/apple-m5/run-1795352394/report.md). -Binding rights and notice blockers are in [the license inventory](../licenses.md). -Only original bounded synthetic gfx1030 compute fixtures are supported. -Game execution, proprietary guest containers, full guest mask divergence -and a guest CPU runtime remain unsupported. - -## Completed fixture refresh - -The affected campaign finished with exit 0 after 601 seconds and -244,422,168 executions. No crash, hang or sanitizer failure was recorded. -It used native nightly Rust and cargo-fuzz 0.13.2. The transcript SHA-256 -is `ea81caf9495b57fc617d6470d3cac0488e59d1d727f16bbe8eda470987333a28`. It ran at aff46b0 with the same fuzz inputs as 5c47900. - -## Exact integrated candidate results - -All commands in `artifacts/assurance-5c47900/commands.log` completed with -exit 0. This includes 54 workspace tests, the separate LLVM oracle, 12 -validated GPU tests, three end-to-end demos, 12 semantic mutant kills, -native and dependency audits, and claims and generated status checks. -The oracle-only campaign killed 44/44 in 23 seconds. Each outcome has -a named Rust test failure. All seven prior oracle survivors were killed. -This closes the observed oracle test gaps. The full source score stays -attached to aff46b0 and G7 remains open for the integrated candidate. diff --git a/experiments/x1/README.md b/experiments/x1/README.md index 52c606b..eb77e5b 100644 --- a/experiments/x1/README.md +++ b/experiments/x1/README.md @@ -1,4 +1,6 @@ -# X1 bounded x86-64 interpreter +# Synthetic guest execution experiments + +The bounded x86-64 guest interpreter (X1) runs on native ARM64 macOS. This isolated Cargo workspace implements the two original fixtures in the [Phase 02 feasibility study](../../docs/research/phase02-cpu-feasibility.md). @@ -39,7 +41,7 @@ driver="$CARGO_TARGET_DIR/aarch64-apple-darwin/debug/xenora-x1" 2>&1 | tee artifacts/x1/native.log ``` -## X2 fixed-base PE32+ experiment +## Fixed-base 64-bit Portable Executable loading (X2) X2 interprets an original synthetic AMD64 guest image. The loader uses the header, directory and section layouts from the [Microsoft PE format specification](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format). @@ -77,7 +79,7 @@ cargo test --manifest-path experiments/x1/Cargo.toml --locked --target aarch64-a cargo run --manifest-path experiments/x1/Cargo.toml --locked --target aarch64-apple-darwin -- x2 ``` -## X3 fixed-base guest compute experiment +## Guest-to-GPU command submission (X3) X3 uses an original AMD64 PE32+ fixture with fixed image base `0x400000`. The shared X2 loader validates the PE entry and maps the declared virtual @@ -129,7 +131,7 @@ env MTL_DEBUG_LAYER=1 MTL_SHADER_VALIDATION=1 MTL_SHADER_VALIDATION_REPORT_TO_ST "$CARGO_TARGET_DIR/$target/debug/xenora-x1" x3 ``` -## X4 fixed-base guest render experiment +## Guest-driven Metal rendering (X4) Two original PE fixtures use the X3 image layout and the X1 trap path. Each carries a 32-byte command followed by 16 read-only parameter bytes. diff --git a/fixtures/rdna2/ashr.md b/fixtures/rdna2/ashr.md index cd84c82..b88f318 100644 --- a/fixtures/rdna2/ashr.md +++ b/fixtures/rdna2/ashr.md @@ -49,7 +49,7 @@ control, replace only the literal word at offset `0x10` with `0x7fffffff` and use +2147483647 in the derivation. The destination aliases the signed source to exercise the old register value. -After the review slot clears, run the CPU test and the native readback in a +To reproduce the local result, run the CPU test and the native readback in a bounded process: ```sh @@ -60,4 +60,8 @@ MTL_DEBUG_LAYER=1 MTL_SHADER_VALIDATION=1 MTL_SHADER_VALIDATION_REPORT_TO_STDERR -- --ignored --nocapture --test-threads=1 ``` -Native execution is pending. This fixture cannot establish Xbox behavior. +The repository overhaul checkout based on `6ccb23d` passed the CPU +known-answer test and the opt-in native readback test on Apple M5 with +Metal API and shader validation enabled (class A). Local logs are in +`artifacts/repo-overhaul/`. Independent acceptance remains open in +[issue #19](https://github.com/ranveersoni98/Xenora/issues/19). diff --git a/scripts/assemble-fixture.sh b/scripts/assemble-fixture.sh index eb498c0..4d6645d 100755 --- a/scripts/assemble-fixture.sh +++ b/scripts/assemble-fixture.sh @@ -11,7 +11,7 @@ case "${1:-}" in *) printf '%s\n' 'usage: scripts/assemble-fixture.sh [--check]' >&2; exit 2 ;; esac -for name in add bitwise-branch float-exact or shifts; do +for name in add bitwise-branch float-exact or shifts ashr; do "$llvm_bin/llvm-mc" -triple=amdgcn-amd-amdhsa -mcpu=gfx1030 -mattr=+wavefrontsize32 \ -filetype=obj "fixtures/rdna2/$name.s" -o "$scratch/$name.o" "$llvm_bin/llvm-objcopy" -O binary --only-section=.text "$scratch/$name.o" "$scratch/$name.bin" diff --git a/scripts/audit/status.py b/scripts/audit/status.py index c8070d4..47cb649 100644 --- a/scripts/audit/status.py +++ b/scripts/audit/status.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-3.0-or-later -"""Render the feature and instruction tables from the checked-in status registry.""" +"""Render the checked-in status tables and progress graphic.""" import argparse +from html import escape from pathlib import Path import sys import tomllib @@ -33,6 +34,71 @@ def replace_block(path, name, body, check): return True +def render_progress(status): + forms = status["instruction"] + milestones = status["guest_milestones"] + verified_gpu = {"fixture verified", "fixture verified on Apple M5"} + local_gpu = "local Apple M5 readback passed; acceptance pending" + if not forms or len({item["form"] for item in forms}) != len(forms): + raise ValueError("expected a nonempty inventory of unique instruction forms") + for item in forms: + if any(type(item[key]) is not bool for key in ("recognized", "decoded")): + raise ValueError(f"{item['form']}: expected boolean decoder status") + if item["decoded"] and not item["recognized"]: + raise ValueError(f"{item['form']}: decoded form must be recognized") + if item["gpu"] in verified_gpu and ( + not item["decoded"] or not item["lowering"] or item["cpu"] != "fixture verified" + ): + raise ValueError(f"{item['form']}: GPU verification requires a verified CPU path") + if item["gpu"] == local_gpu and ( + not item["decoded"] or not item["lowering"] or item["cpu"] != "local known-answer test passed" + ): + raise ValueError(f"{item['form']}: local GPU evidence requires the local CPU result") + if item["gpu"] not in verified_gpu | {"acceptance pending", local_gpu}: + raise ValueError(f"{item['form']}: unknown GPU evidence status") + if set(milestones) != {"X1", "X2", "X3", "X4"} or any( + value not in {"accepted", "pending"} for value in milestones.values() + ): + raise ValueError("expected acceptance status for each of X1–X4") + + rows = [ + ("Decoded gfx1030 forms", sum(item["decoded"] for item in forms), len(forms)), + ("Accepted Metal forms · Apple M5", sum(item["gpu"] in verified_gpu for item in forms), len(forms)), + ("Accepted guest milestones · X1–X4", list(milestones.values()).count("accepted"), len(milestones)), + ] + svg = [ + '', + 'Xenora · recorded progress', + '' + escape(". ".join(f"{label}: {count} of {total}" for label, count, total in rows)) + '', + '', + '', + 'RECORDED FIXTURE PROGRESS', + ] + for y, (label, count, total) in zip((58, 96, 134), rows, strict=True): + svg.extend([ + f'{escape(label)}', + f'{count} / {total}', + f'', + f'', + ]) + svg.extend([ + 'Scope: tracked instruction forms and four synthetic guest milestones.', + '', + '', + ]) + return "\n".join(svg) + "\n" + + +def check_asset(path, svg, check): + if path.exists() and path.read_text() == svg: + return True + if check: + print(f"{path}: progress graphic differs from docs/status.toml", file=sys.stderr) + return False + path.write_text(svg) + return True + + def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--check", action="store_true") @@ -79,8 +145,10 @@ def main(): for item in status["instruction"] ], ) + svg = render_progress(status) checks = [ - replace_block(root / "README.md", "features", features, check), + replace_block(docs / "progress.md", "features", features, check), + check_asset(docs / "assets/xenora-progress.svg", svg, check), replace_block(docs / "shaders/instruction-coverage.md", "instructions", instructions, check), ] return 0 if all(checks) else 1 diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 8204739..b9094a5 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -14,10 +14,10 @@ xcodebuild -version xcrun --find metal xcrun metal --version -if command -v brew >/dev/null 2>&1; then - llvm_bin=${LLVM_BIN:-$(brew --prefix llvm)/bin} -else - llvm_bin=${LLVM_BIN:-} +llvm_bin=${LLVM_BIN:-} +if [ -z "$llvm_bin" ] && command -v brew >/dev/null 2>&1 && + llvm_prefix=$(brew --prefix llvm 2>/dev/null); then + llvm_bin="$llvm_prefix/bin" fi for tool in llvm-mc llvm-objcopy llvm-objdump; do if [ -n "$llvm_bin" ] && [ -x "$llvm_bin/$tool" ]; then