-
Notifications
You must be signed in to change notification settings - Fork 57
Add functionality to obtain some specs/info on quantum operations #2038
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
base: main
Are you sure you want to change the base?
Conversation
… This is added as a new pass in the Quantum dialect and is based on the ppr-specs pass in the QEC dialect. The specs are written to file as well as sent to stdout. Some other changes include: -Adding hooks to debug into catalyst C-code, through python frontend. -Changed intermediate files directory name to be always same.
Hello. You may have forgotten to update the changelog!
|
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.
It's great to start exploring Catalyst through this PR. This workflow looks good for building Catalyst's pass. 👍
Normally, for full process, we'd like to exposed the pass for end users in Python as well. We can config in frontend/catalyst/passes/builtin_passes.py, so then the user could used this pass as decorator (e.g
@quantum-specs-info`)
std::error_code EC; | ||
llvm::raw_fd_ostream fileOutputStream("test.txt", EC, llvm::sys::fs::OF_Append); | ||
if (EC) { | ||
llvm::errs() << "Error opening file: " << EC.message() << "\n"; | ||
return failure(); // Handle error | ||
} |
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.
It's nice to write into a file for future use. 👍 It would be great if we had an option for the user to disable or enable this feature.
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.
Thanks for reviewing @sengthai!, Yes I will add to front end also and give option to enable/disable writing to file.
Context:
The current
--ppm-specs
pass provides informative specs on a circuit related to ppr/ppm components, such as ppr operation count. This work extends that to include non-ppr/ppm operations, such as standard gate count, making the specs more generic. This activity was chosen as a first issue for @zsb-xqc, so it serves as a learning exercise.Description of the Change:
This modification includes adding a new pass in the quantum dialect
--quantum-specs-info
, which is implemented in:QuantumSpecsInfo.cpp
The test file is:
QuantumSpecsInfoTest.mlir
Benefits:
Provides general specs for all quantum operations. As a pass, it can be added at various locations in the pipeline, to see how the compilation has adjusted the gate count.
Possible Drawbacks:
None, but there may be better ways to implement spec gathering.
Related GitHub Issues:
None