Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] The AST bridge accepts anything that has the components of cudaq.dbg.ast as a call to it #2342

Open
3 of 4 tasks
boschmitt opened this issue Nov 1, 2024 · 0 comments

Comments

@boschmitt
Copy link
Collaborator

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

Seems like the python AST bridge is a bit too lax in identifying calls to cudaq.dbg.ast. Or is it cudaq.ast.dbg? Currently, it doesn't matter, as long as there is cudaq, ast and dbg, anything goes. Perhaps someone can argue that this is a feature.

Steps to reproduce the bug

import cudaq

@cudaq.kernel
def simple(n: int):
    q = cudaq.qvector(n)
    cudaq.dbg.ast.print_i64(n)
    dbg.cudaq.ast.print_i64(n)
    dbg.ast.cudaq.print_i64(n)
    ast.dbg.cudaq.print_i64(n)
    ast.cudaq.dbg.print_i64(n)
    ast.cudaq.dbg.whatever.i.can.put.almost.ANYTHING.print_i64(n)

counts = cudaq.sample(simple, 10)
print(counts)

Result:

[cudaq-ast-dbg] 10
[cudaq-ast-dbg] 10
[cudaq-ast-dbg] 10
[cudaq-ast-dbg] 10
[cudaq-ast-dbg] 10
[cudaq-ast-dbg] 10
{ 0000000000:1000 }

Expected behavior

Only accept cudaq.dbg.ast

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

Not a regression

Environment

Suggestions

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant