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.
- Backend
Config - Configuration passed to
Backend::lower. - Emitted
Text - Plain text emitted by a single
TargetEmitterbefore the multi-emitter routing decides what to put in the finalArtifact. Doesn’t carryQuorumStatus(that’s chosen by the wrapper). - Multi
Emitter Backend - Multi-emitter backend wrapper. Composes a general emitter
(mandatory) + an optional specialist under a
QuorumPolicy. ImplementsBackendso it slots into the existing dispatch without touchingTranspileSession. - ViaEntry
- A single emitter entry from
compile_targets.viain the YAML schema. Mirrors the structured-record form spec’d insub/layer5-multi-emitter-quorum.md§“Contract YAML schema extension”.
Enums§
- Backend
Error - Diff
Exec Result - Result of a
DiffExecquorum policy execution. Two PTX (or WGSL/ SPIR-V) programs were run on test inputs; the engine compared their numerical outputs. - Emitter
Role - 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.
- Quorum
Policy - Policy for combining outputs when both General and Specialist
emitters fire on the same input. Configured per Layer-5 contract
via
compile_targets.quorum_policyin the YAML. - Quorum
Status - Status of a multi-emitter quorum vote, attached to an
Artifactproduced 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. - Target
Emitter - Single-emitter trait — sub-trait of a multi-emitter backend.
One
TargetEmitterhandles emission for one logical path (general vs specialist). EachMultiEmitterBackendwraps one mandatory general emitter and optionally one specialist.