Andi Drebes 0cb5007c3c enhance(compiler): Python bindings: Forward llvm::Expected error messages in exceptions
The code in `lib/CAPI/Support/CompilerEngine.cpp` invokes several
functions returning an `llvm::Expected<T>`. When those fail, the error
message retrieved from the error object the `llvm::Expected<T>`
instance is written to the standard error stream via
`mlir::zamalang::log_error()` and an exception with a more generic
error message is thrown.

This causes errors to show up on the standard error stream in tests
generating errors on purpose and checking them, e.g.:

  ```
  tests/python/test_compiler_engine.py::test_compile_invalid[not
  @main] Compilation failed: cannot find the function for generate
  client parameters PASSED
  ```

This patch forwards the error message from an `llvm::Expected<T>`
instance in a runtime exception rather than writing it to the standard
error stream. Since exceptions are properly caught by the tests, no
errors show up during testing.
2021-11-02 16:34:42 +01:00
2021-10-07 14:38:50 +01:00

Homomorphizer

The homomorphizer is a compiler that takes a high level computation model and produces a programs that evaluate the model in an homomorphic way.

Build tarball

The final tarball contains intallation instructions. We only support Linux x86_64 for the moment. You can find the output tarball under /tarballs.

$ cd compiler
$ make release_tarballs

Build the Python Package

Currently supported platforms:

  • Linux x86_64 for python 3.8, 3.9, and 3.10

Linux

We use the manylinux docker images for building python packages for Linux. Those packages should work on distributions that have GLIBC >= 2.24.

You can use Make to build the python wheels using these docker images:

$ cd compiler
$ make package_py38  # package_py39 package_py310

This will build the image for the appropriate python version then copy the wheels out under /wheels

Build wheels in your environment

Temporary MLIR issue

Due to an issue with MLIR, you will need to manually add __init__.py files to the mlir python package after the build.

$ make python-bindings
$ touch build/tools/zamalang/python_packages/zamalang_core/mlir/__init__.py
$ touch build/tools/zamalang/python_packages/zamalang_core/mlir/dialects/__init__.py

Build wheel

Building the wheels is actually simple.

$ pip wheel --no-deps -w ../wheels .

Depending on the platform you are using (specially Linux), you might need to use auditwheel to specify the platform this wheel is targeting. For example, in our build of the package for Linux x86_64 and GLIBC 2.24, we also run:

$ auditwheel repair ../wheels/*.whl --plat manylinux_2_24_x86_64 -w ../wheels
Description
No description provided
Readme 148 MiB
Languages
C++ 34.3%
Python 23.1%
MLIR 22.9%
Rust 14.6%
C 2.2%
Other 2.8%