Skip to content

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

@khalatepradnya

Description

@khalatepradnya

Required prerequisites

  • 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:
  • 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#371.
      • 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.

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions