mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
refactor: rename compilation artifacts to debug artifacts
This commit is contained in:
@@ -4,7 +4,7 @@ Export everything that users might need.
|
||||
|
||||
from .compilation import (
|
||||
Circuit,
|
||||
CompilationArtifacts,
|
||||
DebugArtifacts,
|
||||
Configuration,
|
||||
Compiler,
|
||||
EncryptionStatus,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Glue the compilation process together.
|
||||
"""
|
||||
|
||||
from .artifacts import CompilationArtifacts
|
||||
from .artifacts import DebugArtifacts
|
||||
from .circuit import Circuit
|
||||
from .compiler import Compiler, EncryptionStatus
|
||||
from .configuration import Configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""
|
||||
Declaration of `CompilationArtifacts` class.
|
||||
Declaration of `DebugArtifacts` class.
|
||||
"""
|
||||
|
||||
import inspect
|
||||
@@ -16,9 +16,9 @@ from ..representation import Graph, Node
|
||||
DEFAULT_OUTPUT_DIRECTORY: Path = Path(".artifacts")
|
||||
|
||||
|
||||
class CompilationArtifacts:
|
||||
class DebugArtifacts:
|
||||
"""
|
||||
CompilationArtifacts class, to export information about the compilation process.
|
||||
DebugArtifacts class, to export information about the compilation process.
|
||||
"""
|
||||
|
||||
output_directory: Path
|
||||
|
||||
@@ -14,7 +14,7 @@ from ..mlir import GraphConverter
|
||||
from ..representation import Graph
|
||||
from ..tracing import Tracer
|
||||
from ..values import Value
|
||||
from .artifacts import CompilationArtifacts
|
||||
from .artifacts import DebugArtifacts
|
||||
from .circuit import Circuit
|
||||
from .configuration import Configuration
|
||||
from .utils import fuse
|
||||
@@ -39,7 +39,7 @@ class Compiler:
|
||||
parameter_encryption_statuses: Dict[str, EncryptionStatus]
|
||||
|
||||
configuration: Configuration
|
||||
artifacts: CompilationArtifacts
|
||||
artifacts: DebugArtifacts
|
||||
|
||||
inputset: List[Any]
|
||||
graph: Optional[Graph]
|
||||
@@ -49,7 +49,7 @@ class Compiler:
|
||||
function: Callable,
|
||||
parameter_encryption_statuses: Dict[str, Union[str, EncryptionStatus]],
|
||||
configuration: Optional[Configuration] = None,
|
||||
artifacts: Optional[CompilationArtifacts] = None,
|
||||
artifacts: Optional[DebugArtifacts] = None,
|
||||
):
|
||||
signature = inspect.signature(function)
|
||||
|
||||
@@ -85,7 +85,7 @@ class Compiler:
|
||||
self.configuration = (
|
||||
configuration if configuration is not None else Configuration()
|
||||
)
|
||||
self.artifacts = artifacts if artifacts is not None else CompilationArtifacts()
|
||||
self.artifacts = artifacts if artifacts is not None else DebugArtifacts()
|
||||
|
||||
self.inputset = []
|
||||
self.graph = None
|
||||
|
||||
@@ -5,7 +5,7 @@ Declaration of `compiler` decorator.
|
||||
from typing import Any, Callable, Iterable, Mapping, Optional, Tuple, Union
|
||||
|
||||
from ..representation import Graph
|
||||
from .artifacts import CompilationArtifacts
|
||||
from .artifacts import DebugArtifacts
|
||||
from .circuit import Circuit
|
||||
from .compiler import Compiler, EncryptionStatus
|
||||
from .configuration import Configuration
|
||||
@@ -14,7 +14,7 @@ from .configuration import Configuration
|
||||
def compiler(
|
||||
parameters: Mapping[str, EncryptionStatus],
|
||||
configuration: Optional[Configuration] = None,
|
||||
artifacts: Optional[CompilationArtifacts] = None,
|
||||
artifacts: Optional[DebugArtifacts] = None,
|
||||
):
|
||||
"""
|
||||
Provide an easy interface for compilation.
|
||||
@@ -26,7 +26,7 @@ def compiler(
|
||||
configuration(Optional[Configuration], default = None):
|
||||
configuration to use for compilation
|
||||
|
||||
artifacts (Optional[CompilationArtifacts], default = None):
|
||||
artifacts (Optional[DebugArtifacts], default = None):
|
||||
artifacts to store information about compilation
|
||||
"""
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ import networkx as nx
|
||||
|
||||
from ..dtypes import Float, Integer
|
||||
from ..representation import Graph, Node, Operation
|
||||
from .artifacts import CompilationArtifacts
|
||||
from .artifacts import DebugArtifacts
|
||||
|
||||
|
||||
def fuse(graph: Graph, artifacts: Optional[CompilationArtifacts] = None):
|
||||
def fuse(graph: Graph, artifacts: Optional[DebugArtifacts] = None):
|
||||
"""
|
||||
Fuse appropriate subgraphs in a graph to a single Operation.Generic node.
|
||||
|
||||
@@ -20,7 +20,7 @@ def fuse(graph: Graph, artifacts: Optional[CompilationArtifacts] = None):
|
||||
graph (Graph):
|
||||
graph to search and update
|
||||
|
||||
artifacts (Optional[CompilationArtifacts], default = None):
|
||||
artifacts (Optional[DebugArtifacts], default = None):
|
||||
compilation artifacts to store information about the fusing process
|
||||
"""
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ import concrete.numpy as cnp
|
||||
import numpy as np
|
||||
import pathlib
|
||||
|
||||
artifacts = cnp.CompilationArtifacts("/tmp/custom/export/path")
|
||||
artifacts = cnp.DebugArtifacts("/tmp/custom/export/path")
|
||||
|
||||
@cnp.compiler({"x": "encrypted"}, artifacts=artifacts)
|
||||
def f(x):
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
"""
|
||||
Tests of `CompilationArtifacts` class.
|
||||
Tests of `DebugArtifacts` class.
|
||||
"""
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from concrete.numpy.compilation import CompilationArtifacts, compiler
|
||||
from concrete.numpy.compilation import DebugArtifacts, compiler
|
||||
|
||||
|
||||
def test_artifacts_export(helpers):
|
||||
"""
|
||||
Test `export` method of `Compilation` class.
|
||||
Test `export` method of `DebugArtifacts` class.
|
||||
"""
|
||||
|
||||
with tempfile.TemporaryDirectory() as path:
|
||||
tmpdir = Path(path)
|
||||
|
||||
configuration = helpers.configuration()
|
||||
artifacts = CompilationArtifacts(tmpdir)
|
||||
artifacts = DebugArtifacts(tmpdir)
|
||||
|
||||
@compiler({"x": "encrypted"}, configuration=configuration, artifacts=artifacts)
|
||||
def f(x):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Tests of `compiler` decorator.
|
||||
"""
|
||||
|
||||
from concrete.numpy.compilation import CompilationArtifacts, compiler
|
||||
from concrete.numpy.compilation import DebugArtifacts, compiler
|
||||
|
||||
|
||||
def test_call_compile(helpers):
|
||||
@@ -31,7 +31,7 @@ def test_compiler_verbose_trace(helpers, capsys):
|
||||
"""
|
||||
|
||||
configuration = helpers.configuration()
|
||||
artifacts = CompilationArtifacts()
|
||||
artifacts = DebugArtifacts()
|
||||
|
||||
@compiler({"x": "encrypted"}, configuration=configuration, artifacts=artifacts)
|
||||
def function(x):
|
||||
@@ -59,7 +59,7 @@ def test_compiler_verbose_compile(helpers, capsys):
|
||||
"""
|
||||
|
||||
configuration = helpers.configuration()
|
||||
artifacts = CompilationArtifacts()
|
||||
artifacts = DebugArtifacts()
|
||||
|
||||
@compiler({"x": "encrypted"}, configuration=configuration, artifacts=artifacts)
|
||||
def function(x):
|
||||
|
||||
Reference in New Issue
Block a user