https://github.com/cqcl/hugr-mlir
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.6%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: CQCL
- License: apache-2.0
- Language: CMake
- Default Branch: main
- Size: 827 KB
Statistics
- Stars: 2
- Watchers: 7
- Forks: 2
- Open Issues: 7
- Releases: 0
Metadata Files
README.md
hugr-mlir
A prototype for integrating (hugr)[https://github.com/CQCL/hugr] and (mlir)[https://mlir.llvm.org].
Building and Dependencies
- C++17 compiler and toolchain
- A recent build of LLVM including MLIR
- A python installation including libraries: TODO
All dependencies are available through nix, to enter a shell with all dependencies available:
sh
$ nix develop --impure
$ llvm-config --version
$ mlir-opt --version
This shell includes a customised LLVM install (see nix/mlir) with MLIR, assertions enabled, and static libraries. CI runs against this install.
Alternatively, you may wish to bring your own LLVM build or install tree(say, $prefix), in
which case you can use nix develop .#no-mlir. This shell does include all LLVM
dependencies. To point cmake at your LLVM tree, pass
-DMLIR_DIR=$prefix/lib/cmake/mlir to cmake.
The .#debug-mlir shell includes a debug build of our LLVM.
Note that shells that include LLVM will take a considerable time to build (30-60
minutes, depending on your machine) the first time they are used. These builds
will be cached while llvm-src in flake.lock and the mlir derivation in
flake.nix are unchanged.
It is not required to use a nix shell to build, cmake will pick up all dependencies from it's environment.
Configure
From root of repo:
sh
$ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install
Build
``` $ ninja -C build
```
Components
mlir
An mlir extension. Includes a dialect hugr and associated tooling.
Python bindings to hugr.
mlir <--> hugr mapping
Our goal is to create a bidirectional mapping between mlir and hugr. We will likely not be able to exactly round trip everything, but it would be good to get close.
We begin by defining a subset of mlir as a domain for this mapping.
We can map an arbitrary no-successor, no-region, mlir op into hugr by creating an mlir hugr extension with an op "mlirop" and a type "mlirtype".
We map types in mlir into hugr by special casing a whitelist of types(which include all types in the hugr dialect), and mapping the remainder to mlir.mlir_type<{dialect}.{name}.{str}> where str is the string serialisation fo the mlir type.
We map ops similarly, special casing a whitelist of ops(which include all ops in the hugr dialect) and mapping the remainder to mlir.mlir_op with a signature is defined by applying the type mapping to each of it's arguments and results. Attributes on the op are mapped to node weights on mlir_op. Attributes can be mapped to strings in the same way as types.
mlir locations will be mapped into metadata on the hugr ops.
We will define a dialect Attribute "HugrMetadata" that can be applied to any mlir op and will map to metadata in hugr. We will reserve at least one key in the metadata dictionary, i.e. location, so that a "HugrMetadata" attribute may not contain a key e.g. "org.quantinuum.hugr.mlir.location". Note that dialect Attributes may be discarded by passes (much the same as metadata in hugr).
Note that any mlir region ops, or successor ops, must be whitelisted and special cased. We expect to do this initially for the ControlFlow, Func, arith, index, llvm dialects. We may extend in the future to StructuredControlFlow, Affine, Tensor, LinearAlgebra.
Owner
- Name: Cambridge Quantum
- Login: CQCL
- Kind: organization
- Location: Cambridge, UK
- Website: http://www.cambridgequantum.com
- Repositories: 48
- Profile: https://github.com/CQCL
Quantum Software and Technologies
GitHub Events
Total
- Watch event: 1
- Issue comment event: 3
- Pull request review event: 1
- Pull request event: 2
- Fork event: 2
Last Year
- Watch event: 1
- Issue comment event: 3
- Pull request review event: 1
- Pull request event: 2
- Fork event: 2
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 6
- Total pull requests: 9
- Average time to close issues: about 2 months
- Average time to close pull requests: 15 days
- Total issue authors: 2
- Total pull request authors: 3
- Average comments per issue: 0.17
- Average comments per pull request: 1.33
- Merged pull requests: 4
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: 25 days
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 3.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- doug-q (4)
- aborgna-q (1)
Pull Request Authors
- doug-q (5)
- qartik (2)
- ss2165 (1)