跳转到内容
查看源码

entelechy-cpu自动生成

层:后端层 · 代码行数:4,684 · 集成测试文件:4

CPU 后端(参考解释器):通过能力 ABI 执行经过校验的 IR。

CPU backend: executes validated Entelechy IR through the Capability ABI

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.

内部依赖 entelechy-abi, entelechy-ir, entelechy-rules
外部依赖 —
源码 crates/backends/cpu
名称 简述
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.
函数 简述
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.
名称 类型 取值 简述
CALL_RECORDS usize eval::CALL_RECORDS How many calls a trace records.

ArithmeticError, ExecutionError, address_words, check_invocation, check_scan, check_scatter, combine_words, float_order_key, scatter_index

crates/backends/cpu/src/lib.rs#L30

The CPU backend. Stateless; one instance can execute any module.

方法

函数 说明
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.

实现的 Trait: 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.

方法

函数 说明
fn of(module: &Validated) -> Result<Self, String> Compiles a module; a group’s entry is first rewritten to run its lanes (entelechy_ir::lanes).

实现的 Trait: Clone


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).

属性

名称 类型 说明
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.

实现的 Trait: Clone, Debug, PartialEq, StructuralPartialEq


crates/backends/cpu/src/lib.rs#L265

One element of a Kernel run on the interpreter, every binding shown.

属性

名称 类型 说明
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.

实现的 Trait: Clone, Debug, PartialEq, StructuralPartialEq


crates/backends/cpu/src/lib.rs#L285

Where a traced element failed.

属性

名称 类型 说明
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.

实现的 Trait: Clone, Debug, PartialEq, StructuralPartialEq


crates/backends/cpu/src/lib.rs#L364

One call the traced element made, as it returned.

属性

名称 类型 说明
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.

实现的 Trait: Clone, Debug, PartialEq, StructuralPartialEq