Getting started with Python bindings

Hi,

I’m getting started using the MLIR Python bindings but I’m a little lost and could use some help. I’ve downloaded the llvm-project, and used the following CMake setup:

cmake -G Ninja …/llvm
-DLLVM_BUILD_EXAMPLES=OFF
-DLLVM_TARGETS_TO_BUILD=“host”
-DCMAKE_INSTALL_PREFIX=…/$INSTALL_DIR
-DLLVM_ENABLE_PROJECTS=‘mlir’
-DLLVM_OPTIMIZED_TABLEGEN=ON
-DLLVM_ENABLE_OCAMLDOC=OFF
-DLLVM_ENABLE_BINDINGS=OFF
-DLLVM_INSTALL_UTILS=ON
-DCMAKE_C_COMPILER=clang
-DCMAKE_CXX_COMPILER=clang++
-DLLVM_ENABLE_LLD=ON
-DCMAKE_BUILD_TYPE=Debug
-DLLVM_ENABLE_ASSERTIONS=ON
-DLLVM_MLIR_BINDINGS_PYTHON_ENABLED=ON

ninja install

From here I’m unsure of how to begin using the bindings.

In /home//llvm-project/mlir/python/mlir/dialects I’ve tried making a python file and importing and of the bindings but get an import error

ValueError: Attempted relative import in non-package

Any help would be greatly appreciated, thank you!

Seems this is a general python error, an good explanation for that can be found here -
https://www.quora.com/What-is-the-core-reason-for-this-error-Attempted-relative-import-in-non-package-in-Python/answer/Buck-Evan-1