Skip to content

Commit

Permalink
initial public commit of quilc
Browse files Browse the repository at this point in the history
This work represents years of effort at Rigetti Computing. See the
ACKNOWLEDGEMENTS.md file for a full discussion of the history of the
quilc and its contributors.

Hacks and glory await!
  • Loading branch information
Robert Smith committed Jan 30, 2019
0 parents commit 7ca9950
Show file tree
Hide file tree
Showing 221 changed files with 216,662 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
quilc
.idea/
system-index.txt
73 changes: 73 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
stages:
- test
- package

test-cl-quil:
stage: test
tags:
- github
only:
- branches
image: rigetti/quicklisp
script:
- make dump-version-info
- make install-test-deps
- make test-cl-quil

test-quilc:
stage: test
tags:
- github
only:
- branches
image: rigetti/quicklisp
script:
- make dump-version-info
- make install-test-deps
# clone rpcq to work around QuickLisp
- pushd /builds/rigetti && rm -rf rpcq && git clone https://github.com/rigetti/rpcq.git && popd
- make test-quilc

docker-master:
stage: package
tags:
- dockerd
- github
only:
- master
image: docker:stable
script:
- docker build --tag rigetti/quilc:${CI_COMMIT_SHORT_SHA} --tag rigetti/quilc:latest .
- echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USERNAME} --password-stdin
- docker push rigetti/quilc && docker rmi -f rigetti/quilc:latest

docker-branch:
stage: package
tags:
- dockerd
- github
only:
- branches
except:
- master
image: docker:stable
script:
- docker build --tag rigetti/quilc:${CI_COMMIT_REF_SLUG} .
- echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USERNAME} --password-stdin
- docker push rigetti/quilc && docker rmi -f rigetti/quilc:${CI_COMMIT_REF_SLUG}

docker-vtag:
stage: package
tags:
- dockerd
- github
# matches only on tags of the form vX.Y.Z
only:
- /^v(\d+\.)?(\d+\.)?(\d+)$/
except:
- branches
image: docker:stable
script:
- docker build --tag rigetti/quilc:${CI_COMMIT_TAG} --tag rigetti/quilc:stable .
- echo ${DOCKERHUB_PASSWORD} | docker login -u ${DOCKERHUB_USERNAME} --password-stdin
- docker push rigetti/quilc && docker rmi -f rigetti/quilc:stable
114 changes: 114 additions & 0 deletions ACKNOWLEDGEMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Acknowledgements

## Pre-Release History

Within the first half of 2016, the first version of Quil was being
created, originally called "QIL" for "Quantum Instruction
Language". Around May, it was renamed to Quil because it both looks
and sounds nicer. The concrete development of Quil was started by
Robert Smith and continues to be developed by him. Development began
along the efforts contained within two software projects. The first
project is CL-QUIL, which sought to provide syntax to Quil, and the
second project is the [QVM](https://github.com/rigetti/qvm), which
sought to provide semantics to Quil.

CL-QUIL started off as a parser for Quil. Quil programs used to be
represented as S-expressions, and was written like so:

```
((H 0)
(CNOT 0 1)
(MEASURE 0 0))
```

The parser was a combination of the Lisp function
[`READ`](http://www.lispworks.com/documentation/lw50/CLHS/Body/f_rd_rd.htm)
along with a simple walker to translate the forms into primitive
structure objects. Eventually, a more assembly-like syntax was
preferred, and a recursive descent parser was written. This included
the development of a new lexical analyzer generator called
[ALEXA](https://github.com/rigetti/alexa) which was open-sourced in
May 2016.

With the introduction of the `DEFCIRCUIT` and `LABEL` constructs, more
sophisticated program analysis was required (e.g., for circuit
expansion and label resolution). Around July 2016, the CL-QUIL project
was extended to be a compilation framework for Quil, starting off with
many concepts in classical compiler theory like control flow graphs,
resource parallelization, and [nano-pass
concepts](https://www.cs.indiana.edu/~dyb/pubs/nano-jfp.pdf). Development
of these concepts continues.

Around a year later, in July 2017, Rigetti hired interns, some of whom
worked on what has now become the front-end of a Quil compiler. Aaron
Vontell (@vontell) contributed new analysis and optimization passes,
including dead-code elimination, program reconstitution,
pretty-printing, and gate fusion. Joseph Lin (@joelin0) brought MAGICL
to life, getting complex double-precision arithmetic functions
working, getting a Fortran parser working (Sorry, Joe...), and
improving the compiler's static error detection facilities.

At the same time, Eric Peterson (@ecp-rigetti) joined and started
working on the quantum aspect of compilation. This was the birth of
`quilc`, a user-application and front-end to CL-QUIL used for
compiling between different quantum abstract machines. In particular,
he has implemented gate decomposition schemes, peephole optimization,
CFG improvements, and a lot more. Eric has been a main developer of
CL-QUIL and quilc since.

Toward the end of 2017, Robert Smith (@tarballs-are-good), Nikolas
Tezak (@ntezak), and Anthony Polloreno (@ampolloreno) collaborated to
include the Pauli and Clifford groups, with both an algebraic and
symplectic representation. This provides both a polynomial-time
simulatable representation of some common quantum operators, as well
as a method to calculate sequences for [randomized
benchmarking](https://arxiv.org/abs/0707.0963).

In the intern group of 2018, Corwin de Boor (@Strikeskids) implemented
a variety of new addressing and rewiring schemes, akin to register
allocation of qubits. He also contributed ideas and improvements to
the syntax, parsing, and analysis of Quil, including precise resource
tracking.

In the fall of 2018, `quilc` was released in binary form for Windows,
Mac, and Linux as a part of the Forest SDK, compatible with Rigetti's
Quantum Cloud Services. This couldn't have been done without Peter
Karalekas's (@karalekas) and Zach Beane's (@xach) extensive help
versioning, testing, releasing, and deploying `quilc`.

In the back half of 2018, Mark Skilbeck contributed the implementation
of `DAGGER` expansion of circuits, maturing the benchmark suite, and
porting & packaging `quilc` for Windows. Lauren Capelluto contributed
the implementation of arithmetic rewriting.

CL-QUIL and quilc benefited extensively from internal testers at
Rigetti, as well as the thousands of users of Quantum Cloud Services.

## Credits Roll

For security and privacy, the git history has been removed. The
contributors of the project, in approximately the order of their
commit count according to `git shortlog --summary --numbered`, prior
to open-sourcing were:

* **Eric Peterson** (decomposition and optimization framework, too many contributions to count)
* **Robert Smith** (parser, CFG generation, symplectic representations)
* **Mark Skilbeck** (`DAGGER` expansion, benchmarking, Windows port, Google & IBM architecture ports)
* **Peter Karalekas** (release management, automated testing, versioning, and deployment)
* **Nikolas Tezak** (Pauli and Clifford group algebra, gate resolution, `PRAGMA` formalization)
* **Zach Beane** (porting to CCL & LispWorks, release management, Quicklisp & `buildapp`)
* **Corwin de Boor** (resource tracking, implementation and comparative study of rewiring schemes)
* **Lauren Capelluto** (arithmetic rewriting)
* **Erik Davis** (optimization of resource tracking)
* **Aaron Vontell** (CFG optimizations, gate fusion)
* **Anthony Polloreno** (Clifford groups, randomized benchmarking, SWAP quotient)
* **Chris Osborn** (dead qubit detection)
* **Joseph Lin** (MAGICL, static arity and gate resolution analysis)

## Open Source

CL-QUIL and quilc proudly depend on the work of the open source
community, as well as [SBCL](http://www.sbcl.org/),
[ASDF](https://common-lisp.net/project/asdf/), and Zach Beane's
continued maintenance of the [Quicklisp](https://www.quicklisp.org/)
project and repository.
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Contributor Guidelines

We value and encourage contribution from the community. To reduce
friction in this process, we have collected some best-practices for
contributors:

* Testing. Before making a pull-request (PR), please make sure that
you have added sufficient test coverage to your changes and that you
have run the test suite. You can run tests by invoking `make test` in
the project root. Code coverage statistics can be compiled by
running `sbcl --load coverage-report.lisp` in the `coverage-report`
directory.
* Documentation. Provide concise but clear documentation for your
changes. In general, all public functions (those exported in
`package.lisp`) *must* have docstrings. Internal functions should
usually be documented though it is less important. Documentation
should also be provided as comments to your code. In particular,
non-obvious code should be accompanied by detailed explanation of
its working.
* Pull Request. The typical workflow for contributing to an
open-source project is
1. Create a fork of the project.
2. Create a branch for your work. This should be appropriately
named, often with a descriptive prefix of `feature/` or `fix/`.
3. Create a PR to the original project. The PR should have a concise
title stating the intent of the PR, followed by a more detailed
description of the proposed changes including arguments for those
changes.
4. Your code will be reviewed. You should participate in the review,
making changes where suggested and pushing them to the PR branch.
5. If all goes well, your code will be merged and you will be
attributed in the ACKNOWLEDGEMENTS file.
* Style. In general, follow the [Google Common-Lisp style guide](https://google.github.io/styleguide/lispguide.xml). If
there is an inconsistency between the style guide and neighboring
code, follow the style of the neighboring code. Use code formatting
(indentation) that is equivalent to that of GNU Emacs'
`common-lisp-mode`.
* Be polite.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM rigetti/quicklisp

ARG build_target

# install build dependencies
COPY Makefile /src/quilc/Makefile
WORKDIR /src/quilc
RUN make install-build-deps

# clone rpcq to get version > v2.0.0 (which is available in QL)
WORKDIR /src
RUN git clone https://github.com/rigetti/rpcq.git

# build the quilc app
ADD . /src/quilc
WORKDIR /src/quilc
RUN git clean -fdx && make ${build_target}

ENTRYPOINT ["./quilc"]
Loading

0 comments on commit 7ca9950

Please sign in to comment.