Skip to content

Gradient dialect removes qnode attribute from quantum functions when creating helper functions. #419

Open
@erick-xanadu

Description

@erick-xanadu
  • Expected behavior: The attribute remains through the lowering of gradient and quantum dialect up until LLVM-IR (in which case we might wish to annotate it with some metadata).

  • Actual behavior: The gradient transforms generates helper functions which will strip the qnode attribute from qnodes. E.g.,

  func.func private @f(%arg0: tensor<f64>) -> tensor<f64> attributes {diff_method = "parameter-shift", llvm.linkage = #llvm.linkage<internal>, qnode} {
  }

Changes to:

  func.func private @f.quantum(%arg0: memref<f64>, %arg1: memref<?xf64>) -> memref<f64> attributes {gradient.qgrad = @f.qgrad, passthrough = ["noinline"]} {
}

This causes async to not be triggered since async looks for the qnode attribute.

  • Reproduces how often: Always

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompilerPull requests that update the compilergood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions