Files
concrete/docs/dev/api/concrete.fhe.compilation.module_compiler.md
Benoit Chevallier-Mames 2424352dbf docs(compiler): update apidocs
2024-04-15 09:37:48 +02:00

10 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]]
)

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, ]])

Trace the function and fuse the resulting graph with a sample input.

Args: sample (Union[Any, Tuple[Any, ...]]): sample to use for tracing


class DebugManager

A debug manager, allowing streamlined debugging.

method __init__

__init__(config: Configuration)

method debug_assigned_graph

debug_assigned_graph(name, function_graph)

Print assigned graphs if configuration tells so.


method debug_bit_width_assignments

debug_bit_width_assignments(name, function_graph)

Print bitwidth assignments if configuration tells so.


method debug_bit_width_constaints

debug_bit_width_constaints(name, function_graph)

Print bitwidth constraints if configuration tells so.


method debug_computation_graph

debug_computation_graph(name, function_graph)

Print computation graph if configuration tells so.


method debug_mlir

debug_mlir(mlir_str)

Print mlir if configuration tells so.


method debug_statistics

debug_statistics(module)

Print statistics if configuration tells so.


method debug_table

debug_table(title: str, activate: bool = True)

Return a context manager that prints a table around what is printed inside the scope.


method show_assigned_graph

show_assigned_graph()  bool

Tell if the configuration involves showing assigned graph.


method show_bit_width_assignments

show_bit_width_assignments()  bool

Tell if the configuration involves showing bitwidth assignments.


method show_bit_width_constraints

show_bit_width_constraints()  bool

Tell if the configuration involves showing bitwidth constraints.


method show_graph

show_graph()  bool

Tell if the configuration involves showing graph.


method show_mlir

show_mlir()  bool

Tell if the configuration involves showing mlir.


method show_optimizer

show_optimizer()  bool

Tell if the configuration involves showing optimizer.


method show_statistics

show_statistics()  bool

Tell if the configuration involves showing statistics.


class ModuleCompiler

Compiler class for multiple functions, to glue the compilation pipeline.

method __init__

__init__(functions: List[FunctionDef])

method compile

compile(
    inputsets: Optional[Dict[str, Union[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