bloqade.qasm2.passes.parallel.ParallelToUOp
← Module overview
class
method
sourcemethod
source
classParallelToUOp¶source
bloqade.qasm2.passes.parallel.ParallelToUOp
Bases: Pass
Pass to convert parallel gates into single gates.
class ParallelToUOpThis pass rewrites any parallel gates from the qasm2.parallel dialect into multiple
single gates in the qasm2.uop dialect, bringing the program closer to
conforming to standard QASM2 syntax.
Usage Examples
Section titled “Usage Examples”# Define kernel@qasm2.extendeddef main(): q = qasm2.qreg(4)
qasm2.parallel.cz(ctrls=[q[0], q[2]], qargs=[q[1], q[3]])
# Run rewriteParallelToUOp(main.dialects)(main)The qasm2.parallel.cz statement has been rewritten to individual gates:
qasm2.uop.cz(ctrl=q[0], qarg=q[1])qasm2.uop.cz(ctrl=q[2], qarg=q[3])methodgenerate_rule¶source
bloqade.qasm2.passes.parallel.ParallelToUOp.generate_rule
def generate_rule(mt: ir.Method) -> ParallelToUOpRuleParameters
| Name | Type | Description |
|---|---|---|
mt | ir.Method |
Returns
ParallelToUOpRule
methodunsafe_run¶source
bloqade.qasm2.passes.parallel.ParallelToUOp.unsafe_run
def unsafe_run(mt: ir.Method) -> abc.RewriteResultParameters
| Name | Type | Description |
|---|---|---|
mt | ir.Method |
Returns
abc.RewriteResult