Skip to content

Conversation

zsb-xqc
Copy link

@zsb-xqc zsb-xqc commented Sep 8, 2025

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

sengthai and others added 9 commits August 30, 2025 13:05
… 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.
@zsb-xqc zsb-xqc self-assigned this Sep 8, 2025
Base automatically changed from ppm-specs-depth to main September 8, 2025 19:30
@zsb-xqc zsb-xqc requested a review from sengthai September 10, 2025 14:55
@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link
Contributor

@sengthai sengthai left a 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`)

Comment on lines +236 to +241
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
}
Copy link
Contributor

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.

Copy link
Author

@zsb-xqc zsb-xqc Sep 10, 2025

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.

@zsb-xqc zsb-xqc added the wip PRs that are a Work-In-Progress label Sep 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wip PRs that are a Work-In-Progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants