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

Expose plugin options #12107

Merged
merged 6 commits into from
Apr 22, 2024
Merged

Conversation

alexanderivrii
Copy link
Contributor

Summary

This commit enables additional options for KMSSynthesisLinearFunction and PMHSynthesisLinearFunction plugins for synthesizing LinearFunction objects. For the Patel-Markov-Hayes algorithm (PMH) we can now directly specify the section_size, as for example

mat = random_invertible_binary_matrix(7, seed=1234)
qc = QuantumCircuit(7)
qc.append(LinearFunction(mat), [0, 1, 2, 3, 4, 5, 6])
hls_config = HLSConfig(linear_function=[("pmh", {"section_size": 1})])
qct = HighLevelSynthesis(hls_config=hls_config)(qc)

For both plugins we can specify use_transposed and use_inverted options that modify the matrix on which the underlying synthesis algorithm runs by possibly inverting and/or transposing it, and then suitably adjust the synthesized circuit. This functionality existed in Qiskit before, but was not exposed through the options.

By varying these options, we generally get different synthesized circuits, and in cases may obtain better results than for their default values.

Details and comments

@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

@alexanderivrii alexanderivrii added this to the 1.1.0 milestone Mar 31, 2024
@alexanderivrii alexanderivrii added the Changelog: New Feature Include in the "Added" section of the changelog label Mar 31, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8497367679

Details

  • 32 of 34 (94.12%) changed or added relevant lines in 2 files are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.01%) to 89.354%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/synthesis/high_level_synthesis.py 31 33 93.94%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 92.62%
Totals Coverage Status
Change from base Build 8497269180: 0.01%
Covered Lines: 60274
Relevant Lines: 67455

💛 - Coveralls


* use_inverted: Indicates whether to run the algorithm on the inverse matrix
and to invert the synthesized circuit.
In certain cases this provides a better decomposition then the direct approach.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In certain cases this provides a better decomposition then the direct approach.
In certain cases this provides a better decomposition than the direct approach.

and to invert the synthesized circuit.
In certain cases this provides a better decomposition then the direct approach.
* use_transposed: Indicates whether to run the algorithm on the transposed matrix
and to invert the order oF CX gates in the synthesized circuit.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
and to invert the order oF CX gates in the synthesized circuit.
and to invert the order of CX gates in the synthesized circuit.

* section size: The size of each section used in the Patel–Markov–Hayes algorithm [1].
* use_inverted: Indicates whether to run the algorithm on the inverse matrix
and to invert the synthesized circuit.
In certain cases this provides a better decomposition then the direct approach.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
In certain cases this provides a better decomposition then the direct approach.
In certain cases this provides a better decomposition than the direct approach.

and to invert the synthesized circuit.
In certain cases this provides a better decomposition then the direct approach.
* use_transposed: Indicates whether to run the algorithm on the transposed matrix
and to invert the order oF CX gates in the synthesized circuit.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
and to invert the order oF CX gates in the synthesized circuit.
and to invert the order of CX gates in the synthesized circuit.

Copy link
Contributor

@sbrandhsn sbrandhsn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! :-)

@sbrandhsn sbrandhsn added this pull request to the merge queue Apr 22, 2024
Merged via the queue into Qiskit:main with commit cedf030 Apr 22, 2024
12 checks passed
@alexanderivrii alexanderivrii deleted the expose-plugin-options branch May 1, 2024 09:40
@alexanderivrii alexanderivrii mentioned this pull request May 1, 2024
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.

4 participants