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

Support cudaq::exp_pauli for quantum devices #2222

Open
1 task done
annagrin opened this issue Sep 19, 2024 · 0 comments · May be fixed by #2226
Open
1 task done

Support cudaq::exp_pauli for quantum devices #2222

annagrin opened this issue Sep 19, 2024 · 0 comments · May be fixed by #2226
Assignees
Labels
enhancement New feature or request

Comments

@annagrin
Copy link
Collaborator

Required prerequisites

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

Describe the feature

Description

Currently using exp_pauli on quantum devices fails with the following error:

loc("tmp.cpp":26:5): error: failed to legalize operation 'quake.exp_pauli'
// -----// IR Dump After BasisConversionPass Failed (basis-conversion) ('builtin.module' operation) //----- //
module attributes {llvm.data_layout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", llvm.triple = "x86_64-unknown-linux-gnu", quake.mangled_name_map = {__nvqpp__mlirgen__function_test_state_param._Z16test_state_paramN5cudaq10pauli_wordE = "_Z16test_state_paramN5cudaq10pauli_wordE"}} {
  func.func @__nvqpp__mlirgen__function_test_state_param._Z16test_state_paramN5cudaq10pauli_wordE() attributes {"cudaq-entrypoint", "cudaq-kernel", no_this} {
    %cst = arith.constant 1.000000e+00 : f64
    %cst_0 = arith.constant 1.5707963267948966 : f64
    %c2_i64 = arith.constant 2 : i64
    %0 = cc.address_of @cstr.585900 : !cc.ptr<!llvm.array<3 x i8>>
    %1 = cc.cast %0 : (!cc.ptr<!llvm.array<3 x i8>>) -> !cc.ptr<i8>
    %2 = cc.stdvec_init %1, %c2_i64 : (!cc.ptr<i8>, i64) -> !cc.charspan
    %3 = quake.alloca !quake.veq<2>
    %4 = quake.extract_ref %3[0] : (!quake.veq<2>) -> !quake.ref
    quake.ry (%cst_0) %4 : (f64, !quake.ref) -> ()
    quake.exp_pauli %cst, %3, %2 : (f64, !quake.veq<2>, !cc.charspan) -> ()
    return
  }
  llvm.mlir.global private constant @cstr.585900("XY\00") {addr_space = 0 : i32}
}


terminate called after throwing an instance of 'std::runtime_error'
  what():  Remote rest platform Quake lowering failed.
Aborted

Suggestion

Implement a compiler pass that converts the expression to gates similar to:
https://github.com/NVIDIA/cuda-quantum/blob/main/runtime/nvqir/CircuitSimulator.h#L135

@annagrin annagrin added the enhancement New feature or request label Sep 19, 2024
@annagrin annagrin self-assigned this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant