Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenQASM 3 Reference Implementation #23

Open
jwoehr opened this issue Aug 19, 2021 · 19 comments
Open

OpenQASM 3 Reference Implementation #23

jwoehr opened this issue Aug 19, 2021 · 19 comments

Comments

@jwoehr
Copy link

jwoehr commented Aug 19, 2021

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
Copy link
Collaborator

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
Copy link
Author

jwoehr commented Aug 25, 2021

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
Copy link

nelimee commented Aug 26, 2021

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
Copy link
Author

jwoehr commented Aug 26, 2021

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
Copy link

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
Copy link
Author

jwoehr commented Aug 27, 2021

Is everyone who is interested applying via the mentorship form?

@jwoehr
Copy link
Author

jwoehr commented Aug 27, 2021

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

@jwoehr
Copy link
Author

jwoehr commented Aug 30, 2021

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

@jwoehr
Copy link
Author

jwoehr commented Aug 31, 2021

All ... note this PR openqasm/openqasm#269

@jwoehr
Copy link
Author

jwoehr commented Sep 6, 2021

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

@HuangJunye HuangJunye added the status: matched The project is matched and will not take any more mentees label Sep 9, 2021
@HuangJunye
Copy link
Collaborator

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

@mrvee-qC
Copy link

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

Sure! :D

@HuangJunye HuangJunye removed the status: matched The project is matched and will not take any more mentees label Oct 6, 2021
@HuangJunye
Copy link
Collaborator

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

@mrvee-qC
Copy link

mrvee-qC commented Oct 6, 2021

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

@AbeerVaishnav13
Copy link

Uploading the updated presentation after certain changes.

#23-OpenQASM3 Reference Implementation.pdf

@mrvee-qC
Copy link

mrvee-qC commented Nov 11, 2021

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:

  • Type system flaws identified and fixed in conformance to specification
  • Implementations for quantum and classical registers now robust in aliasing.
  • Initial implementation of 'duration' as per specification
  • Cleanup and reconciling minor changes that further strengthen stricter conformance to implementation according to specification.

Contribution Summary:

  • PR #295 : Suggestion to add Scope for power operator for complex types in language specification. Discussions taken up at TSC meeting. Discussions of requirement of dot notation of complex numbers for few rare use case implementations.
  • Issue #296 : Following discussion with taalexander at IEEE Quantum Week on OpenPulse grammar implementation and Jacks further discussions on the same, team is now added to the openpulse closed group for discussion with guidance from people and teams working on OpenPulse.
  • PR #269 : Team contributed to bug and implementation fixes for reference AST implementation PR which was merged this month.
  • Issue #304 : Bug report for openqasm3 pyPI package.
  • Presented progress and project overview at Qiskit advocate session at IEEE Quantum Week 2021.

Goals and further direction:

  • Reconstruct and restart current repository to depend on openqasm package rather than forks of openqasm repository and outsource package dependencies for openasm parser, ast and other components
  • Work in support of PR #295 and fulfillment of Issue #296.
  • Take inspirations from discussions in Issue #296 and start writing to invent own grammar and connect it to openpulse, eventually towards an implementation for translating to qiskit-pulse/ qiskit-pulse builder syntax.
  • Take opinions and hints from openpulse invested parties in the discussion in Issue #296 while creating it along. Have received guidance support from openpulse closed group

@mrvee-qC
Copy link

mrvee-qC commented Nov 11, 2021

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
Copy link

nelimee commented Dec 8, 2021

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

@mrvee-qC
Copy link

mrvee-qC commented Dec 9, 2021

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

Presentation: QAMP21_Checkpoint3.pdf

QAMP21_Checkpoint3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment