Files
torus/docs/dev/api/torus.fhe.compilation.module_compiler.md
zeekay f968edf75a Rename the Concrete dialect and project identifiers to Torus
The MLIR dialect, its conversion passes (TFHEToConcrete, ConcreteToCAPI,
ConcreteToLLVM), the optimizer component, the compiler binary, the Rust
crate and the program_info parameter file all still carried the upstream
project's name. They now carry this one's.

Two things deliberately keep the word, because in them it is not the name.
mlir::OpTrait CRTP parameters mean "the derived type", so they are spelled
Derived and OpTy — LLVM's other conventional spelling for the same idiom.
concreteShape is a capnp field: renaming it would change the serialized
protocol, and the prose describing it is ordinary English.

This also repairs references the earlier partial rename left dangling:
Security.cpp included concrete/curves.gen.h and the directory is torus/,
torus-cpu.h included concrete-num_complex.h, the Torus dialect CMakeLists
named ConcreteOps.td, and compiler/setup.py asked find_namespace_packages
for a "concrete" package that no longer exists — so it built without the
package it ships.
2026-08-27 13:17:38 -07:00

4.5 KiB

module torus.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.