lib-script · crate
kinogaki-script-exec
lib-script's engine: a column (batch) interpreter in safe Rust.
- Repository
- lib-script (kinogaki/lib-script)
- Folder
libs/lib-script/crates/exec- Source
- 12 files, 3,250 lines
- Tests
- 17 files, 2,352 lines
What it is
lib-script's engine: a column (batch) interpreter in safe Rust.
Engine::compile checks a script against a host's schema, lowers it to the column IR, optimises it and assigns registers (cached by source and schema). Engine::run runs it over the host's elements in chunks of kinogaki_script_host::LANES, in parallel through lib-parallel. Every operation is total: errors become faults that report the line, column and lowest failing element, the same at any thread count, and nothing is written. mod@reference is a one-element-at-a-time interpreter of the checked program, the oracle the tests and the fuzzer compare against.
Depends on
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-math | lib-math | normal | Kinogaki's vectors, points, matrices, quaternions and deterministic elementary functions. |
kinogaki-parallel | lib-parallel | normal | Scoped parallel work over disjoint output slices, sized by cost. |
kinogaki-script-host | lib-script | normal | The boundary between lib-script and a host. |
kinogaki-script-ir | lib-script | normal | lib-script's column IR: typed SSA values (vectors as groups of scalar values) in structured regions; lowering from the checked program; uniform/varying analysis; optimisation; a verifier; and the fault table that maps instructions back to source spans. |
kinogaki-script-lib | lib-script | normal | lib-script's function library. |
kinogaki-script-syntax | lib-script | normal | lib-script's syntax: an indentation-aware lexer, a recovering parser and a syntax tree whose every node keeps the exact span of its text. |
kinogaki-script-types | lib-script | normal | lib-script's front end after parsing: types, the host schema a context offers, the library catalog's signatures, the checker that builds the typed program, and completion and hover for the editor. |
Third-party
None.
Used by
| Crate | Repository | As | What it is |
|---|---|---|---|
kinogaki-script-bench | lib-script | normal | Benchmarks on the test host, 1M elements: cargo run --release -p kinogaki-script-bench. |
kinogaki-scripting | Core and the app | normal | Scripts over the standard values: lib-script's engine behind the SDK's ScriptEngine, and what a script sees of each value. |
Modules
engine(private)The engine: compiling (with a cache) and running over chunks in parallel.399 linesfault(private)Run failures: a fault (with line, column and the lowest failing element), cancellation, bad parameters, or a limit.60 linesprogram(private)A built program prepared to run: every SSA value mapped to a register.303 linesreferenceThe scalar reference: the checked program run one element at a time, straight from the typed tree, with the same operation semantics (kinogaki_script_ir::sem, the library's scalar references).254 linesreference::expr(private)Expressions, helpers and context functions; the operation forms the lowering builds, computed directly.362 linesreference::stmt(private)Statements, assignment targets and list values.271 linesregs(private)A worker's register file for one program: per kind, lane registers (boxed, so an instruction's output can be taken out while its inputs are read) and scalar registers; and the list slots.177 linesrun(private)Running one chunk: every instruction over the chunk's lanes, in order.476 linesrun::arith(private)Arithmetic instructions: one tight loop per op over the chunk's lanes (each op's loop is its own instantiation, so LLVM vectorizes it).327 linesrun::data(private)Instructions that read the host, call kernels, change lists or queue edits.507 lines
Public types and traits
At the crate root
Structs CompiledCompileOptionsEngineFaultLimitsReportRunOptions
Enums RunError
Re-exported from other crates
From kinogaki_script_ir FaultKind
By module: 9 public types and traits in 3 modules
engine CompiledCompileOptionsEngineReportRunOptions
fault FaultRunError
reference RefFaultRefOutput
Besides these, 4 public functions at module level.
