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.
4.3 KiB
module torus.fhe.mlir.utils
Declaration of various functions and constants related to MLIR conversion.
Global Variables
- MAXIMUM_TLU_BIT_WIDTH
function flood_replace_none_values
flood_replace_none_values(table: list)
Use flooding algorithm to replace None values.
Args:
table (list): the list in which there are None values that need to be replaced with copies of the closest non None data from the list
function construct_table_multivariate
construct_table_multivariate(node: Node, preds: list[Node]) → list[Any]
Construct the lookup table for a multivariate node.
Args: node (Node): Multivariate node to construct the table for
preds (List[Node]): ordered predecessors to node
Returns:
List[Any]: lookup table corresponding to node and its input value
function construct_table
construct_table(
node: Node,
preds: list[Node],
configuration: Configuration
) → list[Any]
Construct the lookup table for an Operation.Generic node.
Args: node (Node): Operation.Generic to construct the table
preds (List[Node]): ordered predecessors to node
configuration (Configuration): configuration to use
Returns:
List[Any]: lookup table corresponding to node and its input value
function construct_deduplicated_tables
construct_deduplicated_tables(
node: Node,
preds: list[Node],
configuration: Configuration
) → tuple[tuple[ndarray, Optional[list[tuple[int, ]]]], ]
Construct lookup tables for each cell of the input for an Operation.Generic node.
Args: node (Node): Operation.Generic to construct the table
preds (List[Node]): ordered predecessors to node
configuration (Configuration): configuration to use
Returns: Tuple[Tuple[numpy.ndarray, List[Tuple[int, ...]]], ...]: tuple containing tuples of 2 for - constructed table - list of indices of the input that use the constructed table
e.g.,
.. code-block: : python
( (np.array([3, 1, 2, 4]), [(1, 0), (2, 1)]), (np.array([5, 8, 6, 7]), [(0, 0), (0, 1), (1, 1), (2, 0)]), )
means the lookup on 3x2 input will result in
.. code-block: : python
[ [5, 8, 6, 7][input[0, 0]] , [5, 8, 6, 7][input[0, 1]] ] [ [3, 1, 2, 4][input[1, 0]] , [5, 8, 6, 7][input[1, 1]] ] [ [5, 8, 6, 7][input[2, 0]] , [3, 1, 2, 4][input[2, 1]] ]
class HashableNdarray
HashableNdarray class, to use numpy arrays in dictionaries.
method __init__
__init__(array: ndarray)
class Comparison
Comparison enum, to store the result comparison in 2-bits as there are three possible outcomes.