Skip to content

feat(aot): derive guard sites from qualified image recipes - #4156

Closed
yabanana wants to merge 62 commits into
boykopovar:mainfrom
yabanana:feature/aot-contract-qualification
Closed

yabanana wants to merge 62 commits into
boykopovar:mainfrom
yabanana:feature/aot-contract-qualification

Conversation

@yabanana

@yabanana yabanana commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

The graphics example checked in hundreds of per-instruction guard records that had been expanded by private scripts. This follow-up makes that derivation reproducible in tree: an explicitly qualified recipe supplies the remaining ABI/layout facts and guard policies, and the materializer derives memory-base sites from decoded operands and pointer-argument sites from resolved call ABIs.

This is a draft dependent on #3891 and #1835 while the in-tree AOT direction is undecided. The new review scope is commit 79152cf36, on top of graphics head 798fb84e2; the main-based diff also contains those prerequisites. No new dependency or runtime translation layer is added.

For gpu_cube, the recipe derives 361 memory-base guards and 106 pointer-argument guards, preserving the exact expanded contracts and native object. The checked-in declaration shrinks from 214,252 to 67,273 bytes. This is removal of expanded records, not 70% automatic ABI recovery: all 14 function ABIs, 34 import ABIs, and pointer-load/stack/frame-exclusion obligations remain explicit. Mapping checks do not prove object lifetime, type or full bounds.

Input hashes, the canonical fact/policy digest, and source identities (including structured provider evidence) must match. Changed inputs, bindings, ABI/layout facts, source declarations and policies require requalification. Incomplete decoding and unknown indirect-call targets reject with a localized obligation. The compiler still performs its normal semantic checks. The receipt distinguishes declared ABIs, derived records and remaining annotations. The standalone CLI and fixture integration are documented in BUILD.md.

The rebase updates the qualified Process.cpp/RuntimeSupport.cpp identities and fact digest for upstream callback registration; the derivation mechanism is unchanged.

A cross-process check also found unstable flag-emission ordering from Python sets. Sorting that iteration makes the tested shift IR reproducible across hash seeds without changing its native behavior.

Tested

Latest integration checkpoint (12 October): aligned with main 2f4cc8983, including the new component technical-debt layout. The final combined stack with the separate C++ follow-up #4718 passed 588 compiler/relinker/runtime checks and 26 native integrations on Apple Silicon. Rebuilt cube AOT/reference still match all eight RGB frames after 600 flips each; controller and typed module-bundle acceptance pass. These are local results; hosted CI is running on the updated head. Full Linux/Windows builds still require maintainer dispatch.

Integration checkpoint, 12 October: merged main fe66af13e through the dependency stack and requalified affected provider identities after reviewing their implementations. The final combined stack passed 526 compiler/relinker/runtime cases, 26 native integration cases, the rebuilt graphics pair (600 flips each, teardown, eight exact RGB frames), controller O2 and SHA/memcmp O0/O2 checks on Apple Silicon. Hosted checks refer to the new head and remain separate from these local results. Full Linux/Windows builds require maintainer dispatch.

Apple M5 Max, macOS 27.2, Apple clang 21.0.0:

  • All 457 compiler/relinker/minimal-runtime CTest cases pass at this source revision, including 14 portable recipe cases and two native execution cases.
  • Negative cases cover changed ELF/source/provider/ABI/policy, incomplete decode, segment address domains, duplicate supplied sites, unknown indirect targets and unsupported instructions; existing-output CLI behavior and cross-process IR reproducibility are checked.
  • Independent synthetic load/XOR and imported-call inputs execute with derived guards and trap on invalid/null addresses. These are mechanism tests, not a second unseen homebrew.
  • Source-built cube: expanded contracts compare equal and the ARM64 object is byte-identical to the explicit-contract baseline. Both newly linked executables complete 600 flips and teardown; all eight 1920x1080 captures have zero RGB differences. This run reuses the unchanged runtime archives rebuilt and validated for feat(aot): run source-built graphics on native Apple ARM64 #3891, not a new clean runtime checkout.
  • Conventions, diff whitespace and native test registration checks pass. Hosted CI is pending; full Linux/Windows builds require maintainer dispatch.

No game compatibility, general ABI recovery or performance improvement is claimed by this change.

Checklist

This was referenced Oct 15, 2026
@ArjenS-LA ArjenS-LA mentioned this pull request Oct 15, 2026
11 tasks done
@yabanana

Copy link
Copy Markdown
Contributor Author

Superseded by #5021, which now contains the consolidated native ARM64 AOT implementation and verified consumers. #1835 remains the architecture discussion. Closing this stacked PR to keep one implementation review; its branch and review history are retained. This is not a merge into main.

@yabanana yabanana closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build ci .github docs libc libkernel needs rebase Conflicts with main, rebase needed prx relinker shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant