Structural runtime¶
Host-backed execution of checked encoder, decoder, and structural-loss computations.
structural_runtime
¶
Run host-backed structural computations on the reference machine.
StructuralRuntimeProvider
dataclass
¶
StructuralRuntimeProvider(runtimes: tuple[RuntimeHandler, ...], term_types: frozenset[TypeId], name: str = 'structural')
Bases: RuntimeProvider
PyTorch components and validators for one structural invocation.
| PARAMETER | DESCRIPTION |
|---|---|
runtimes
|
The host handlers implementing the module's structural computations.
TYPE:
|
term_types
|
Type identities whose host values are structural :class:
TYPE:
|
name
|
The provider name recorded in execution results and traces.
TYPE:
|
attach
¶
attach(module: QiecModule, attachments: RuntimeAttachments) -> None
Attach each host computation handler.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked module, unused because the handlers were selected while constructing this provider.
TYPE:
|
attachments
|
The invocation's attachment table.
TYPE:
|
Source code in src/quivers/qiec/structural_runtime.py
validator_for
¶
validator_for(type_: TypeExpr) -> RuntimeValidator | None
Return the validator for structural terms and torch values.
| PARAMETER | DESCRIPTION |
|---|---|
type_
|
The closed QIEC type a host argument or result must inhabit.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RuntimeValidator | None
|
A predicate for scalar weights, structural terms, tensors, and
structural products, or |
Source code in src/quivers/qiec/structural_runtime.py
structural_handler_definition
¶
structural_handler_definition(effect: EffectRef, result: TypeExpr, *, instance_name: str, computation_name: str) -> HandlerDef
Build the stable checked handler signature for one neural attachment.
| PARAMETER | DESCRIPTION |
|---|---|
effect
|
The applied
TYPE:
|
result
|
The closed result type returned by the host component.
TYPE:
|
instance_name
|
The source-derived effect-instance name.
TYPE:
|
computation_name
|
The source-derived structural computation name.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
HandlerDef
|
A stable foreign handler declaration for the component. |
Source code in src/quivers/qiec/structural_runtime.py
structural_runtime_provider
¶
structural_runtime_provider(module: QiecModule, program: Program) -> StructuralRuntimeProvider
Build the typed neural-attachment provider for a compiled module.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked QIEC module whose structural instances need handlers.
TYPE:
|
program
|
The compiled container supplying the corresponding PyTorch objects.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
StructuralRuntimeProvider
|
A provider containing one validated runtime handler per structural instance. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If a structural component returns a type with no host validator. |
Source code in src/quivers/qiec/structural_runtime.py
structural_runtime_configuration
¶
structural_runtime_configuration(module: QiecModule, program: Program) -> RuntimeConfiguration
Return the standard runtime configuration for structural entries.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked QIEC module whose structural entries may be invoked.
TYPE:
|
program
|
The compiled container supplying their PyTorch attachments.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RuntimeConfiguration
|
A configuration selecting the structural provider when the module has structural runtimes, or no providers otherwise. |
Source code in src/quivers/qiec/structural_runtime.py
run_structural
¶
run_structural(module: QiecModule, program: Program, name: str, arguments: Sequence[object], *, fuel: int | None = None) -> ExecutionResult
Run a structural computation through the compiled PyTorch attachments.
| PARAMETER | DESCRIPTION |
|---|---|
module
|
The checked QIEC module.
TYPE:
|
program
|
The classic compiled container supplying encoders, decoders, losses, and their learned tensors.
TYPE:
|
name
|
The structural computation name.
TYPE:
|
arguments
|
Its host arguments.
TYPE:
|
fuel
|
Optional reference-machine step budget.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ExecutionResult
|
The typed result and trace. Torch tensor results retain their autograd graph back to the attached component parameters. |
| RAISES | DESCRIPTION |
|---|---|
KeyError
|
If |