Skip to content

feat(aot): run joinable guest workers with ordered memory access - #4740

Closed
yabanana wants to merge 286 commits into
boykopovar:mainfrom
yabanana:feature/aot-guest-concurrency
Closed

yabanana wants to merge 286 commits into
boykopovar:mainfrom
yabanana:feature/aot-guest-concurrency

Conversation

@yabanana

@yabanana yabanana commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Add an opt-in ordered-normal-memory profile and default joinable glibc guest workers to the whole-program ARM64 AOT path. Guest workers receive separate stacks and static TLS; join returns the guest result and releases storage. Add once, default mutex/condition initialization and destruction, and an atomic futex word read. Thread creation refuses images emitted with the single-thread profile.

Ordinary guest accesses use side-effecting AArch64 instructions, compiler memory clobbers and full barriers. This deliberately strengthens store-to-load ordering and has a cost; it is not an optimized implementation of every x86 TSO behavior. Qualification requires coherent normal memory, aligned same-width scalar conflicting accesses and race-free provider buffers. Unaligned/vector/mixed-width races, MMIO, cancellation, detach, custom attributes and TLS destructors remain outside the profile. No runtime decoder, JIT or Rosetta dependency is introduced.

Integrate main's driver tracing header/compression dependencies, keep SDL display refresh queries on the macOS main thread, and supply anonymous file backing for the new shared-memory API on macOS. A native test checks 32 alias/write/close/unmap cycles; it does not execute generated guest code.

Tested

Apple Silicon macOS: 594 compiler/relinker/runtime tests passed. New executable tests cover two guest workers, independent TLS, 20,000 contended updates, join results, repeated join rejection, refusal of the single-thread profile, message passing, fenced store buffering and IRIW (128 rounds each). These observations are not a universal memory-model proof; herdtools model checking has not been performed.

Rebuilt upstream zstd 1.5.7 with multithreading enabled, converted its x86-64 glibc ELF and exercised 18 cases with 1/2/4 workers, empty/boundary/4 MiB inputs and repetitive/random bytes. Output matches a source-built ARM64 reference; every compressed result round-trips through a separate native decoder. This is source-equivalent comparison, not the same ELF executed on two architectures or PS5 game compatibility. 27 native integrations passed. The rebuilt cube completes 600 flips per implementation, teardown and eight exact RGB comparisons; pad and the typed module consumer also pass. No speedup claim.

Checklist

  • Based on current main; checked existing open pull requests
  • One topic per PR; follow-ups go in a new PR
  • No comments added in code
  • Unsupported cases remain explicit
  • No private investigation files, binaries, images or logs added
  • No new third-party code
  • Generic behavior, not specific to one title
  • Depends on: feat(aot): run guest C++ exceptions with static TLS and checked atomics #4718 and its preceding stack
  • Unblocks: none
  • AI-assisted: yes

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