Files
torus/docs/dev/api/torus.fhe.representation.node.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.7 KiB

module torus.fhe.representation.node

Declaration of Node class.

Global Variables

  • KWARGS_IGNORED_IN_FORMATTING
  • NODES_THAT_HAVE_TLU_WHEN_ALL_INPUTS_ARE_ENCRYPTED

class Node

Node class, to represent computation in a computation graph.

method __init__

__init__(
    inputs: list[ValueDescription],
    output: ValueDescription,
    operation: Operation,
    evaluator: Callable,
    properties: Optional[dict[str, Any]] = None
)

property conversion_have_table_lookup

Get whether the node will have table lookups during execution.

Returns: bool: True if the node will have table lookups during execution, False otherwise


property converted_to_table_lookup

Get whether the node is converted to a table lookup during MLIR conversion.

Returns: bool: True if the node is converted to a table lookup, False otherwise


property is_fusable

Get whether the node is can be fused into a table lookup.

Returns: bool: True if the node can be fused into a table lookup, False otherwise


method constant

constant(constant: Any) → Node

Create an Operation.Constant node.

Args: constant (Any): constant to represent

Returns: Node: node representing constant

Raises: ValueError: if the constant is not representable


method format

format(predecessors: list[str], maximum_constant_length: int = 45) → str

Get the textual representation of the Node (dependent to preds).

Args: predecessors (List[str]): predecessor names to this node

maximum_constant_length (int, default = 45): maximum length of formatted constants

Returns: str: textual representation of the Node (dependent to preds)


method generic

generic(
    name: str,
    inputs: list[ValueDescription],
    output: ValueDescription,
    operation: Callable,
    args: Optional[tuple[Any, ]] = None,
    kwargs: Optional[dict[str, Any]] = None,
    attributes: Optional[dict[str, Any]] = None
)

Create an Operation.Generic node.

Args: name (str): name of the operation

inputs (List[ValueDescription]): inputs to the operation

output (ValueDescription): output of the operation

operation (Callable): operation itself

args (Optional[Tuple[Any, ...]]): args to pass to operation during evaluation

kwargs (Optional[Dict[str, Any]]): kwargs to pass to operation during evaluation

attributes (Optional[Dict[str, Any]]): attributes of the operation

Returns: Node: node representing operation


method input

input(name: str, value: ValueDescription) → Node

Create an Operation.Input node.

Args: name (Any): name of the input

value (Any): value of the input

Returns: Node: node representing input


method label

label() → str

Get the textual representation of the Node (independent of preds).

Returns: str: textual representation of the Node (independent of preds).