Summary
Enable the QEC vectorized cross-round detector patterns shown below. They are the vectorized counterparts to the scalar prev_s0 = s0; idiom from the internal spec, and they do not compile today.
Examples to enable
C++ — vectorized cross-round, local-only (loop)
#include <cudaq.h>
#include <vector>
__qpu__ void rep_code_vectorized(int nRounds) {
cudaq::qvector ancillas(2);
auto prev = mz(ancillas);
for (int r = 1; r < nRounds; r++) {
auto curr = mz(ancillas);
cudaq::detectors(prev, curr);
prev = curr; // carry current round forward
}
}
C++ — vectorized cross-round with reference parameter
#include <cudaq.h>
#include <vector>
__qpu__ void surface_code_round(cudaq::qvector<>& data,
cudaq::qvector<>& ancillas,
std::vector<cudaq::measure_result>& prev) {
auto syndromes = mz(ancillas);
cudaq::detectors(prev, syndromes);
prev = syndromes; // update caller's `prev` for next round
}
Current Behavior
Compilation fails
$ cudaq-quake rep_code_vectorized.cpp
error: ../cudaq/lib/Frontend/nvqpp/ConvertExpr.cpp:1595: not yet implemented: unhandled std::vector member function, operator=
LLVM ERROR: fatal error, aborting.
Expected Behavior
Program compiles and runs successfully.
Prior work
#4573 attempted to fix by using shallow copy semantics, but, was generating wrong IR.
Summary
Enable the QEC vectorized cross-round detector patterns shown below. They are the vectorized counterparts to the scalar
prev_s0 = s0;idiom from the internal spec, and they do not compile today.Examples to enable
C++ — vectorized cross-round, local-only (loop)
C++ — vectorized cross-round with reference parameter
Current Behavior
Compilation fails
Expected Behavior
Program compiles and runs successfully.
Prior work
#4573 attempted to fix by using shallow copy semantics, but, was generating wrong IR.