Skip to content

New launch kernel is not invoked for python #2299

@annagrin

Description

@annagrin

Required prerequisites

  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

Describe the bug

Python code using states as arguments fails to synthesize on quantum targets and remote sim due to the new launch kernel not being invoked (old synthesis message is displayed)

Steps to reproduce the bug

Code

# RUN: PYTHONPATH=../../.. python3 %s --target  --remote-mqpu
# RUN: PYTHONPATH=../../.. python3 %s --target  --quantinuum --emulate

import cudaq
import numpy as np
def test_init_from_data_state():
    c = np.array([1. / np.sqrt(2.) + 0j, 1. / np.sqrt(2.), 0., 0.],
                 dtype=np.complex128)
    state = cudaq.State.from_data(c)
    @cudaq.kernel
    def kernel(vec: cudaq.State):
        q = cudaq.qvector(vec)
    counts = cudaq.sample(kernel, state)
    assert '10' in counts
    assert '00' in counts
test_init_from_data_state()

def test_init_from_state():
    @cudaq.kernel
    def init(n: int):
        q = cudaq.qvector(n)
        ry(np.pi/2.0, q[0])
    @cudaq.kernel
    def kernel(vec: cudaq.State):
        q = cudaq.qvector(vec)
    state = cudaq.get_state(init, 2)
    counts = cudaq.sample(kernel, state)
    assert '10' in counts
    assert '00' in counts
test_init_from_state()

Output

root@f4bab51c0fb2:/workspaces/cuda-quantum# python3 python/tests/mlir/target/tmp.py --target quantinuum
error: 'func.func' op synthesis: unsupported argument type for remote devices and simulators: state*
error: 'func.func' op We cannot synthesize argument(s) of this type.
RuntimeError: Could not successfully apply quake-synth.

Expected behavior

For remote sim, the code should run successfully. For quantinuum, the code should run successfully after #2291

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

  • CUDA Quantum version:
  • Python version:
  • C++ compiler:
  • Operating system:

Suggestions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions