Files
torus/docs/dev/api/torus.fhe.compilation.artifacts.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

11 KiB

module torus.fhe.compilation.artifacts

Declaration of DebugArtifacts class.

Global Variables

  • TYPE_CHECKING

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 FunctionDebugArtifacts

An object containing debug artifacts for a certain function in an fhe module.

method __init__

__init__()

method add_graph

add_graph(name: str, graph: Graph)

Add a representation of the function being compiled.

Args: name (str): name of the graph (e.g., initial, optimized, final)

graph (Graph): a representation of the function being compiled


method add_parameter_encryption_status

add_parameter_encryption_status(name: str, encryption_status: str)

Add parameter encryption status of a parameter of the function being compiled.

Args: name (str): name of the parameter

encryption_status (str): encryption status of the parameter


method add_source_code

add_source_code(function: Union[str, Callable])

Add source code of the function being compiled.

Args: function (Union[str, Callable]): either the source code of the function or the function itself


class ModuleDebugArtifacts

An object containing debug artifacts for an fhe module.

method __init__

__init__(
    function_names: Optional[list[str]] = None,
    output_directory: Union[str, Path] = PosixPath('.artifacts')
)

property client_parameters

The client parameters associated with the execution runtime.


method add_execution_runtime

add_execution_runtime(execution_runtime: 'Lazy[ExecutionRt]')

Add the (lazy) execution runtime to get the client parameters if needed.

Args: execution_runtime (Lazy[ExecutionRt]): The lazily initialized execution runtime.


method add_mlir_to_compile

add_mlir_to_compile(mlir: str)

Add textual representation of the resulting MLIR.

Args: mlir (str): textual representation of the resulting MLIR


method export

export()

Export the collected information to self.output_directory.


class DebugArtifacts

DebugArtifacts class, to export information about the compilation process for single function.

method __init__

__init__(output_directory: Union[str, Path] = PosixPath('.artifacts'))

property mlir_to_compile

Return the mlir string.


property output_directory

Return the directory to export artifacts to.


method export

export()

Export the collected information to self.output_directory.