4.6 KiB
module concrete.fhe.compilation.module_compiler
Declaration of MultiCompiler class.
class FunctionDef
An object representing the definition of a function as used in an fhe module.
method __init__
__init__(
function: Callable,
parameter_encryption_statuses: dict[str, Union[str, EncryptionStatus]]
)
property name
Return the name of the function.
method evaluate
evaluate(
action: str,
inputset: Optional[Iterable[Any], Iterable[tuple[Any, ]]],
configuration: Configuration,
artifacts: FunctionDebugArtifacts
)
Trace, fuse, measure bounds, and update values in the resulting graph in one go.
Args: action (str): action being performed (e.g., "trace", "compile")
inputset (Optional[Union[Iterable[Any], Iterable[Tuple[Any, ...]]]]): optional inputset to extend accumulated inputset before bounds measurement
configuration (Configuration): configuration to be used
artifacts (FunctionDebugArtifacts): artifact object to store informations in
method trace
trace(
sample: Union[Any, tuple[Any, ]],
artifacts: Optional[FunctionDebugArtifacts] = None
)
Trace the function and fuse the resulting graph with a sample input.
Args: sample (Union[Any, Tuple[Any, ...]]): sample to use for tracing
artifacts: Optiona[FunctionDebugArtifacts]: the object to store artifacts in
class ModuleCompiler
Compiler class for multiple functions, to glue the compilation pipeline.
method __init__
__init__(functions: list[FunctionDef], composition: CompositionPolicy)
method compile
compile(
inputsets: Optional[dict[str, Optional[Iterable[Any], Iterable[tuple[Any, ]]]]] = None,
configuration: Optional[Configuration] = None,
module_artifacts: Optional[ModuleDebugArtifacts] = None,
**kwargs
) → FheModule
Compile the module using an ensemble of inputsets.
Args: inputsets (Optional[Dict[str, Union[Iterable[Any], Iterable[Tuple[Any, ...]]]]]): optional inputsets to extend accumulated inputsets before bounds measurement
configuration(Optional[Configuration], default = None): configuration to use
artifacts (Optional[ModuleDebugArtifacts], default = None): artifacts to store information about the process
kwargs (Dict[str, Any]): configuration options to overwrite
Returns: FheModule: compiled module
method wire_pipeline
wire_pipeline(inputset: Union[Iterable[Any], Iterable[tuple[Any, ]]])
Return a context manager that traces wires automatically.