Skip to content

Latest commit

 

History

History
672 lines (332 loc) · 15.9 KB

concrete.compiler.compilation_options.md

File metadata and controls

672 lines (332 loc) · 15.9 KB

module concrete.compiler.compilation_options

CompilationOptions.


class CompilationOptions

CompilationOptions holds different flags and options of the compilation process.

It controls different parallelization flags, diagnostic verification, and also the name of entrypoint function.

method __init__

__init__(compilation_options: CompilationOptions)

Wrap the native Cpp object.

Args:

  • compilation_options (_CompilationOptions): object to wrap

Raises:

  • TypeError: if compilation_options is not of type _CompilationOptions

method force_encoding

force_encoding(encoding: Encoding)

Force the compiler to use a specific encoding.

Args:

  • encoding (Encoding): the encoding to force the compiler to use

Raises:

  • TypeError: if encoding is not of type Encoding

method new

new(backend=<Backend.CPU: 0>) → CompilationOptions

Build a CompilationOptions.

Args:

  • backend (_Backend): backend to use.

Raises:

  • TypeError: if function_name is not an str

Returns: CompilationOptions


method set_all_v0_parameter

set_all_v0_parameter(
    glwe_dim: int,
    log_poly_size: int,
    n_small: int,
    br_level: int,
    br_log_base: int,
    ks_level: int,
    ks_log_base: int,
    crt_decomp: List[int],
    cbs_level: int,
    cbs_log_base: int,
    pks_level: int,
    pks_log_base: int,
    pks_input_lwe_dim: int,
    pks_output_poly_size: int
)

Set all the V0 parameters.

Args:

  • glwe_dim (int): GLWE dimension
  • log_poly_size (int): log of polynomial size
  • n_small (int): n
  • br_level (int): bootstrap level
  • br_log_base (int): bootstrap base log
  • ks_level (int): keyswitch level
  • ks_log_base (int): keyswitch base log
  • crt_decomp (List[int]): CRT decomposition vector
  • cbs_level (int): circuit bootstrap level
  • cbs_log_base (int): circuit bootstrap base log
  • pks_level (int): packing keyswitch level
  • pks_log_base (int): packing keyswitch base log
  • pks_input_lwe_dim (int): packing keyswitch input LWE dimension
  • pks_output_poly_size (int): packing keyswitch output polynomial size

Raises:

  • TypeError: if parameters are not of type int

method set_auto_parallelize

set_auto_parallelize(auto_parallelize: bool)

Set option for auto parallelization.

Args:

  • auto_parallelize (bool): whether to turn it on or off

Raises:

  • TypeError: if the value to set is not boolean

method set_batch_tfhe_ops

set_batch_tfhe_ops(batch_tfhe_ops: bool)

Set flag that triggers the batching of scalar TFHE operations.

Args:

  • batch_tfhe_ops (bool): whether to batch tfhe ops.

Raises:

  • TypeError: if the value to set is not bool

method set_composable

set_composable(composable: bool)

Set option for composition.

Args:

  • composable (bool): whether to turn it on or off

Raises:

  • TypeError: if the value to set is not boolean

method set_compress_evaluation_keys

set_compress_evaluation_keys(compress_evaluation_keys: bool)

Set option for compression of evaluation keys.

Args:

  • compress_evaluation_keys (bool): whether to turn it on or off

Raises:

  • TypeError: if the value to set is not boolean

method set_compress_input_ciphertexts

set_compress_input_ciphertexts(compress_input_ciphertexts: bool)

Set option for compression of input ciphertexts.

Args:

  • compress_input_ciphertexts (bool): whether to turn it on or off

Raises:

  • TypeError: if the value to set is not boolean

method set_dataflow_parallelize

set_dataflow_parallelize(dataflow_parallelize: bool)

Set option for dataflow parallelization.

Args:

  • dataflow_parallelize (bool): whether to turn it on or off

Raises:

  • TypeError: if the value to set is not boolean

method set_display_optimizer_choice

set_display_optimizer_choice(display: bool)

Set display flag of optimizer choices.

Args:

  • display (bool): if true the compiler display optimizer choices

Raises:

  • TypeError: if the value is not a bool

method set_emit_gpu_ops

set_emit_gpu_ops(emit_gpu_ops: bool)

Set flag that allows gpu ops to be emitted.

Args:

  • emit_gpu_ops (bool): whether to emit gpu ops.

Raises:

  • TypeError: if the value to set is not bool

method set_enable_tlu_fusing

set_enable_tlu_fusing(enable_tlu_fusing: bool)

Enable or disable tlu fusing.

Args:

  • enable_tlu_fusing (bool): flag to enable or disable tlu fusing

Raises:

  • TypeError: if the value to set is not bool

method set_funcname

set_funcname(funcname: str)

Set entrypoint function name.

Args:

  • funcname (str): name of the entrypoint function

Raises:

  • TypeError: if the value to set is not str

method set_global_p_error

set_global_p_error(global_p_error: float)

Set global error probability for the full circuit.

Args:

  • global_p_error (float): probability of error for the full circuit

Raises:

  • TypeError: if the value to set is not float
  • ValueError: if the value to set is not in interval ]0; 1]

method set_loop_parallelize

set_loop_parallelize(loop_parallelize: bool)

Set option for loop parallelization.

Args:

  • loop_parallelize (bool): whether to turn it on or off

Raises:

  • TypeError: if the value to set is not boolean

method set_optimize_concrete

set_optimize_concrete(optimize: bool)

Set flag to enable/disable optimization of concrete intermediate representation.

Args:

  • optimize (bool): whether to turn it on or off

Raises:

  • TypeError: if the value to set is not boolean

method set_optimizer_multi_parameter_strategy

set_optimizer_multi_parameter_strategy(
    strategy: OptimizerMultiParameterStrategy
)

Set the strategy of the optimizer for multi-parameter.

Args:

  • strategy (OptimizerMultiParameterStrategy): Use the specified optmizer multi-parameter strategy.

Raises:

  • TypeError: if the value is not a OptimizerMultiParameterStrategy

method set_optimizer_strategy

set_optimizer_strategy(strategy: OptimizerStrategy)

Set the strategy of the optimizer.

Args:

  • strategy (OptimizerStrategy): Use the specified optmizer strategy.

Raises:

  • TypeError: if the value is not an OptimizerStrategy

method set_p_error

set_p_error(p_error: float)

Set error probability for shared by each pbs.

Args:

  • p_error (float): probability of error for each lut

Raises:

  • TypeError: if the value to set is not float
  • ValueError: if the value to set is not in interval ]0; 1]

method set_print_tlu_fusing

set_print_tlu_fusing(print_tlu_fusing: bool)

Enable or disable printing tlu fusing.

Args:

  • print_tlu_fusing (bool): flag to enable or disable printing tlu fusing

Raises:

  • TypeError: if the value to set is not bool

method set_security_level

set_security_level(security_level: int)

Set security level.

Args:

  • security_level (int): the target number of bits of security to compile the circuit

Raises:

  • TypeError: if the value to set is not int
  • ValueError: if the value to set is not in interval ]0; 1]

method set_v0_parameter

set_v0_parameter(
    glwe_dim: int,
    log_poly_size: int,
    n_small: int,
    br_level: int,
    br_log_base: int,
    ks_level: int,
    ks_log_base: int
)

Set the basic V0 parameters.

Args:

  • glwe_dim (int): GLWE dimension
  • log_poly_size (int): log of polynomial size
  • n_small (int): n
  • br_level (int): bootstrap level
  • br_log_base (int): bootstrap base log
  • ks_level (int): keyswitch level
  • ks_log_base (int): keyswitch base log

Raises:

  • TypeError: if parameters are not of type int

method set_verify_diagnostics

set_verify_diagnostics(verify_diagnostics: bool)

Set option for diagnostics verification.

Args:

  • verify_diagnostics (bool): whether to turn it on or off

Raises:

  • TypeError: if the value to set is not boolean

method simulation

simulation(simulate: bool)

Enable or disable simulation.

Args:

  • simulate (bool): flag to enable or disable simulation

Raises:

  • TypeError: if the value to set is not bool