# 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__` ```python __init__( function: Callable, parameter_encryption_statuses: Dict[str, Union[str, EncryptionStatus]] ) ``` --- ### method `evaluate` ```python 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` ```python 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 `NotComposable` Composition policy that does not allow the forwarding of any output to any input. --- ### method `get_rules_iter` ```python get_rules_iter(_funcs: List[FunctionDef]) → Iterable[CompositionRule] ``` Return an iterator over composition rules. --- ## class `AllComposable` Composition policy that allows to forward any output of the module to any of its input. --- ### method `get_rules_iter` ```python get_rules_iter(funcs: List[Graph]) → Iterable[CompositionRule] ``` Return an iterator over composition rules. --- ## class `WireOutput` A protocol for wire outputs. --- ### method `get_outputs_iter` ```python get_outputs_iter() → Iterable[CompositionClause] ``` Return an iterator over the possible outputs of the wire output. --- ## class `WireInput` A protocol for wire inputs. --- ### method `get_inputs_iter` ```python get_inputs_iter() → Iterable[CompositionClause] ``` Return an iterator over the possible inputs of the wire input. --- ## class `Output` The output of a given function of a module. --- ### method `get_outputs_iter` ```python get_outputs_iter() → Iterable[CompositionClause] ``` Return an iterator over the possible outputs of the wire output. --- ## class `AllOutputs` All the outputs of a given function of a module. --- ### method `get_outputs_iter` ```python get_outputs_iter() → Iterable[CompositionClause] ``` Return an iterator over the possible outputs of the wire output. --- ## class `Input` The input of a given function of a module. --- ### method `get_inputs_iter` ```python get_inputs_iter() → Iterable[CompositionClause] ``` Return an iterator over the possible inputs of the wire input. --- ## class `AllInputs` All the inputs of a given function of a module. --- ### method `get_inputs_iter` ```python get_inputs_iter() → Iterable[CompositionClause] ``` Return an iterator over the possible inputs of the wire input. --- ## class `Wire` A forwarding rule between an output and an input. --- ### method `get_rules_iter` ```python get_rules_iter(_) → Iterable[CompositionRule] ``` Return an iterator over composition rules. --- ## class `Wired` Composition policy which allows the forwarding of certain outputs to certain inputs. --- ### method `get_rules_iter` ```python get_rules_iter(_) → Iterable[CompositionRule] ``` Return an iterator over composition rules. --- ## class `DebugManager` A debug manager, allowing streamlined debugging. ### method `__init__` ```python __init__(config: Configuration) ``` --- ### method `debug_assigned_graph` ```python debug_assigned_graph(name, function_graph) ``` Print assigned graphs if configuration tells so. --- ### method `debug_bit_width_assignments` ```python debug_bit_width_assignments(name, function_graph) ``` Print bitwidth assignments if configuration tells so. --- ### method `debug_bit_width_constaints` ```python debug_bit_width_constaints(name, function_graph) ``` Print bitwidth constraints if configuration tells so. --- ### method `debug_computation_graph` ```python debug_computation_graph(name, function_graph) ``` Print computation graph if configuration tells so. --- ### method `debug_mlir` ```python debug_mlir(mlir_str) ``` Print mlir if configuration tells so. --- ### method `debug_statistics` ```python debug_statistics(module) ``` Print statistics if configuration tells so. --- ### method `debug_table` ```python 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` ```python show_assigned_graph() → bool ``` Tell if the configuration involves showing assigned graph. --- ### method `show_bit_width_assignments` ```python show_bit_width_assignments() → bool ``` Tell if the configuration involves showing bitwidth assignments. --- ### method `show_bit_width_constraints` ```python show_bit_width_constraints() → bool ``` Tell if the configuration involves showing bitwidth constraints. --- ### method `show_graph` ```python show_graph() → bool ``` Tell if the configuration involves showing graph. --- ### method `show_mlir` ```python show_mlir() → bool ``` Tell if the configuration involves showing mlir. --- ### method `show_optimizer` ```python show_optimizer() → bool ``` Tell if the configuration involves showing optimizer. --- ### method `show_statistics` ```python show_statistics() → bool ``` Tell if the configuration involves showing statistics. --- ## class `ModuleCompiler` Compiler class for multiple functions, to glue the compilation pipeline. ### method `__init__` ```python __init__(functions: List[FunctionDef], composition: CompositionPolicy) ``` --- ### method `compile` ```python 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