Characterised 2026-05-17 from hyperpolymath/Axiom.jl @ HEAD (cloned to
~/dev/repos/Axiom.jl). This is the approach PanLL’s panel-clades
coprocessor must follow (per ADR-0001) — the pattern, not Axiom.jl’s code.
|
Note
|
Axiom.jl is the single estate instance where the standard route
reached completion. Treat only code resembling this form as reference;
everything else (incl. src-gossamer/src/coprocessor/) is presumed mess.
|
-
One abstract supertype.
abstract type AbstractBackend end(src/backends/abstract.jl). Every processor class is a concrete subtype. -
One concrete backend struct per processor class. Observed taxonomy:
Reference / impl
JuliaBackend(default, debug/reference),ZigBackend{lib_path}(high-perf native)GPU
CUDABackend,MetalBackend,ROCmBackend— each{device::Int}Accelerators
TPUBackend(tensor),NPUBackend(neural),DSPBackend,PPUBackend(physics),MathBackend,FPGABackend,VPUBackend(vector/vision),QPUBackend(quantum),CryptoBackend— each{device::Int}Maps to PanLL’s 11-backend set: FPGA→FPGA, DSP→DSP, math→Math, physics→PPU, tensor→TPU, vector→VPU, neural→NPU, crypto→Crypto, quantum→QPU. Gap to close: Axiom.jl has no explicit
I/Ooraudiobackend — the form is extended by adding subtypes following the identical pattern. -
A
SmartBackendper-operation dispatcher. Routes each kernel to its fastest backend from recorded benchmark data, with graceful fallback to the Julia/reference backend when the preferred native backend is unavailable. Holds references to candidate backends; dispatch is per-operation (e.g. matmul→BLAS/Julia, gelu→Zig-SIMD), not global. -
Device selection delegated to
AcceleratorGate. Not inline:select_backend,fits_on_device,estimate_cost,device_capabilities,detect_platform,DeviceCapabilities,PlatformInfo. Capability- and cost-based selection + platform detection live in a separate registered package (hyperpolymath/AcceleratorGate, already in the Julia registration chain). PanLL should consume this, not reinvent it. -
ABI/FFI split = the estate language architecture.
-
Idris2 ABI = formal spec/scaffold:
src/Abi/{Types,Layout,Foreign}.idr, concreteaxiom_*symbols (no template placeholders), typechecks viaidris2 --source-dir src --check. -
Zig FFI = authoritative production runtime:
ffi/zig/{src/main.zig,build.zig,include/axiom.h,test/integration_test.zig}, exports concreteaxiom_*C ABI symbols. "For release/readiness decisions, treat the Zig FFI path as authoritative." -
Host bridge:
src/backends/zig_ffi.jl. Bidirectional — host→runtime (axiom_process,axiom_process_array) and runtime→host callbacks (axiom_register_callback,axiom_invoke_callback).
-
-
Concrete symbol naming. C ABI symbols are
<project>_*(hereaxiom_*) — concrete, no{{placeholders}}. PanLL clades use a concretepanll_*/ clade-scoped scheme; placeholder-only files are not done. -
Honest status precedence. Julia = reference/fallback; Idris2 ABI = formal scaffold (must typecheck); Zig FFI = authoritative for release. Plus CI: backend-parity + runtime-smoke checks gate readiness.
-
Characterised: ✅ (this document, from the cloned repo).
-
Self-attested validation (per
Axiom.jl/ABI-FFI-README.md): Idris2 ABI typechecks;cd ffi/zig && zig build testpasses; Julia↔Zig path is CI-covered (backend parity + runtime smoke). The repo’sEXPLAINME.adocis explicit about caveats (e.g.@axiomshape-check is macro-expansion time, not dependent-type). -
Independent re-validation (done 2026-05-17):
-
Idris2 ABI: ✅ PASSES.
src/Abi/{Types,Layout,Foreign}.idrall typecheck clean with Idris2 0.8.0 (/dev/tools/provers/idris2/0.8.0). The formal contract is sound. -
Zig FFI: ❌ FAILS — mechanical bot corruption.
ffi/zig/src/main.zighas 17 invalid identifiers of the formAxiom.jl_init,Axiom.jl_process, … — a bad token substitution put the repo name with the.jlextension where the project token belongs (should beaxiom_init,axiom_process, …)..is illegal in a Zig identifier, sozig build test(Zig 0.15.2) does not compile. -
Damage is localised:
ffi/zig/include/axiom.h, the integration test, andABI-FFI-README.mdare clean and correctly useaxiom_*. Only the implementation filemain.zigwas mangled. The design is intact; this is exactly the "bot/interference mess" class ADR-0001 warns about, and is a trivials/Axiom\.jl_/axiom_/repair. -
Estate spread: the same corruption/placeholder class is present in
panll/panel-clades/ffi/zig/{build.zig,test/integration_test.zig}.
-
PASSED with caveat. The architectural general form is characterised and the formal Idris2 contract re-validates clean — this document is a trustworthy reference for P2 design. The reference Zig implementation needs a trivial de-corruption (Axiom.jl repo, separate from this work) before it is a runnable exemplar. P2 build (not design) is gated on that repair landing.
panel-clades/ already mirrors this skeleton (Idris2 src/abi/.idr, Zig
ffi/zig/, a2ml clade specs) but is an *uninstantiated template. The work
is to instantiate it to this exact form: AbstractBackend supertype + 11
backend subtypes + Smart dispatcher + AcceleratorGate consumption + concrete
Idris2 ABI + authoritative Zig FFI + bidirectional host bridge + parity/smoke
CI. No deviation from the Axiom.jl form.