Debugging and artifact

This document provides guidance on debugging the compilation process.

Compiler debug and verbose modes

Two configuration options are available to help you understand the compilation process:

  • compiler_verbose_mode: Prints the compiler passes and shows the transformations applied. It can help identify the crash location if a crash occurs.

  • compiler_debug_mode: A more detailed version of the verbose mode, providing additional information, particularly useful for diagnosing crashes.

circle-exclamation

Debug artifacts

Concrete includes an artifact system that simplifies the debugging process by automatically or manually exporting detailed information during compilation failures.

Automatic export

When a compilation fails, artifacts are automatically exported to the .artifacts directory in the working directory. Here's an example of what gets exported when a function fails to compile:

def f(x):
    return np.sin(x)

This function fails to compile because Concrete does not support floating-point outputs. When you try to compile it, an exception will be raised and the artifacts will be exported automatically. The following files will be generated in the .artifacts directory:

  • environment.txt: Information about your system setup, including the operating system and Python version.

Linux-5.12.13-arch1-2-x86_64-with-glibc2.29 #1 SMP PREEMPT Fri, 25 Jun 2021 22:56:51 +0000
Python 3.8.10
  • requirements.txt: The installed Python packages and their versions.

  • function.txt: The code of the function that failed to compile.

  • parameters.txt: Information about the encryption status function's parameters.

  • 1.initial.graph.txt: The textual representation of the initial computation graph right after tracing.

  • final.graph.txt: The textual representation of the final computation graph right before MLIR conversion.

  • traceback.txt: Details of the error occurred.

Manual exports

Manual exports are mostly used for visualization and demonstrations. Here is how to perform one:

After running the code, you will find the following files under /tmp/custom/export/path directory:

  • 1.initial.graph.txt: The textual representation of the initial computation graph right after tracing.

  • 2.after-fusing.graph.txt: The textual representation of the intermediate computation graph after fusing.

  • 3.final.graph.txt: The textual representation of the final computation graph right before MLIR conversion.

  • mlir.txt: Information about the MLIR of the function which was compiled using the provided input-set.

  • client\_parameters.json: Information about the client parameters chosen by Concrete.

Asking the community

You can seek help with your issue by asking a question directly in the community forumarrow-up-right.

Submitting an issue

If you cannot find a solution in the community forum, or if you have found a bug in the library, you could create an issuearrow-up-right in our GitHub repository.

For bug reportsarrow-up-right, try to:

  • Avoid randomness to ensure reproducibility of the bug

  • Minimize your function while keeping the bug to expedite the fix

  • Include your input-set in the issue

  • Provide clear reproduction steps

  • Include debug artifacts in the issue

For feature requestsarrow-up-right, try to:

  • Give a minimal example of the desired behavior

  • Explain your use case

Last updated

Was this helpful?