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

Running a program that involves more than isize::MAX gates triggers a panic in circuit builder #2099

Open
swernli opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@swernli
Copy link
Collaborator

swernli commented Jan 9, 2025

Because in compiler/qsc/src/interpret.rs we always create a chained simulator that includes a circuit builder, every intrinsic gate call gets added to a running tally of gates performed. Rust has a limit on the capacity of Vec to isize::MAX so if more than that many gates are used the push of the gate after the max triggers a panic. We can work around this temporarily by having the circuit builder stop tracking when hits a hard coded limit, but we should also consider updates to the interpreter behavior (and the corresponding dump_circuit() exposed in Python) to avoid tracing gates for a circuit if not in a debug mode, which should have additional performance benefits.

Here's a playground repro (screenshot below).

Image
@swernli swernli added bug Something isn't working needs triage labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant