mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-08 19:44:57 -05:00
feat: create auto adjust rounders configuration option
This commit is contained in:
@@ -11,6 +11,7 @@ from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
|
||||
|
||||
import numpy as np
|
||||
|
||||
from ..extensions import AutoRounder
|
||||
from ..mlir import GraphConverter
|
||||
from ..representation import Graph
|
||||
from ..tracing import Tracer
|
||||
@@ -261,6 +262,9 @@ class Compiler:
|
||||
f"(expected {expected} got {actual})"
|
||||
)
|
||||
|
||||
if self.configuration.auto_adjust_rounders:
|
||||
AutoRounder.adjust(self.function, self.inputset)
|
||||
|
||||
if self.graph is None:
|
||||
try:
|
||||
first_sample = next(iter(self.inputset))
|
||||
@@ -431,7 +435,6 @@ class Compiler:
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
self._evaluate("Compiling", inputset)
|
||||
assert self.graph is not None
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ class Configuration:
|
||||
p_error: Optional[float]
|
||||
global_p_error: float
|
||||
insecure_key_cache_location: Optional[str]
|
||||
auto_adjust_rounders: bool
|
||||
|
||||
# pylint: enable=too-many-instance-attributes
|
||||
|
||||
@@ -73,6 +74,7 @@ class Configuration:
|
||||
jit: bool = False,
|
||||
p_error: Optional[float] = None,
|
||||
global_p_error: float = (1 / 100_000),
|
||||
auto_adjust_rounders: bool = False,
|
||||
):
|
||||
self.verbose = verbose
|
||||
self.show_graph = show_graph
|
||||
@@ -91,6 +93,7 @@ class Configuration:
|
||||
self.jit = jit
|
||||
self.p_error = p_error
|
||||
self.global_p_error = global_p_error
|
||||
self.auto_adjust_rounders = auto_adjust_rounders
|
||||
|
||||
self._validate()
|
||||
|
||||
|
||||
@@ -60,9 +60,13 @@ Additional kwarg to `compile` function have higher precedence. So if you set an
|
||||
|
||||
* **verbose**: bool = False
|
||||
* Whether to print computation graph and MLIR during compilation.
|
||||
|
||||
* **dump\_artifacts\_on\_unexpected\_failures**: bool = True
|
||||
* Whether to export debugging artifacts automatically on compilation failures.
|
||||
|
||||
* **auto_adjust_rounders**: bool = False
|
||||
* Whether to adjust rounders automatically.
|
||||
|
||||
* **p_error**: Optional[float] = None
|
||||
* Error probability for individual table lookups. Overwrites **global_p_error** if set.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user