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

Cirq Performance Improvement Roadmap Item #6097

Closed
3 of 4 tasks
tanujkhattar opened this issue May 17, 2023 · 9 comments
Closed
3 of 4 tasks

Cirq Performance Improvement Roadmap Item #6097

tanujkhattar opened this issue May 17, 2023 · 9 comments
Labels
area/performance good first issue This issue can be resolved by someone who is not familiar with the codebase. A good starting issue. good part time project A meaty non-urgent issue with a substantial amount of work to be done. kind/design-issue A conversation around design kind/roadmap-item for higher level roadmap items to capture conversations and feedback (not for project tracking) no QC knowledge needed Want to contribute to Cirq, but don't know quantum computing? This issue is for you. triage/accepted there is consensus amongst maintainers that this is a real bug or a reasonable feature to add

Comments

@tanujkhattar
Copy link
Collaborator

tanujkhattar commented May 17, 2023

This is a high level roadmap item that captures key areas where we need to improve performance in Cirq to support writing and running larger circuits in Cirq. The four key areas of performance improvements to enable M3 experiments are:

  • Circuit Construction: This was addressed as part of PR5332 and PR5898. Constructing a d25 surface code memory experiment circuit with 625 rounds now takes ~32ms. Further improving this number is always better but we believe this is fast enough to not be a blocking roadmap item.

  • Parameter Resolution: Running circuits for calibrations often require repeatedly executing parameterized circuits with different parameter values. cirq.resolve_parameters is slow #6091 gives a good overview of why cirq.resolve_parameters is slow. We should make the necessary changes to address the concerns raised in the issue.

  • Circuit Transformations: PR5957 adds performance benchmarks for common circuit transformation primitives in Cirq. We need to make the primitives more performant to bring down the circuit transformations runtime for the (1000 qubit, 100 moments) to run under 100ms.

  • Circuit Serializations: The Json serialization was not designed to be compact or fast. Benchmarks for json serialization, added in PR5957, show that it takes O(seconds) to serialize a (1000 qubit, 100 moment) circuit containing one and two qubit gates. We want this number to be O(milliseconds). To make this happen, see whether:

    • We can improve the performance of serialization/deserialization using the existing json serialization data model.
    • If not, design a new serialization model with better performance scaling.

Running list of blocking issues which must be addressed to mark this item as completed

@tanujkhattar tanujkhattar added kind/design-issue A conversation around design kind/roadmap-item for higher level roadmap items to capture conversations and feedback (not for project tracking) labels May 17, 2023
@vtomole
Copy link
Collaborator

vtomole commented May 17, 2023

Will we ever write parts of Cirq in C++ for performance improvements? What are the pros and cons of doing this?

@pavoljuhas
Copy link
Collaborator

Will we ever write parts of Cirq in C++ for performance improvements? What are the pros and cons of doing this?

(per @dstrain115, cirq sync meeting) C++ use is not currently planned. It will necessitate building separate packages for Linux, Mac, Windows which have different C++ toolchains and build environments. In the future we might consider Rust rather than C++.

@tanujkhattar tanujkhattar added good first issue This issue can be resolved by someone who is not familiar with the codebase. A good starting issue. good part time project A meaty non-urgent issue with a substantial amount of work to be done. no QC knowledge needed Want to contribute to Cirq, but don't know quantum computing? This issue is for you. triage/accepted there is consensus amongst maintainers that this is a real bug or a reasonable feature to add labels May 24, 2023
@harshthakkar01
Copy link

Hi, I would like to contribute to this task.

@navaro1
Copy link
Contributor

navaro1 commented May 27, 2023

I have some experience in improving performance of serialization, hence would like to help with Circuit Serializations point.

@tanujkhattar
Copy link
Collaborator Author

@navaro1 That's great, I've opened #6110 to track serialization performance improvements. Can you leave a comment on this issue so I can assign it to you? Thanks!

@skushnir123
Copy link
Contributor

I can take this issue.

@tanujkhattar
Copy link
Collaborator Author

@skushnir123 Can you leave a comment on #6091 instead?

@rht
Copy link

rht commented Jun 21, 2023

In the future we might consider Rust rather than C++.

Related: There is RustQIP that leverages Rust's borrow checker to enforce the condition of the no-cloning theorem. A Rust backend of Cirq would be able to have this feature. But how would the Rust backend interface with qsim?

@tanujkhattar
Copy link
Collaborator Author

@pavoljuhas I think this issue can be closed. The only remaining task is to speed up json serialization and the linked open PR by Piotr does a good job. The only blocker at the time was that it introduces an additional dependency and we need to evaluate whether that's okay or not.

I'll go ahead and close this for now and we can track serialization improvements in #6110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/performance good first issue This issue can be resolved by someone who is not familiar with the codebase. A good starting issue. good part time project A meaty non-urgent issue with a substantial amount of work to be done. kind/design-issue A conversation around design kind/roadmap-item for higher level roadmap items to capture conversations and feedback (not for project tracking) no QC knowledge needed Want to contribute to Cirq, but don't know quantum computing? This issue is for you. triage/accepted there is consensus amongst maintainers that this is a real bug or a reasonable feature to add
Projects
No open projects
Status: Done
Development

No branches or pull requests

7 participants