diff --git a/.github/renos_updated.sh b/.github/renos_updated.sh index 6b959044f..b98bde50f 100755 --- a/.github/renos_updated.sh +++ b/.github/renos_updated.sh @@ -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-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 226fa3fdd..1672f345c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 ``` @@ -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 @@ -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 diff --git a/README.md b/README.md index cd0076ac8..40fcaaa08 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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. @@ -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. diff --git a/conan/clang-tools-extra/conanfile.py b/conan/clang-tools-extra/conanfile.py index 09e1dd7cd..852240794 100644 --- a/conan/clang-tools-extra/conanfile.py +++ b/conan/clang-tools-extra/conanfile.py @@ -46,7 +46,7 @@ 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( @@ -54,7 +54,7 @@ def source(self): "--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}'") diff --git a/conan/llvm/conanfile.py b/conan/llvm/conanfile.py index ccbfd3ae8..8b0c14ff7 100644 --- a/conan/llvm/conanfile.py +++ b/conan/llvm/conanfile.py @@ -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" @@ -93,7 +89,7 @@ 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( @@ -101,7 +97,7 @@ def source(self): "--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}'") diff --git a/conan/qasm/conanfile.py b/conan/qasm/conanfile.py index 7a4b89a5d..fa6731c35 100644 --- a/conan/qasm/conanfile.py +++ b/conan/qasm/conanfile.py @@ -1,4 +1,4 @@ -# (C) Copyright IBM 2023. +# (C) Copyright IBM 2023, 2024. # # This code is part of Qiskit. # @@ -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 @@ -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 git@github.com: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}") diff --git a/conanfile.py b/conanfile.py index 9b751be3b..6b7121c19 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,4 +1,4 @@ -# (C) Copyright IBM 2023. +# (C) Copyright IBM 2023, 2024. # # This code is part of Qiskit. # @@ -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 = "*" diff --git a/releasenotes/config.yaml b/releasenotes/config.yaml index 215436144..aa9c5feb9 100644 --- a/releasenotes/config.yaml +++ b/releasenotes/config.yaml @@ -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].*) diff --git a/releasenotes/notes/add-contribution-guidelines-76301ef50bcf53ae.yaml b/releasenotes/notes/add-contribution-guidelines-76301ef50bcf53ae.yaml new file mode 100644 index 000000000..84686fae7 --- /dev/null +++ b/releasenotes/notes/add-contribution-guidelines-76301ef50bcf53ae.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + Contribution guidelines for the project have been added to `CONTRIBUTING.md `_ diff --git a/releasenotes/notes/add-pre-commit-d2fca33ddaf13b35.yaml b/releasenotes/notes/add-pre-commit-d2fca33ddaf13b35.yaml new file mode 100644 index 000000000..d7a444f1b --- /dev/null +++ b/releasenotes/notes/add-pre-commit-d2fca33ddaf13b35.yaml @@ -0,0 +1,12 @@ +--- +features: + - | + Support for `pre-commit `_ 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 diff --git a/releasenotes/notes/add-releasenotes-895d8791ff596b6d.yaml b/releasenotes/notes/add-releasenotes-895d8791ff596b6d.yaml new file mode 100644 index 000000000..1411fd160 --- /dev/null +++ b/releasenotes/notes/add-releasenotes-895d8791ff596b6d.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Support for `reno release notes `_ has been added to the project. + See the `contribution guidelines `_ + for instructions on how to add a release note. diff --git a/requirements-dev.txt b/requirements-dev.txt index acc416076..d01ea1940 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -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