fhelium.compile.passes.backend
Resolve Program operations and link live resources for execution.
PrepareOperationOperandsPass
class View source
PrepareOperationOperandsPass(registry: OperationImplementationRegistry, resources: CkksDeviceResources | RnsContext | NttContext | Iterable[CkksDeviceResources | RnsContext | NttContext] = (), keys: Mapping[object, object] | Iterable[object] | EvaluationKeySet = (), name: str = 'prepare-operation-operands')Ask selected implementations for missing parameter Tensor requirements.
A Backend's optional tensor_requirements(operation, config) returns operation attributes and named material descriptions. This pass adds only missing operands; supplied Tensors, assignments, and existing symbols remain unchanged. Optional caller-supplied resources and keys populate missing entries in the current Compilation's material table through the shared preparation utility. No keys are generated. Implementations can defer requirements when execution facts are insufficient.
Attributes
| Name | Type | Default/value |
|---|---|---|
registry | OperationImplementationRegistry | |
resources | CkksDeviceResources | RnsContext | NttContext | Iterable[CkksDeviceResources | RnsContext | NttContext] | () |
keys | Mapping[object, object] | Iterable[object] | EvaluationKeySet | () |
name | str | 'prepare-operation-operands' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...AssignImplementationsPass
class View source
AssignImplementationsPass(selections: Mapping[str, str] = field(default_factory=dict), overwrite: bool = False, name: str = 'assign-implementations')Attach requested implementation names to selected operation classes.
selections maps exact textual operation names to implementation names. Unselected operations and unknown mixed-level IR remain unchanged. The attribute is a backend build constraint; this pass neither discovers implementations nor asserts executable coverage.
Attributes
| Name | Type | Default/value |
|---|---|---|
selections | Mapping[str, str] | field(default_factory=dict) |
overwrite | bool | False |
name | str | 'assign-implementations' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...Annotate exact operation-name matches and report every assignment.
AssignNttImplementationPass
class View source
AssignNttImplementationPass(implementation: str | None = None, overwrite: bool = False, ntt_backend: str | None = None, algorithm: str | None = None, group_width: int | None = None, radix: int | None = None, name: str = 'assign-ntt-implementation')Assign a complete schedule or partial algorithm constraints.
Algorithm constraints apply to logical NTT operations and CKKS domain transitions. A concrete implementation applies to logical NTT operations; place this pass after CKKS lowering when assigning that implementation. Unspecified fields remain available to subsequent selection passes.
Attributes
| Name | Type | Default/value |
|---|---|---|
implementation | str | None | None |
overwrite | bool | False |
ntt_backend | str | None | None |
algorithm | str | None | None |
group_width | int | None | None |
radix | int | None | None |
name | str | 'assign-ntt-implementation' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...SelectNttImplementationsPass
class View source
SelectNttImplementationsPass(registry: OperationImplementationRegistry, name: str = 'select-ntt-implementations')Ask the selected NTT implementation to complete missing schedule choices.
Caller assignments and supplied Tensor operands remain authoritative. Missing transform tables become ordinary material references, whose data must be supplied separately. Operations with insufficient selection facts remain unchanged and report why their choice was deferred.
Attributes
| Name | Type | Default/value |
|---|---|---|
registry | OperationImplementationRegistry | |
name | str | 'select-ntt-implementations' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...InitializeResourceBindingsPass
class View source
InitializeResourceBindingsPass(resources: ResourceBindings = field(default_factory=ResourceBindings), name: str = 'initialize-resource-bindings')Replace resource state left by an earlier build with this build's base.
Attributes
| Name | Type | Default/value |
|---|---|---|
resources | ResourceBindings | field(default_factory=ResourceBindings) |
name | str | 'initialize-resource-bindings' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...LinkProgramPass
class View source
LinkProgramPass(name: str = 'link-backend-program')Match all external references and produce the Program executable.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'link-backend-program' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...MaterializeResourcesPass
class View source
MaterializeResourcesPass(materializer: ResourceMaterializer, name: str = 'materialize-backend-resources')Create missing constructible resources once for the whole Program.
Attributes
| Name | Type | Default/value |
|---|---|---|
materializer | ResourceMaterializer | |
name | str | 'materialize-backend-resources' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...ResolveBackendOperationsPass
class View source
ResolveBackendOperationsPass(registry: OperationImplementationRegistry, in_place: bool = False, name: str = 'resolve-backend-operations')Require Backend support and build the Program dispatch table.
Attributes
| Name | Type | Default/value |
|---|---|---|
registry | OperationImplementationRegistry | |
in_place | bool | False |
name | str | 'resolve-backend-operations' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...ResolveTensorPlaceholdersPass
class View source
ResolveTensorPlaceholdersPass(name: str = 'resolve-tensor-placeholders')Supply available Tensors while leaving missing references unresolved.
The pass performs no allocation, generation or callback. Callers can run it with a partial table; linking checks references that are still required.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'resolve-tensor-placeholders' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...ValidateExecutionRepresentationsPass
class View source
ValidateExecutionRepresentationsPass(name: str = 'validate-execution-representations')Require concrete legal representations at fixed executable ABIs.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'validate-execution-representations' |
run
method
def run(compilation: 'Compilation') -> PassResult: ...backend_linking_pipeline
function View source
def backend_linking_pipeline(backend: OperationBackend, *, in_place: bool=False) -> Pipeline: ...Return the standard Backend linking sequence as an editable Pipeline.