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

QASM conversion violates max_width in tk_SCRATCH_BIT register #1576

Open
PabloAndresCQ opened this issue Sep 12, 2024 · 0 comments
Open

QASM conversion violates max_width in tk_SCRATCH_BIT register #1576

PabloAndresCQ opened this issue Sep 12, 2024 · 0 comments
Assignees
Labels
bug Something isn't working classical-logic issues related to classical logical expressions

Comments

@PabloAndresCQ
Copy link
Contributor

According to the docstring of circuit_from_qasm, the user can set a "maximum allowed width of classical registers" with maxwidth. However, circuits that generate auxiliar tk_SCRATCH_BIT registers seem to skip this constraint.

Here is an example QASM file telep_Z_Z.txt. To reproduce, run:

from pytket.qasm import circuit_from_qasm
pytket_circuit = circuit_from_qasm("telep_Z_Z.txt", maxwidth=64)

The resulting pytket_circuit has a tk_SCRATCH_BIT register with more than 100 bits in it, violating the maxwidth=64 set by the user.

This is problematic in a pipeline where the pytket circuit is then converted to PHIR to be run in PECOS. For now, as a work around, I am using rename_units to convert each tk_SCRATCH_BIT[idx] to tk_SCRATCH_BIT_idx[0]. However, I would expect a better approach to create scratch registers of up to maxwidth size, and create new ones when the previous one is filled.

@PabloAndresCQ PabloAndresCQ added the bug Something isn't working label Sep 12, 2024
@CalMacCQ CalMacCQ added the classical-logic issues related to classical logical expressions label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working classical-logic issues related to classical logical expressions
Projects
None yet
Development

No branches or pull requests

3 participants