entelechy-cpuGenerated
Layer: backends · Lines of code: 4,684 · Integration test files: 4
CPU backend: executes validated Entelechy IR through the Capability ABI
Description
Section titled “Description”CPU backend.
Compiles a Validated module once into a Code the caller keeps,
and runs it once per output element. Every Host access goes through
the capability-gated Scope; a failed execution releases the
outputs it created.
The compute phase borrows inputs through the scope once and runs rows in parallel; the write phase stores results sequentially. Results equal a single-threaded run, and the first failing element in row-major order is the one reported.
| Internal dependencies | entelechy-abi, entelechy-ir, entelechy-rules |
| External dependencies | — |
| Source | crates/backends/cpu |
Structs
Section titled “Structs”| Name | Brief |
|---|---|
CpuBackend |
The CPU backend. Stateless; one instance can execute any module. |
Code |
A module compiled to the interpreter’s word code, compiled once and bound to each invocation. |
TraceValue |
One named value of a traced element: what a let held when the element finished (its last assignment; zeros if its block never ran). |
Trace |
One element of a Kernel run on the interpreter, every binding shown. |
TraceFault |
Where a traced element failed. |
TraceCall |
One call the traced element made, as it returned. |
Functions
Section titled “Functions”| Function | Brief |
|---|---|
fn trace(module: &Validated, invocation: &Invocation, scope: &mut Scope<'_>, at: [u32; 3]) -> Result<Trace, ExecutionError> |
Runs one element of module on the interpreter and returns every binding of its entry: element at of a map (or of the map part of a reduction or a scatter), or step at[0] of a scan after running the earlier steps. The scope’s Fields are only read. |
Constants
Section titled “Constants”| Name | Type | Value | Brief |
|---|---|---|---|
CALL_RECORDS |
usize |
eval::CALL_RECORDS |
How many calls a trace records. |
Re-exports
Section titled “Re-exports”ArithmeticError, ExecutionError, address_words, check_invocation, check_scan, check_scatter, combine_words, float_order_key, scatter_index
CpuBackend
Section titled “CpuBackend”crates/backends/cpu/src/lib.rs#L30
The CPU backend. Stateless; one instance can execute any module.
Methods
| Function | Description |
|---|---|
fn execute(&self, module: &Validated, invocation: &Invocation, scope: &mut Scope<'_>) -> Result<Vec<Handle>, ExecutionError> |
Executes module over invocation.domain, returning one handle per manifest output. The handles are owned by the caller’s Host. |
fn execute_with(&self, code: Option<&Code>, module: &Validated, invocation: &Invocation, scope: &mut Scope<'_>) -> Result<Vec<Handle>, ExecutionError> |
The same, with the module’s word code already compiled. |
Implemented traits: Backend, Clone, Copy, Debug, Default
crates/backends/cpu/src/lib.rs#L35
A module compiled to the interpreter’s word code, compiled once and bound to each invocation.
Methods
| Function | Description |
|---|---|
fn of(module: &Validated) -> Result<Self, String> |
Compiles a module; a group’s entry is first rewritten to run its lanes (entelechy_ir::lanes). |
Implemented traits: Clone
TraceValue
Section titled “TraceValue”crates/backends/cpu/src/lib.rs#L251
One named value of a traced element: what a let held when the
element finished (its last assignment; zeros if its block never ran).
Properties
| Name | Type | Description |
|---|---|---|
name |
String |
The binding’s name. |
ty |
Type |
Its type. |
words |
Vec<u32> |
Its words, in the ABI’s layout. |
ran |
bool |
Whether the binding’s block ran for this element; words holds meaning only when it did. A loop body runs when its loop does. |
Implemented traits: Clone, Debug, PartialEq, StructuralPartialEq
crates/backends/cpu/src/lib.rs#L265
One element of a Kernel run on the interpreter, every binding shown.
Properties
| Name | Type | Description |
|---|---|---|
at |
[u32; 3] |
The element’s coordinates (a scan’s step is [step, 0, 0]). |
bindings |
Vec<TraceValue> |
Every let of the entry, in source order. |
calls |
Vec<TraceCall> |
Every call the element made, in the order the calls returned (a call inside another comes first), the first CALL_RECORDS. |
calls_truncated |
bool |
Whether the element made more calls than were recorded. |
results |
Vec<TraceValue> |
The entry’s results: the outputs’ elements (a scan’s next carried value, a scatter’s pair, a reduction’s element before the fold). |
fault |
Option<TraceFault> |
Where the element failed, when it did: the bindings above hold what ran before it, and none after. |
Implemented traits: Clone, Debug, PartialEq, StructuralPartialEq
TraceFault
Section titled “TraceFault”crates/backends/cpu/src/lib.rs#L285
Where a traced element failed.
Properties
| Name | Type | Description |
|---|---|---|
message |
String |
What went wrong, as the run reports it. |
function |
Option<String> |
The function it failed in, None the entry. |
value |
Option<ValueId> |
The failing value in that function. |
entry_value |
Option<ValueId> |
In the entry, the value it failed under: the failing one, or the call it failed in. |
bindings |
Vec<TraceValue> |
That function’s bindings as the failure left them, when it failed in a function. |
Implemented traits: Clone, Debug, PartialEq, StructuralPartialEq
TraceCall
Section titled “TraceCall”crates/backends/cpu/src/lib.rs#L364
One call the traced element made, as it returned.
Properties
| Name | Type | Description |
|---|---|---|
function |
String |
The function’s name (a template instance names its Field, as in store<ram>). |
bindings |
Vec<TraceValue> |
Every let of the function, in source order. |
results |
Vec<TraceValue> |
The function’s results. |
Implemented traits: Clone, Debug, PartialEq, StructuralPartialEq

