This project is currently in its infant stages, so we are keeping things "in-house" for now while we find our footing.
- No External PRs: We aren't accepting outside contributions just yet.
- Coming Soon: We plan to open the gates to the community once the foundation is solid.
Stay tuned—we'd love your help later!
The structure of the project follows that of standard MLIR compilers.
The root directory is mlir, which contains all the source code.
The tool that is generated is called qcc-opt.
The easiest way to get started is via the provided devcontainer, which automatically installs all dependencies including LLVM/MLIR. This requires docker to be installed on the host. Various IDEs support support the standard, e.g.:
- vscode: via Dev Containers extension.
- jetbrains IDEs: See e.g. here.
There is also a dev container cli which can be used alongside IDE integrations.
For advanced users: put your own local devcontainer.json under .devcontainer/local/ (gitignored).
IDEs and the cli should provide you with a way to choose which config you want to use.
If you prefer to build outside the container, you need LLVM/MLIR version >= VERSION_USED_BY_DEVCONTAINER_IMAGE installed. If you have no previous installation, check the guide here.
If you are using a devcontainer, configure the project like so:
cmake --preset dev
# You can also override variables, here an example for the case if the lit tool (testing) is not found:
cmake --preset dev -DLLVM_EXTERNAL_LIT=$(which lit)This uses cmake presets.
You might want to create your own CMakeUserPresets.json (it is under gitignore).
On the other hand, if you manually installed LLVM and MLIR, run:
cmake -S . -B build/dev -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DMLIR_DIR=path/to/mlir/installation/dir \
-DLLVM_DIR=/path/to/llvm/installation/dir \
-DLLVM_EXTERNAL_LIT=$(which lit)Then build the project like so:
# With presets:
cmake --build --preset dev
# Or if you do not like presets:
cmake --build build/devNote
If you are not using a single-config generator (such as when using MSVC on Windows), you need to specify the build configuration explicitly for the build command:
To make sure that the build procedure worked correctly, run the following:
./build/dev/bin/qcc-opt mlir/test/tools/qcc-opt/mqt-core-integration-test.mlirand it should output some plain MLIR source.
Run the tests like so:
# Rebuilds and runs all tests:
cmake --build build/dev --target test-qcc-project
# Run specific tests (filters by filename):
lit build/dev/mlir/test/ -v --filter "convert"If you use VSCode and would like to enable the custom MLIR LSP server including quantum dialects, add this line to your settings:
"mlir.server_path": "build/dev/bin/qcc-lsp-server"
The license headers in this repository are managed using the license-eye tool.
After installation, the tool can be invoked using the following command:
license-eye header fixThe license headers are checked by a GitHub Actions workflow. If the workflow fails in a PR, run the command above. Alternatively, it is of course possible to copy the license header from another file.