Commit a59b1eaf authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Adding a quantum dialect op to support If-Then-Else based on Result*



Frontend to try map to this Op if possible (detecting a simple measure - store - if pattern)
Lowering: llvm codegen to leverage  __quantum__qis__applyifelseintrinsic__body API (this API allows the runtime to opportunistically generate NISQ IfStmt IR; decay to classical If/else in FTQC mode)

Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent a8fe8680
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -234,4 +234,12 @@ def CreateCallableOp : QuantumOp<"createCallable", []> {
  p << "q.createCallable" << "(" << op.functors() << ") : " << op.callable().getType(); }];
}

def ConditionalOp : QuantumOp<"ifElseOp", []> {
  let summary = "if-then-else operation conditioned on a quantum Measure";
  // Must be conditioned on a Result type
  let arguments = (ins ResultType:$result_bit);
  let results = (outs Variadic<AnyType>:$results);
  let regions = (region SizedRegion<1>:$thenRegion, AnyRegion:$elseRegion);
}

#endif // Quantum_OPS
 No newline at end of file