cuda-quantum icon indicating copy to clipboard operation
cuda-quantum copied to clipboard

[custom op] Support unitary synthesis for 3+ qubit operations

Open khalatepradnya opened this issue 4 months ago • 0 comments

Required prerequisites

  • [x] Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.

Describe the feature

Relates to issue #1475

Description

CUDA-Q implements a unitary-synthesis pass defined here. As of October 1, 2024, this pass supports decomposition of 1-qubit and 2-qubit custom operations.

Extend this pass by implementing 3-qubit operation synthesis.

Steps:

  • Choose an appropriate algorithm. Following references can be considered:
    • Cosine-sine decomposition: https://arxiv.org/pdf/quant-ph/0404089
    • Quantum Shannon decomposition: https://arxiv.org/pdf/quant-ph/0406176
  • Extend the Decomposer class with new class which implements the 3-qubit decomposition.
  • Override decompose method which encapsulates the logic for decomposition, and
  • Override emitDecomposedFuncOp method which translates the result into native gate set.
  • Update caller switch case here. For example,
case 8: {
       auto csd = ThreeQubitOpCSD(unitary);   // rename according to the chosen algorithm
       csd.emitDecomposedFuncOp(customOp, rewriter, funcName);
     } break;
  • Can reuse the OneQubitOpZYZ defined here for any 1-q decomposition.
  • Following tests should now pass:
    • Python: here
      • Remove with pytest.raises(RuntimeError): and directly invoke sample on line#306.
      • To run, python3 -m pytest -rP ../python/tests/backends/test_Quantinuum_LocalEmulation_kernel.py::test_3q_unitary_synthesis
    • C++: here
      • To run, nvq++ --target quantinuum --emulate targettests/execution/custom_operation_toffoli.cpp && ./a.out
  • Additional test(s) with random 8x8 unitary matrices should be added.

khalatepradnya avatar Oct 01 '24 20:10 khalatepradnya