fhelium.backend.execution
Resolve operation dispatch, link resources, and execute Programs.
OperationBackend
class View source
OperationBackend(registry: OperationImplementationRegistry | None=None, workspace: BackendWorkspace | None=None, *, named_resources: ResourceBindings | None=None, materializer: ResourceMaterializer | None=None)Own operation implementations and one live Backend workspace.
Attributes
| Name | Type | Default/value |
|---|---|---|
registry | OperationImplementationRegistry | |
workspace | BackendWorkspace |
named_resources
property
named_resources: ResourceBindingsReturn named low-level resources configured before linking.
with_named_resources
method
def with_named_resources(resources: ResourceBindings, *, override: bool=True) -> OperationBackend: ...Return this implementation set with an extended resource table.
diagnostics
method
def diagnostics(operation: Operation, *, implementation: str | None=None, in_place: bool=False) -> tuple[str, ...]: ...Report implementation or resource binding failures.
link
method
def link(compilation: Compilation, *, pipeline: Pipeline | None=None) -> ProgramExecutable: ...Link one Compilation with this workspace into an executable.
OperationDispatch
class View source
OperationDispatch(invocation: OperationInvocation, implementation: OperationImplementation, requirements: tuple[ResourceRequirement, ...], effect: OperationEffect, in_place: bool = False, prepared_regions: bool = False)Hold one operation's resolved Backend call before resource linking.
Attributes
| Name | Type | Default/value |
|---|---|---|
invocation | OperationInvocation | |
implementation | OperationImplementation | |
requirements | tuple[ResourceRequirement, ...] | |
effect | OperationEffect | |
in_place | bool | False |
prepared_regions | bool | False |
ProgramDispatchTable
class View source
ProgramDispatchTable(operations: Mapping[Operation, OperationDispatch])Map executable Program operations to resolved Backend calls.
Attributes
| Name | Type | Default/value |
|---|---|---|
operations | Mapping[Operation, OperationDispatch] |
ProgramExecutable
class View source
ProgramExecutable(program: Program, dispatch_table: ProgramDispatchTable, resources: tuple[BoundResource, ...], resource_indices: Mapping[Operation, tuple[int, ...]], bound_resources: Mapping[Operation, BoundResource], bound_materials: Mapping[Operation, object])Execute host control flow prepared from one linked Program.
Calls and external bindings are resolved once. Generated local variables preserve dataflow, and flat-block temporaries are released at last use. host_source exposes the prepared control flow without serializing its bound objects. Tensor storage and aliases retain ordinary PyTorch ownership.
Attributes
| Name | Type | Default/value |
|---|---|---|
program | Program | |
dispatch_table | ProgramDispatchTable | |
resources | tuple[BoundResource, ...] | |
resource_indices | Mapping[Operation, tuple[int, ...]] | |
bound_resources | Mapping[Operation, BoundResource] | |
bound_materials | Mapping[Operation, object] | |
host_source | str | field(init=False, repr=False, compare=False) |
manifest
property
manifest: Mapping[str, object]run
method
def run(*inputs: object) -> object: ...