diff --git a/docs/dev/api/concrete.fhe.compilation.configuration.md b/docs/dev/api/concrete.fhe.compilation.configuration.md new file mode 100644 index 000000000..e94ef0b78 --- /dev/null +++ b/docs/dev/api/concrete.fhe.compilation.configuration.md @@ -0,0 +1,264 @@ + + + + +# module `concrete.fhe.compilation.configuration` +Declaration of `Configuration` class. + +**Global Variables** +--------------- +- **MAXIMUM_TLU_BIT_WIDTH** +- **DEFAULT_P_ERROR** +- **DEFAULT_GLOBAL_P_ERROR** + + +--- + + + +## class `ParameterSelectionStrategy` +ParameterSelectionStrategy, to set optimization strategy. + + + + + +--- + + + +## class `MultiParameterStrategy` +MultiParamStrategy, to set optimization strategy for multi-parameter. + + + + + +--- + + + +## class `Exactness` +Exactness, to specify for specific operator the implementation preference (default and local). + + + + + +--- + + + +## class `ApproximateRoundingConfig` +Controls the behavior of approximate rounding. + +In the following `k` is the ideal rounding output precision. Often the precision used after rounding is `k`+1 to avoid overflow. `logical_clipping`, `approximate_clipping_start_precision` can be used to stay at precision `k`, either logically or physically at the successor TLU. See examples in https://github.com/zama-ai/concrete/blob/main/docs/core-features/rounding.md. + + + +### method `__init__` + +```python +__init__( + logical_clipping: bool = True, + approximate_clipping_start_precision: int = 5, + reduce_precision_after_approximate_clipping: bool = True, + symetrize_deltas: bool = True +) → None +``` + + + + + + + + + +--- + + + +## class `ComparisonStrategy` +ComparisonStrategy, to specify implementation preference for comparisons. + + + + + +--- + + + +## class `BitwiseStrategy` +BitwiseStrategy, to specify implementation preference for bitwise operations. + + + + + +--- + + + +## class `MultivariateStrategy` +MultivariateStrategy, to specify implementation preference for multivariate operations. + + + + + +--- + + + +## class `MinMaxStrategy` +MinMaxStrategy, to specify implementation preference for minimum and maximum operations. + + + + + +--- + + + +## class `Configuration` +Configuration class, to allow the compilation process to be customized. + + + +### method `__init__` + +```python +__init__( + verbose: bool = False, + show_graph: Optional[bool] = None, + show_bit_width_constraints: Optional[bool] = None, + show_bit_width_assignments: Optional[bool] = None, + show_assigned_graph: Optional[bool] = None, + show_mlir: Optional[bool] = None, + show_optimizer: Optional[bool] = None, + show_statistics: Optional[bool] = None, + dump_artifacts_on_unexpected_failures: bool = True, + enable_unsafe_features: bool = False, + use_insecure_key_cache: bool = False, + insecure_key_cache_location: Optional[Path, str] = None, + loop_parallelize: bool = True, + dataflow_parallelize: bool = False, + auto_parallelize: bool = False, + compress_evaluation_keys: bool = False, + compress_input_ciphertexts: bool = False, + p_error: Optional[float] = None, + global_p_error: Optional[float] = None, + auto_adjust_rounders: bool = False, + auto_adjust_truncators: bool = False, + single_precision: bool = False, + parameter_selection_strategy: Union[ParameterSelectionStrategy, str] = , + multi_parameter_strategy: Union[MultiParameterStrategy, str] = , + show_progress: bool = False, + progress_title: str = '', + progress_tag: Union[bool, int] = False, + fhe_simulation: bool = False, + fhe_execution: bool = True, + compiler_debug_mode: bool = False, + compiler_verbose_mode: bool = False, + comparison_strategy_preference: Optional[ComparisonStrategy, str, List[Union[ComparisonStrategy, str]]] = None, + bitwise_strategy_preference: Optional[BitwiseStrategy, str, List[Union[BitwiseStrategy, str]]] = None, + shifts_with_promotion: bool = True, + multivariate_strategy_preference: Optional[MultivariateStrategy, str, List[Union[MultivariateStrategy, str]]] = None, + min_max_strategy_preference: Optional[MinMaxStrategy, str, List[Union[MinMaxStrategy, str]]] = None, + composable: bool = False, + use_gpu: bool = False, + relu_on_bits_threshold: int = 7, + relu_on_bits_chunk_size: int = 3, + if_then_else_chunk_size: int = 3, + additional_pre_processors: Optional[List[GraphProcessor]] = None, + additional_post_processors: Optional[List[GraphProcessor]] = None, + rounding_exactness: Exactness = , + approximate_rounding_config: Optional[ApproximateRoundingConfig] = None, + optimize_tlu_based_on_measured_bounds: bool = False, + enable_tlu_fusing: bool = True, + print_tlu_fusing: bool = False, + optimize_tlu_based_on_original_bit_width: Union[bool, int] = 8, + detect_overflow_in_simulation: bool = False, + dynamic_indexing_check_out_of_bounds: bool = True, + dynamic_assignment_check_out_of_bounds: bool = True, + simulate_encrypt_run_decrypt: bool = False +) +``` + + + + + + + + +--- + + + +### method `fork` + +```python +fork( + verbose: Union[Keep, bool] = , + show_graph: Optional[Keep, bool] = , + show_bit_width_constraints: Optional[Keep, bool] = , + show_bit_width_assignments: Optional[Keep, bool] = , + show_assigned_graph: Optional[Keep, bool] = , + show_mlir: Optional[Keep, bool] = , + show_optimizer: Optional[Keep, bool] = , + show_statistics: Optional[Keep, bool] = , + dump_artifacts_on_unexpected_failures: Union[Keep, bool] = , + enable_unsafe_features: Union[Keep, bool] = , + use_insecure_key_cache: Union[Keep, bool] = , + insecure_key_cache_location: Optional[Keep, Path, str] = , + loop_parallelize: Union[Keep, bool] = , + dataflow_parallelize: Union[Keep, bool] = , + auto_parallelize: Union[Keep, bool] = , + compress_evaluation_keys: Union[Keep, bool] = , + compress_input_ciphertexts: Union[Keep, bool] = , + p_error: Optional[Keep, float] = , + global_p_error: Optional[Keep, float] = , + auto_adjust_rounders: Union[Keep, bool] = , + auto_adjust_truncators: Union[Keep, bool] = , + single_precision: Union[Keep, bool] = , + parameter_selection_strategy: Union[Keep, ParameterSelectionStrategy, str] = , + multi_parameter_strategy: Union[Keep, MultiParameterStrategy, str] = , + show_progress: Union[Keep, bool] = , + progress_title: Union[Keep, str] = , + progress_tag: Union[Keep, bool, int] = , + fhe_simulation: Union[Keep, bool] = , + fhe_execution: Union[Keep, bool] = , + compiler_debug_mode: Union[Keep, bool] = , + compiler_verbose_mode: Union[Keep, bool] = , + comparison_strategy_preference: Optional[Keep, ComparisonStrategy, str, List[Union[ComparisonStrategy, str]]] = , + bitwise_strategy_preference: Optional[Keep, BitwiseStrategy, str, List[Union[BitwiseStrategy, str]]] = , + shifts_with_promotion: Union[Keep, bool] = , + multivariate_strategy_preference: Optional[Keep, MultivariateStrategy, str, List[Union[MultivariateStrategy, str]]] = , + min_max_strategy_preference: Optional[Keep, MinMaxStrategy, str, List[Union[MinMaxStrategy, str]]] = , + composable: Union[Keep, bool] = , + use_gpu: Union[Keep, bool] = , + relu_on_bits_threshold: Union[Keep, int] = , + relu_on_bits_chunk_size: Union[Keep, int] = , + if_then_else_chunk_size: Union[Keep, int] = , + additional_pre_processors: Optional[Keep, List[GraphProcessor]] = , + additional_post_processors: Optional[Keep, List[GraphProcessor]] = , + rounding_exactness: Union[Keep, Exactness] = , + approximate_rounding_config: Optional[Keep, ApproximateRoundingConfig] = , + optimize_tlu_based_on_measured_bounds: Union[Keep, bool] = , + enable_tlu_fusing: Union[Keep, bool] = , + print_tlu_fusing: Union[Keep, bool] = , + optimize_tlu_based_on_original_bit_width: Union[Keep, bool, int] = , + detect_overflow_in_simulation: Union[Keep, bool] = , + dynamic_indexing_check_out_of_bounds: Union[Keep, bool] = , + dynamic_assignment_check_out_of_bounds: Union[Keep, bool] = , + simulate_encrypt_run_decrypt: Union[Keep, bool] = +) → Configuration +``` + +Get a new configuration from another one specified changes. + +See Configuration.