feat: create auto adjust rounders configuration option

This commit is contained in:
Umut
2022-11-08 13:30:32 +01:00
parent ccd3f9af6a
commit 2b84def2c3
3 changed files with 11 additions and 1 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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.