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

Add Expr supprt to DAGCircuit simple constructors #10362

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

jakelishman
Copy link
Member

@jakelishman jakelishman commented Jun 29, 2023

Summary

This adds support to the DAGCircuit builder methods apply_operation_front and apply_operation_back, and consequently to the converter circuit_to_dag. This commit does not directly enhance DAGCircuit.compose, which will come later.

The principal change is that _bits_in_condition is modified to the more general _bits_in_operation, which now accounts for both a condition (if set) and any additional fields from a target if the operation is a suitable ControlFlowOp. This has the effect of upgrading the converters into the SabreDAG format as well, but nothing is done to change the Sabre algorithms themselves.

Details and comments

Close #10226. Depends on #10358. Changelog to follow as part of #10331.

The change of _bits_in_condition to _bits_in_operation likely does most of the remaining work for #10232 on top of its prerequisites #9419 and #9421 (although a PR for #10232 will still need to add tests).

@jakelishman jakelishman added the Changelog: New Feature Include in the "Added" section of the changelog label Jun 29, 2023
@jakelishman jakelishman added this to the 0.25.0 milestone Jun 29, 2023
@jakelishman jakelishman requested a review from a team as a code owner June 29, 2023 23:01
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

@coveralls
Copy link

coveralls commented Jun 29, 2023

Pull Request Test Coverage Report for Build 5556084548

  • 15 of 15 (100.0%) changed or added relevant lines in 3 files are covered.
  • 15 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.007%) to 86.046%

Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 90.89%
crates/qasm2/src/parse.rs 12 96.65%
Totals Coverage Status
Change from base Build 5555773611: -0.007%
Covered Lines: 72263
Relevant Lines: 83982

💛 - Coveralls

This adds support to the `DAGCircuit` builder methods
`apply_operation_front` and `apply_operation_back`, and consequently to
the converter `circuit_to_dag`.  This commit does not directly enhance
`DAGCircuit.compose`, which will come later.

The principal change is that `_bits_in_condition` is modified to the
more general `_bits_in_operation`, which now accounts for both a
`condition` (if set) and any additional fields from a `target` if the
operation is a suitable `ControlFlowOp`.  This has the effect of
upgrading the converters into the `SabreDAG` format as well, but nothing
is done to change the Sabre algorithms themselves.
@jakelishman
Copy link
Member Author

Rebased on top of main.

Copy link
Member

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

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

LGTM, this seems straightforward enough to support reliably collecting the clbits for all the control flow ops and expressions.

@mtreinish mtreinish added this pull request to the merge queue Jul 17, 2023
Merged via the queue into Qiskit:main with commit 574da7e Jul 17, 2023
@jakelishman jakelishman deleted the expr/dag-converters branch July 19, 2023 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for mapping Expr values in DAG/QC converters
4 participants