Skip to content

cs and csdg from stdgates.inc are rejected as unsupported operations #439

Description

@ryanhill1

Summary

cs and csdg are in OpenQASM 3's stdgates.inc, but pyqasm rejects both at unroll with ValidationError: Unsupported / undeclared QASM operation: cs. The other controlled standard gates (ch, cy, cz, crx, …) unroll fine.

Repro (pyqasm 1.2.1)

import pyqasm
for g in ("cs", "csdg", "ch"):
    m = pyqasm.loads(f'OPENQASM 3.0;\ninclude "stdgates.inc";\nqubit[2] q;\nbit[2] c;\n{g} q[0], q[1];\nc = measure q;\n')
    m.unroll()
# cs   -> ValidationError: Unsupported / undeclared QASM operation: cs
# csdg -> ValidationError: Unsupported / undeclared QASM operation: csdg
# ch   -> OK

Impact

Seen in production through qbraid-qir (QASM->QIR conversion failed: Unsupported / undeclared QASM operation: csdg) on the qBraid simulators, 6 jobs from one user between 2026-09-23. Any Qiskit circuit containing CSGate/CSdgGate exported to OpenQASM 3 hits it.

Expected

Both decompose trivially: cs a, b = cp(pi/2) a, b; csdg a, b = cp(-pi/2) a, b.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions