embedl_deploy.backend package#

Module contents:

Backend discovery and selection.

class embedl_deploy.backend.Backend(name: str, conversion_patterns: Sequence[type[Pattern]] = (), fusion_patterns: Sequence[type[Pattern]] = (), state_prep_patterns: Sequence[type[Pattern]] = (), stub_prep_patterns: Sequence[type[Pattern]] = ())[source]#

Bases: object

A collection of patterns for a specific hardware target.

Each field holds patterns for exactly one Phase. __post_init__ validates that every pattern’s phase matches the field it is assigned to.

conversion_patterns: Sequence[type[Pattern]] = ()#

Structural rewrite patterns, applied iteratively.

fusion_patterns: Sequence[type[Pattern]] = ()#

Fusion patterns, applied in a single pass after conversions.

name: str#

Short unique identifier for the backend.

state_prep_patterns: Sequence[type[Pattern]] = ()#

State-prep patterns, applied sequentially once each.

stub_prep_patterns: Sequence[type[Pattern]] = ()#

Q/DQ stub surgery patterns, looped to a fixpoint.

embedl_deploy.backend.discover_backends() list[Backend][source]#

Return all installed backends.

Results are cached after the first call.

Returns:

List of discovered Backend instances.

embedl_deploy.backend.get_backend() Backend[source]#

Return the active backend, discovering it if necessary.

If no backend has been set via set_backend(), the installed backends are discovered automatically. When exactly one is found it becomes the active backend.

Returns:

The active Backend.

Raises:

RuntimeError – If no backends are installed, or if multiple backends are installed and none has been explicitly selected.

embedl_deploy.backend.reset_backends() None[source]#

Clear cached discovery results and the active backend.

embedl_deploy.backend.set_backend(name: str) None[source]#

Select the active backend by name.

Parameters:

name – The name of a discovered backend (e.g. "tensorrt", "lattice_advanced").

Raises:

ValueError – If name does not match any installed backend.