-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Using includes with the QASM3 Exporter raises instead of including definitions #13061
Comments
@jakelishman Do you know who might be able to look at this issue? |
Ah, raising the error on unknown imports was a mistake - I didn't think about how you could make it work by using
|
I was using it to get the authoritative stdgates defined for QASM export. I worked around it by creating my own list. |
I've made #13148, which should fix the bad behaviour around the Fwiw, we do have a public-interface version of what's in |
I'll try to use |
Not sure if I'm missing something, but I can't seem to access the name on the from qiskit.qasm3 import STDGATES_INC_GATES
gate_names = [gate.name for gate in STDGATES_INC_GATES]
gate_names = [gate.name() for gate in STDGATES_INC_GATES] Both give the error: |
Oh sorry, that's my fault - I didn't actually check that the data of a |
Environment
What is happening?
When custom includes are passed into the
qiskit/qasm3/exporter::Exporter.__init__
function, the export of QASM will always throw an error when thedump
function is called via theQASM3Builder
. The docs say:This worked fine in Qiskit 1.1.x but 1.2 changed the behavior such that any includes passed in that aren't exactly
stdgates.inc
will raiseQASM3ExporterError
. This also removed theGlobalNamespace
type breaking consumers.In 1.1.x the definitions from the custom includes were treated as opaque assuming any missing definitions would have been provided in the basis gates passed into the
Exporter
.How can we reproduce the issue?
"Unknown OpenQASM 3 include file: 'custom_gates.inc'"
What should happen?
The documentation indicates that the includes will be parsed for gate definitions. The docs have not changed since 1.1.x so the docs have never matched the implementation. I think there are two primary paths which can be taken:
basis_gates
can be used to define opaque gate names which would be found in the external QASM files.Exporter
/QASM3Builder
to match the docs. This will require updating thecrates/qasm3/build.rs
as it currently noops gate definitions when parsing the ASG.basis_gates
parameter?These solutions would not include any files included from the supplied includes list. Instead, the supplied includes are listed at the top of the generated QASM file as was done in 1.1.x.
Any suggestions?
No response
The text was updated successfully, but these errors were encountered: