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

Add a store buffer during NISQ submission



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent f27d2fb0
Loading
Loading
Loading
Loading
+65 −6
Original line number Diff line number Diff line
OPENQASM 3;
include "qelib1.inc";

qubit q;
bit c;
h q;
c = measure q;
if (c) {
    x q;
qubit q[2];
bit c[4];

h q[0];
x q[1];

// Prepare the state:
for i in [0:8] {
    cphase(-5*pi/8) q[0], q[1];
}
h q[0];

// Measure and reset
measure q[0] -> c[0];
reset q[0];

h q[0];
for i in [0:4] {
    cphase(-5*pi/8) q[0], q[1];
}

// Conditional rotation
if (c[0] == 1) {
  rz(-pi/2) q[0];
}

h q[0];
// Measure and reset
measure q[0] -> c[1];
reset q[0];

h q[0];
for i in [0:2] {
    cphase(-5*pi/8) q[0], q[1];
}

// Conditional rotation
if (c[0] == 1) {
  rz(-pi/4) q[0];
}
if (c[1] == 1) {
  rz(-pi/2) q[0];
}
h q[0];


// Measure and reset
measure q[0] -> c[2];
reset q[0];

h q[0];
cphase(-5*pi/8) q[0], q[1];

// Conditional rotation
if (c[0] == 1) {
  rz(-pi/8) q[0];
}
if (c[1] == 1) {
  rz(-pi/4) q[0];
}
if (c[2] == 1) {
  rz(-pi/2) q[0];
}

h q[0];
measure q[0] -> c[3];
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
@@ -424,6 +424,11 @@ void __quantum__qis__applyifelseintrinsic__body(Result *r,

      // Add the whole IfStmt to the program
      current_prog->addInstruction(ifStmt);

      // Debug:
      if (verbose) {
        std::cout << "Collected If statement: \n" << ifStmt->toString() << "\n";
      }
      // Restore the main program.
      ::quantum::qrt_impl->set_current_program(current_prog);
    }
+1 −0
Original line number Diff line number Diff line
@@ -394,6 +394,7 @@ class NISQ : public ::quantum::QuantumRuntime,
          os.close();
        }
      }
      xacc::storeBuffer(xacc::as_shared_ptr(buffer));
      xacc::internal_compiler::execute(
          buffer, program->as_xacc());
    }