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

Avoid blow-up of complexity when squashing symbolic circuits #969

Merged
merged 17 commits into from
Aug 15, 2023

Conversation

cqc-alec
Copy link
Collaborator

Fixes #963 .

@cqc-alec cqc-alec requested a review from yao-cqc August 15, 2023 09:17
@cqc-alec cqc-alec marked this pull request as draft August 15, 2023 10:02
@yao-cqc
Copy link
Contributor

yao-cqc commented Aug 15, 2023

from sympy import Symbol
from pytket.circuit import Circuit, OpType
from pytket.passes import SynthesiseTK
a = [Symbol(f"a_{i}") for i in range(100)]

c = Circuit(3)
for i in range(10):
    c.add_gate(OpType.CX, [], [0, 1])
    c.add_gate(OpType.Rz, [a[i]], [0])
    c.add_gate(OpType.CX, [], [1, 2])

SynthesiseTK().apply(c)

pytket 1.17 took 14.3s. The resulting circuit json is 2.7MB
this branch took 12.6s, but the expression is a lot simpler. 7kb

Not sure why it still takes that long to run.

@cqc-alec
Copy link
Collaborator Author

Not sure why it still takes that long to run.

Hmm, yeah I'm surprised it took so long...

@cqc-alec cqc-alec marked this pull request as ready for review August 15, 2023 13:29
Copy link
Contributor

@yao-cqc yao-cqc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I don't see any easy alternative to this...
Could you add this new argument to compiler_pass_v1.json?

@cqc-alec
Copy link
Collaborator Author

Could you add this new argument to compiler_pass_v1.json?

Done.

@cqc-alec cqc-alec merged commit cd78e00 into develop Aug 15, 2023
33 checks passed
@cqc-alec cqc-alec deleted the bugfix/fposym branch August 15, 2023 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FullPeepholeOptimise with TK2 target runs forever on a small symbolic circuit
2 participants