Open khalatepradnya opened 8 months ago
Specifically, I'm not entirely sure what the following code's intended semantics is.
cudaq_register_op("custom_h",
{{M_SQRT1_2, M_SQRT1_2}, {M_SQRT1_2, -M_SQRT1_2}});
cudaq_register_op("custom_x", {{0, 1}, {1, 0}});
These are calls? Macros? What exactly is being registered? And with what?
These aren't marked as __qpu__
code so will be entirely opaque to the compiler at first blush. Hence, the compiler cannot generate quake code for them.
Second order question: it may be possible for the compiler to take a constant matrix here and generate a gate list (approximation) from those values. Or perhaps this should be generated entirely in the control hardware at QIR time? And what about the synthesis case? If the compiler is going to generate the gate list, it stands to reason that it will need to do so at synthesis-time. And that affects the IR, which would need to support dynamic matrix specifications that can be instantiated by the synthesizer.
These are calls? Macros? What exactly is being registered? And with what?
Macros. Updated the code snippet in description.
Will this PR provide unitary decomposition like what qiskit's transpile
does?
https://github.com/NVIDIA/cuda-quantum/pull/1781
Will this PR provide unitary decomposition like what qiskit's
transpile
does? #1781
Conceptually, yes. However, the synthesis mechanism and target gateset will be implicit in this iteration.
Question. I am trying to compare the depth of cuda-quantum's implementation of QSD (I assume it's QSD) vs Qiskit's implementation. May I ask how I can see the depth of the circuit in terms of U3 and CX gates?
Question. I am trying to compare the depth of cuda-quantum's implementation of QSD (I assume it's QSD) vs Qiskit's implementation. May I ask how I can see the depth of the circuit in terms of U3 and CX gates?
Thank you for the question. This feature is not yet available in CUDA-Q. I will update this issue when it becomes available.
Describe the feature
Problem
Given a user provided arbitrary quantum unitary, synthesize it into a sequence of quantum gates.
Expectations
User API
cudaq.register_operation("custom_h", 1. / np.sqrt(2.) * np.array([[1, 1], [1, -1]])) cudaq.register_operation("custom_x", np.array([[0, 1], [1, 0]]))
@cudaq.kernel def bell(): qubits = cudaq.qvector(2) custom_h(qubits[0]) custom_x.ctrl(qubits[0], qubits[1])
counts = cudaq.sample(bell) counts.dump()
// Macro to specify the custom unitary operation cudaq_register_operation(custom_h, 1, 0, (std::vector<std::vector<std::complex>>{
{M_SQRT1_2, M_SQRT1_2}, {M_SQRT1_2, -M_SQRT1_2}}));
cudaq_register_operation(
custom_x, 1, 0, (std::vector<std::vector<std::complex>>{{0, 1}, {1, 0}}));
void custom_operation() qpu { cudaq::qvector qubits(2); custom_h(qubits[0]); custom_x.ctrl(qubits[0], qubits[1]); }
int main() { auto result = cudaq::sample(custom_operation); std::cout << result.most_probable() << '\n'; return 0; }