qiskit-advocate / qamp-fall-21

Qiskit advocate mentorship program (QAMP) fall 21 cohort (Sep - Dec 2021)
30 stars 6 forks source link

OpenQASM 3 Reference Implementation #23

Open jwoehr opened 3 years ago

jwoehr commented 3 years ago

Description

Begin a reference implementation of OpenQASM 3 that can be updated as details of the specification necessarily change somewhat.

The new version of the Open Quantum Assembler has a reference grammar written in Apache ANTLR4.

The mentor has already used a subset of the grammar to create an OpenQASM 2 implementation. We can evolve that concept towards an OpenQASM 3.

Mentor/s

Jack Woehr

Type of participant

Good Python coder (or other languages) with some experience in DSLs (Domain-Specific Languages)

Number of participants

1-2

Deliverable

Working, updatable reference implementation of OpenQASM 3

HuangJunye commented 3 years ago

I am very interested in OpenQASM3 so I am thinking about whether I should become a mentee this time :) What exactly do you in mind as a “reference implantation”? Is it a compiler that takes OpenQASM3 code and converts to Qiskit code?

jwoehr commented 3 years ago

I am very interested in OpenQASM3 so I am thinking about whether I should become a mentee this time :) What exactly do you in mind as a “reference implantation”? Is it a compiler that takes OpenQASM3 code and converts to Qiskit code?

Output is a QuantumCircuit instance (or a text dump of the AST if desired for debugging, that sort of thing)

nelimee commented 3 years ago

I am very much interested by this project too! What are the tools you plan to use for this project? Without a doubt Python, but how will the grammar be read? Do you have any library in mind (ANTLR4, other?) or is it something that needs to be discussed beforehand and that has not been decided yet?

jwoehr commented 3 years ago

There is an ANTLR4 grammar in the Qiskit/openqasm tree.

If you clone Qiskit/openqasm and do make html you will see there is a chapter at the end of the OpenQASM Live Specification about the Grammar.

The developers to some extent dismiss it as a reference grammar and expect more performant tools will be used in final products, and this is probably true.

However, a reference implementation of at least part of OpenQASM 3 would be a milestone.

I already have used a subset of that grammar (qasm3.g4) to do a rewrite of the OpenQASM 2 compiler which is currently in PR for Qiskit Terra: New OpenQASM2 translator based on ANTLR4 grammar

If we put a team together, e.g., @nelimee @HuangJunye @AbeerVaishnav13 of course we can discuss what tools to use. But since already have a working OpenQASM2 translator to QuantumCircuit it might be easy to start there.

AbeerVaishnav13 commented 3 years ago

Yes, I too am interested in working on this project. I went through some resources that @jwoehr sent through slack and I found it very interesting.

jwoehr commented 3 years ago

Is everyone who is interested applying via the mentorship form?

jwoehr commented 3 years ago

@nelimee @AbeerVaishnav13 @HuangJunye check out the recording which @taalexander posted to the open-qasm channel on Qiskit Slack.

jwoehr commented 3 years ago

Today 2021-08-30 is the deadline for applying for mentorship.

jwoehr commented 3 years ago

All ... note this PR https://github.com/Qiskit/openqasm/pull/269

jwoehr commented 3 years ago

https://github.com/mentor-fall2021-openqasm is our new GitHub organization

HuangJunye commented 3 years ago

@mrvee-qC Can you please comment in the issue so that I can assign you?

mrvee-qC commented 3 years ago

@mrvee-qC Can you please comment in the issue so that I can assign you?

Sure! :D

HuangJunye commented 2 years ago

@mrvee-qC @nelimee @AbeerVaishnav13 Can you please upload your presentation here by the end of today? Thank you!

mrvee-qC commented 2 years ago

Here is our submission! ~ @AbeerVaishnav13 @nelimee @jwoehr @mrvee-qC QAMP23-OpenQasm3.0.pdf

AbeerVaishnav13 commented 2 years ago

Uploading the updated presentation after certain changes.

#23-OpenQASM3 Reference Implementation.pdf

mrvee-qC commented 2 years ago

Checkpoint 2, November 11

For a unified report, please check out our dedicated website page for this mentorship project! https://mentor-fall2021-openqasm.github.io/posts/checkpoint-2/

Summary since October 7 Checkpoint #1

Progress Summary

The version 1 of the implementation showcased on October 7 - Checkpoint #1 now has several fixes and changes with regards to the translator functionality with conformance to the OpenQASM 3.0 specification. Here are a few changes summarized on the v1 implementation:

Contribution Summary:

Goals and further direction:

mrvee-qC commented 2 years ago

PDF Report

alt text

Link for pdf: QAMPCheckpoint#2.pdf

(Also you can check it out at our website! :) https://mentor-fall2021-openqasm.github.io/posts/checkpoint-2/)

~ @AbeerVaishnav13 @nelimee @jwoehr @mrvee-qC

nelimee commented 2 years ago

Here is our submission! @AbeerVaishnav13 @nelimee @jwoehr @mrvee-qC QAMP21_Checkpoint3.pdf

mrvee-qC commented 2 years ago

Updated submission: @AbeerVaishnav13 @nelimee @jwoehr @mrvee-qC

Presentation: QAMP21_Checkpoint3.pdf

QAMP21_Checkpoint3