Skip to main content

Crate xpile_backend

Crate xpile_backend 

Source
Expand description

Backend trait — code-lane emission abstraction.

Every target language in xpile (Rust, Ruchy, PTX, WGSL, SPIR-V, Lean) provides one type implementing Backend. The trait is intentionally narrow: take meta-HIR and a config, return an Artifact.

Sibling of xpile-frontend::Frontend. Architectural invariants codified in contracts/xpile-backend-trait-v1.yaml.

Structs§

Artifact
Emitted artifact — primary source/IR text plus sidecar files plus the structural citation chain to Layer-5 compile contracts.
BackendConfig
Configuration passed to Backend::lower.
EmittedText
Plain text emitted by a single TargetEmitter before the multi-emitter routing decides what to put in the final Artifact. Doesn’t carry QuorumStatus (that’s chosen by the wrapper).
MultiEmitterBackend
Multi-emitter backend wrapper. Composes a general emitter (mandatory) + an optional specialist under a QuorumPolicy. Implements Backend so it slots into the existing dispatch without touching TranspileSession.
ViaEntry
A single emitter entry from compile_targets.via in the YAML schema. Mirrors the structured-record form spec’d in sub/layer5-multi-emitter-quorum.md §“Contract YAML schema extension”.

Enums§

BackendError
DiffExecResult
Result of a DiffExec quorum policy execution. Two PTX (or WGSL/ SPIR-V) programs were run on test inputs; the engine compared their numerical outputs.
EmitterRole
Role of a backend emitter within a multi-emitter quorum.
HwProfile
Hardware profile for targets whose emission depends on hardware capabilities (PTX compute_capability, WGSL feature set, SPIR-V version).
Profile
Lowering profile — the two-mHIR asymmetric decision for Rust↔Ruchy.
QuorumPolicy
Policy for combining outputs when both General and Specialist emitters fire on the same input. Configured per Layer-5 contract via compile_targets.quorum_policy in the YAML.
QuorumStatus
Status of a multi-emitter quorum vote, attached to an Artifact produced by a multi-emitter backend.
Target
Target language a backend can emit.

Traits§

Backend
Code-lane emission trait. See docs/specifications/sub/backend-trait.md.
TargetEmitter
Single-emitter trait — sub-trait of a multi-emitter backend. One TargetEmitter handles emission for one logical path (general vs specialist). Each MultiEmitterBackend wraps one mandatory general emitter and optionally one specialist.