NVIDIA / NVIDIA/cuda-quantum

Support additional numpy functions in python mlir

Open
#1,455 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement python-lang stale-notified
Dominant language
C++
Stars
1.1k
Forks
456
Avg merge
1d 22h
Merged PRs (30d)
165

Description

Required prerequisites
  • Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature

Support using the following numpy functions in quantum kernels:

  • abs
  • arcsin
@cudaq.kernel
def kernel():
   x = np.abs(1.0j)
   ang = np.arcsin(0.0)

Currently raises the error:

cudaq.kernel.ast_bridge.CompilerError: ampitude_estimation.py:39: error: unsupported NumPy call (abs)
         (offending source -> np.abs(np.sqrt(a_value)))

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Python MLIR handling for NumPy calls and the existing support checks for quantum kernels. Use the provided np.abs and np.arcsin kernel examples to reproduce the unsupported-call errors, then verify both functions compile successfully without those errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.