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

Support custom gate defintions in QASM parser #6917

Merged
merged 21 commits into from
Jan 17, 2025

Conversation

daxfohl
Copy link
Collaborator

@daxfohl daxfohl commented Jan 4, 2025

Resolves #3560

  • Tests verify parsed vs expected, for unparameterized, parameterized, and for broadcasted qregs.
  • They also use assert_qiskit_parsed_qasm_consistent_with_unitary to ensure consistency of parsed circuit (and sanity check that the provided QASM definition is actually valid).
  • Several tests for invalid gate definitions or invocations and verify similar error message for Cirq and qiskit parsers.
  • One odd instance where qiskit does not throw an error on an invalid QASM circuit, even though simulating it in qiskit fails; chalking it up to a qiskit bug.

@daxfohl daxfohl requested review from vtomole and a team as code owners January 4, 2025 00:34
@daxfohl daxfohl requested a review from dstrain115 January 4, 2025 00:34
@CirqBot CirqBot added the size: L 250< lines changed <1000 label Jan 4, 2025
Copy link

codecov bot commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.87%. Comparing base (0361a81) to head (d29c116).
Report is 18 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #6917    +/-   ##
========================================
  Coverage   97.87%   97.87%            
========================================
  Files        1084     1084            
  Lines       94420    94791   +371     
========================================
+ Hits        92409    92780   +371     
  Misses       2011     2011            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@daxfohl daxfohl force-pushed the qasm-custom-gates branch from fe19f08 to 8a7727f Compare January 4, 2025 05:48
@daxfohl daxfohl force-pushed the qasm-custom-gates branch from 8a7727f to a337aed Compare January 4, 2025 05:51
@daxfohl daxfohl changed the title Add parser for qasm custom gates Support custom gate defintions in QASM parser Jan 9, 2025
Copy link
Collaborator

@dstrain115 dstrain115 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really cool enhancement to qasm parsing!!!
Just some doc comments, and then I think we are good to go.

cirq-core/cirq/contrib/qasm_import/_parser.py Show resolved Hide resolved
cirq-core/cirq/contrib/qasm_import/_parser.py Outdated Show resolved Hide resolved
cirq-core/cirq/contrib/qasm_import/_parser.py Show resolved Hide resolved
@dstrain115 dstrain115 added this pull request to the merge queue Jan 17, 2025
Merged via the queue into quantumlib:main with commit 2b49589 Jan 17, 2025
37 checks passed
@daxfohl daxfohl deleted the qasm-custom-gates branch January 19, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: L 250< lines changed <1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support custom gate defintions in QASM parser
3 participants