Skip to content

Commit

Permalink
Merge remote-tracking branch 'taalexander/taa-add-contribution-guidel…
Browse files Browse the repository at this point in the history
…ines' into taa-add-contribution-guidelines
  • Loading branch information
taalexander committed Jan 3, 2024
2 parents b65e329 + d8539bf commit 516fa0c
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/renos_updated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

reno lint

CHANGED_FILES=$(git diff --name-only $BRANCH HEAD)
CHANGED_FILES=$(git diff --name-only origin/main $GITHUB_SHA)
for file in $CHANGED_FILES
do
root=$(echo "./$file" | awk -F/ '{print FS $2}' | cut -c2-)
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ workflow for writing and compiling release notes.

Making a new release note is quite straightforward.

- Ensure that you have renoinstalled with:
- Ensure that you have reno installed with:
```bash
pip install -U reno
```
Expand Down Expand Up @@ -158,7 +158,7 @@ After release notes have been added, you can use reno to see what the full outpu
of the release notes is. In general the output from reno that we'll get is a rst
(ReStructuredText) file that can be compiled by
[sphinx](https://www.sphinx-doc.org/en/master/). To generate the rst file you
use the ``reno report`` command. If you want to generate the full qw-compiler release
use the ``reno report`` command. If you want to generate the full qe-compiler release
notes for all releases (since we started using reno during 0.9) you just run:

reno report
Expand Down Expand Up @@ -225,7 +225,7 @@ Note that `llvm::outs()` is not thread-safe (since it is buffered) and thus cann

### Static Code Checks
The easiest, fastest, and most automated way to integrate the formatting into your workflow
is via [pre-commit](https://pre-commit.com). Note that this tool requires and internet connection
is via [pre-commit](https://pre-commit.com). Note that this tool requires an internet connection
to initially setup because the formatting tools needs to be downloaded.

**In environments without an internet connection, please see one of the other solutions documented
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@

# qe-compiler: An MLIR-based quantum compiler for quantum engines

The qe-compiler is an [MLIR](https://mlir.llvm.org/)-based compiler with support for OpenQASM 3. It is designed to compile quantum programs to quantum hardware and is designed as part of the overall Quantum Engine. This repo contains the compiler front-end to convert OpenQASM 3 source files into a collection of four MLIR dialects called QUIR (QUantum Intermediate Representation), OQ3 (OpenQASM 3), Pulse (OpenPulse), and QCS (Quantum Computing System). This set of dialects allows OpenQASM programs to be converted into a form suitable to manipulate with LLVM. This repo also contains tools and compiler passes that are agnostic of details of any control system vendor. For instance, it contains localization passes to split source programs into the qubit or channel-specific groupings required by a target quantum control system.

This repo does not contain a complete compiler. Rather, it is a framework for building compilers. To produce a complete compiler, one needs to implement a qe-compiler **target**. This repo comes with a ["mock" target](https://github.com/Qiskit/qss-compiler/tree/main/targets/systems/mock) to assist developers in understanding how to develop such targets.

## Contents
- [qe-compiler: An MLIR-based quantum compiler for quantum engines](#qe-compiler-an-mlir-based-quantum-compiler-for-quantum-engines)
- [Contents](#contents)
- [Notice](#notice)
- [Building](#building)
- [Python library](#python-library)
Expand All @@ -13,11 +19,6 @@
- [CI and Release Cycle](#ci-and-release-cycle)
- [License](#license)


The qe-compiler is an [MLIR](https://mlir.llvm.org/)-based compiler with support for OpenQASM 3. It is designed to compile quantum programs to quantum hardware and is designed as part of the overall Quantum Engine. This repo contains the compiler front-end to convert OpenQASM 3 source files into a collection of four MLIR dialects called QUIR (QUantum Intermediate Representation), OQ3 (OpenQASM 3), Pulse (OpenPulse), and QCS (Quantum Computing System). This set of dialects allows OpenQASM programs to be converted into a form suitable to manipulate with LLVM. This repo also contains tools and compiler passes that are agnostic of details of any control system vendor. For instance, it contains localization passes to split source programs into the qubit or channel-specific groupings required by a target quantum control system.

This repo does not contain a complete compiler. Rather, it is a framework for building compilers. To produce a complete compiler, one needs to implement a qe-compiler **target**. This repo comes with a ["mock" target](https://github.com/Qiskit/qss-compiler/tree/main/targets/systems/mock) to assist developers in understanding how to develop such targets.

## Notice

We are in the process of [changing the name of this project](https://github.com/Qiskit/qss-compiler/issues/210) from `qss-compiler` to `qe-compiler`. At present, only the repository name and this README have been updated.
Expand Down Expand Up @@ -52,7 +53,7 @@ Building and running the compiler is supported with [WSL](https://learn.microsof

### Static Code Checks
The easiest, fastest, and most automated way to integrate the formatting into your workflow
is via [pre-commit](https://pre-commit.com). Note that this tool requires and internet connection
is via [pre-commit](https://pre-commit.com). Note that this tool requires an internet connection
to initially setup because the formatting tools needs to be downloaded. These should be installed
and setup prior to any development work so that they are not forgotten
about.
Expand Down
4 changes: 2 additions & 2 deletions conan/clang-tools-extra/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def source(self):
cache_hit = os.path.exists(f"{git_cache}/.git")
cache_arg = f" --reference-if-able '{git_cache}' " if git_cache else ""

if git_cache and cache_hit():
if git_cache and cache_hit:
self.output.info(f"Cache hit! Some Git objects will be loaded from '{git_cache}'.")

self.run(
f"git clone {cache_arg} -b {LLVM_TAG} "
"--single-branch https://github.com/llvm/llvm-project.git"
)

if git_cache and not cache_hit():
if git_cache and not cache_hit:
# Update cache.
self.output.info(f"Updating cache at '{git_cache}'.")
self.run(f"cp -r llvm-project '{git_cache}'")
Expand Down
8 changes: 2 additions & 6 deletions conan/llvm/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
LLVM_TAG = "llvmorg-17.0.5"


def cache_hit(cache) -> bool:
return os.path.exists(f"{cache}/.git")


class LLVMConan(ConanFile):
name = "llvm"
version = "17.0.5-0"
Expand Down Expand Up @@ -93,15 +89,15 @@ def source(self):
cache_hit = os.path.exists(f"{git_cache}/.git")
cache_arg = f" --reference-if-able '{git_cache}' " if git_cache else ""

if git_cache and cache_hit():
if git_cache and cache_hit:
self.output.info(f"Cache hit! Some Git objects will be loaded from '{git_cache}'.")

self.run(
f"git clone {cache_arg} -b {LLVM_TAG} "
"--single-branch https://github.com/llvm/llvm-project.git"
)

if git_cache and not cache_hit():
if git_cache and not cache_hit:
# Update cache.
self.output.info(f"Updating cache at '{git_cache}'.")
self.run(f"cp -r llvm-project '{git_cache}'")
Expand Down
15 changes: 5 additions & 10 deletions conan/qasm/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright IBM 2023.
# (C) Copyright IBM 2023, 2024.
#
# This code is part of Qiskit.
#
Expand All @@ -10,7 +10,6 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
from conans import ConanFile
import os
import platform
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
import subprocess
Expand All @@ -29,17 +28,13 @@ class QasmConan(ConanFile):
"mpc:shared": True,
"mpfr:shared": True,
}
license = "Proprietary"
author = "IBM Quantum development team"
license = "Apache-2.0"
author = "OpenQASM Organization"
topics = ("Compiler", "Parser", "OpenQASM3")
description = "Compiler for OpenQASM3 language."
description = "A flex/bison parser for OpenQASM v3. A part of the Quantum Engine project."

def source(self):
token = os.environ.get("GITHUB_PAT")
if token is not None:
self.run(f"git clone https://{token}@github.com/openqasm/qe-qasm.git .")
else:
self.run("git clone [email protected]:openqasm/qe-qasm.git .")
self.run("git clone https://github.com/openqasm/qe-qasm.git .")

commit_hash = self.conan_data["sources"]["hash"]
self.run(f"git checkout {commit_hash}")
Expand Down
8 changes: 4 additions & 4 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# (C) Copyright IBM 2023.
# (C) Copyright IBM 2023, 2024.
#
# This code is part of Qiskit.
#
Expand Down Expand Up @@ -29,9 +29,9 @@ class QSSCompilerConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "pythonlib": [True, False]}
default_options = {"shared": False, "pythonlib": True}
license = "Proprietary"
author = "IBM Quantum development team"
topics = ("Compiler", "Scheduler", "OpenQASM3")
license = "Apache-2.0 WITH LLVM-exception"
author = "OpenQASM Organization"
topics = ("Compiler", "OpenQASM3", "MLIR", "Quantum", "Computing")
description = "An LLVM- and MLIR-based Quantum compiler that consumes OpenQASM 3.0"
generators = ["CMakeToolchain", "CMakeDeps", "VirtualBuildEnv"]
exports_sources = "*"
Expand Down
1 change: 0 additions & 1 deletion releasenotes/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ default_branch: main
collapse_pre_releases: true
branch_name_prefix: release/
branch_name_re: release/.+
branch_sort_re: release/([0-9].*)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
features:
- |
Contribution guidelines for the project have been added to `CONTRIBUTING.md <https://github.com/openqasm/qe-compiler/blob/main/CONTRIBUTING.md>`_
12 changes: 12 additions & 0 deletions releasenotes/notes/add-pre-commit-d2fca33ddaf13b35.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
features:
- |
Support for `pre-commit <https://pre-commit.com/>`_ has been added to the
project. To install:
pip install pre-commit
pre-commit install
To run on all files:
pre-commit run --all-files
6 changes: 6 additions & 0 deletions releasenotes/notes/add-releasenotes-895d8791ff596b6d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
features:
- |
Support for `reno release notes <https://docs.openstack.org/reno/latest/>`_ has been added to the project.
See the `contribution guidelines <https://github.com/openqasm/qe-compiler/blob/main/CONTRIBUTING.md>`_
for instructions on how to add a release note.
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lit>=12.0.0
markupsafe==2.0.1
myst-parser
ninja>=1.10
pre-commit
pytest
pytest-asyncio
setuptools_scm>=6.0,<8.0
Expand Down

0 comments on commit 516fa0c

Please sign in to comment.