-
Notifications
You must be signed in to change notification settings - Fork 2
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
[CQT-293] Remove generators #412
Conversation
Change default gate modifiers from callables to classes. Move default instructions and default gate modifiers to IR. Remove generators from IR instructions. Remove ANNOTATIONS_TO_TYPE_MAP. Remove instruction decorators. Remove instruction_library.py. Pass all tests except for test_gate_modifiers. Pass format and ruff check --fix linters. TODO: - Rewrite parser.py using instruction_generator. - Pass gate modifiers tests.
Change default gate modifiers back from IR nodes to functors. Add inv.inv.X gate modifier test. Pass all tests. Pass format and ruff check --fix linters.
Rewrite test_anonymous_gate test in test_tutorial.py. Pass all linters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice refactor, thanks a lot for the effort!
Mostly some minor comments.
I see indeed the slight increase in overhead, but the clarity of how the ir is built and processed is improved a lot!
# Conflicts: # opensquirrel/default_instructions.py # opensquirrel/ir.py # opensquirrel/parser/libqasm/parser.py # opensquirrel/passes/exporter/cqasmv1_exporter.py # opensquirrel/passes/merger/general_merger.py # opensquirrel/utils/matrix_expander.py # opensquirrel/writer/writer.py # test/docs/test_tutorial.py # test/test_circuit_builder.py
…CQT-293-Remove-generators
Rename BsrWithAngleParm to BsrAngleParam.
Remove Gate::is_anonymous property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all good, thanks!
Must read
This PR is mainly an investigation, although offering already a working implementation as a proof of concept. As such, I would advise to read first the Confluence page, and then use the PR as a companion to see the implementation changes.
Changes
This PR includes also other changes and fixes (some of which may not be detailed in the Confluence page):
accept
implementation of the IR node classes.try_match_replace_with_default
(oldtry_name_anonymous_gate
) work with Rx, Ry, and Rz, e.g., Rx(pi/4) 4 times gives now Rx(pi), and not an anoymous Bloch.inv.inv.X
is now an X, not anonymous anymore.Change log