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 fusion optimization for qasm simulator #136

Merged
merged 17 commits into from
Apr 20, 2019

Conversation

hhorii
Copy link
Collaborator

@hhorii hhorii commented Apr 11, 2019

Summary

This PR introduces a basic optimization to aggregate gates in qasm simulator.

Details and comments

Some consecutive gates are aggregated with this optimization.

  • supports fusion of 2x2 and 4x4 unitary gates
  • add test cases
  • provide configuration for performance tuning

Available backend_options:

  • fusion_enable: enable fusion optimization with True (default: False).

  • fusion_max_qubit: set maximum number of qubits for an aggregated operation.

  • fusion_verbose: output optimized circuits

  • fusion_threshold: minimum number of qubits of circuits to enable this optimization.

  • Will remain: supports fusion of large unitary

@hhorii hhorii changed the title [WIP] add fusion optimization for qasm simulator add fusion optimization for qasm simulator Apr 17, 2019
Copy link
Member

@chriseclectic chriseclectic left a comment

Choose a reason for hiding this comment

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

Thanks @hhorii, overall it looks good! My comments are mostly suggestions for renaming things to make it a little easier for others to understand what's going on.

Some more general comments:

  • Could you add the apply_matrix_sequence function to the unitary_state since it can support it (though inheritance from QubitVector)
  • Could you add the basic_optimizations to the statevector_controller and unitary_controller since they would both benefit from the gate fusion too.

src/simulators/statevector/qubitvector.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/qubitvector.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/qubitvector.hpp Show resolved Hide resolved
src/simulators/statevector/qubitvector.hpp Show resolved Hide resolved
src/simulators/statevector/qubitvector.hpp Outdated Show resolved Hide resolved
src/framework/operations.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/statevector_state.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/statevector_state.hpp Outdated Show resolved Hide resolved
src/simulators/statevector/statevector_state.hpp Outdated Show resolved Hide resolved
src/framework/circuitopt.hpp Show resolved Hide resolved
chriseclectic
chriseclectic previously approved these changes Apr 19, 2019
Copy link
Member

@chriseclectic chriseclectic left a comment

Choose a reason for hiding this comment

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

LGTM! @atilag did you want to review as well or can we merge?

@chriseclectic
Copy link
Member

@hhorii looks like something changed with the tests. As soon as you can get them passing we can merge

@chriseclectic chriseclectic merged commit c87c88e into Qiskit:master Apr 20, 2019
gadial pushed a commit to gadial/qiskit-aer that referenced this pull request Apr 22, 2019
* add fusion

* Set configuration to circuit optimization

* add fusion options

* disable fusion without configuration

* add noise test cases and remove debug codes

* delete statevector_gate_opt configuration

* refactor fusion optimization for future optimization

* qubitvector expands matrixes for fusion.
dcmckayibm pushed a commit to dcmckayibm/qiskit-aer that referenced this pull request Nov 3, 2019
* add fusion

* Set configuration to circuit optimization

* add fusion options

* disable fusion without configuration

* add noise test cases and remove debug codes

* delete statevector_gate_opt configuration

* refactor fusion optimization for future optimization

* qubitvector expands matrixes for fusion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants