qat.core.pipeline module
- class EngineSet(engines={}, loaders={})
Bases:
object
Stores a set of engines, allowing identification by name.
Also stores corresponding loaders which can be used to update the models within engines for engines that have a
RequiresHardwareModelMixin
mixin.- classmethod from_descriptions(engine_descriptions, available_hardware)
Creates an
EngineSet
from a list of engine descriptions.- Return type:
- get(name, default=None)
Returns an engine by name, or a default if not found.
- Return type:
- reload_all_models()
Reloads all models for engines that require a hardware model.
- reload_model(name)
Reloads the model for an engine with the given identifier.
- class HardwareLoaders(hardware_loaders={})
Bases:
object
- clear_cache()
- classmethod from_descriptions(hardware_loader_descriptions)
- get_loader(loader_name, default=None)
Returns a hardware model loader by name.
- Return type:
- load(loader_name, default=None, allow_cache=True)
Loads a hardware model, using the internal cache unless allow_cache=False.
- reload_all_models()
Reloads all hardware models from their respective loaders, updating the cache.
- reload_model(loader_name)
Reloads a hardware model from its loader, updating the model in the cache.
- Return type:
- class PipelineManager(compile_pipelines, execute_pipelines, full_pipelines)
Bases:
object
A manager for pipelines, storing compilation and execution pipelines.
Currently, pipelines are catergorised by their type (or the type produced by factories):
CompilePipeline
- pipelines for compilationExecutePipeline
- pipelines for executionPipeline
- pipelines that handle both compilation and execution.
As such, when making calls to pipelines by name, we need to handle the logic for retreiving the correct pipeline given the task.
- add(pipeline, default=False)
Adds a pipeline to the manager.
- property default_compile_pipeline: str
Returns the name of the default compile pipeline.
- property default_execute_pipeline: str
Returns the name of the default execute pipeline.
- classmethod from_descriptions(compile_pipelines, execute_pipelines, full_pipelines, available_hardware, available_engines)
Creates a PipelineManager from a list of pipeline descriptions.
- Return type:
- get_compile_pipeline(pipeline)
Returns a compile pipeline by name or instance.
- Return type:
AbstractPipeline
- get_execute_pipeline(pipeline)
Returns an execute pipeline by name or instance.
- Return type:
AbstractPipeline
- property list_compile_pipelines: list[str]
Returns a list of compile pipeline names.
- property list_execute_pipelines: list[str]
Returns a list of execute pipeline names.
- reload_all_models()
Reloads all models in all pipelines that have a loader.
- remove(pipeline, compile=None, execute=None)
Removes a pipeline from the manager.
- Parameters:
pipeline¶ (
AbstractPipeline
|str
) – The pipeline to remove, either by name or instance.compile¶ (
Optional
[bool
]) – Determines if the pipeline should be removed from compile pipelines. If None, the manager will decide given the pipeline type.execute¶ (
Optional
[bool
]) – Determines if the pipeline should be removed from execute pipelines. If None, the manager will decide given the pipeline type.
- set_default(pipeline, compile=None, execute=None)
Sets the default pipeline for compilation or execution.
If the pipeline is a full pipeline, then it must be set as the default for both compilation and execution. Else, if there exists a compile or execute pipeline with the same name, it can be specified for which the default should be set for. By default, it will be both.
- class PipelineSet(pipelines=[])
Bases:
object
- add(pipeline, default=False)
Adds a pipeline for subsequent use for compilation and execution
- property default: str
Returns the name of the current default pipeline
- classmethod from_descriptions(pipeline_descriptions, available_hardware, available_engines)
- get(pipeline)
Gets a stored pipeline by name (str) or passes through a pipeline instance
- Parameters:
pipeline¶ (
AbstractPipeline
|str
) – A pipeline instance or the string name of a stored pipeline- Return type:
AbstractPipeline
- reload_all_models()
Refreshes all
UpdateablePipeline
instances with hardware model loaders by updating the models from their caches.
- reload_model(pipeline)
Refreshes a pipeline by updating the models from its cache.
- Parameters:
pipeline¶ (
str
) – The name of the pipeline to refresh.
- remove(pipeline)
Remove a pipeline
- Parameters:
pipeline¶ (
AbstractPipeline
|str
) – The name of a pipeline or a pipeline instance to remove
- set_default(pipeline)