Skip to content

Commit f1f6be4

Browse files
WIP
Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
1 parent ad97418 commit f1f6be4

11 files changed

Lines changed: 148 additions & 74 deletions

File tree

cudaq/test/AST-Quake/measure_handle_qir.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ struct ScalarReturn {
2323
// CHECK-LABEL: func.func @__nvqpp__mlirgen__ScalarReturn() -> i1
2424
// CHECK: %[[VAL_Q:.*]] = call @__quantum__rt__qubit_allocate()
2525
// CHECK: call @__quantum__qis__h(%[[VAL_Q]])
26-
// CHECK: %[[VAL_R:.*]] = call @__quantum__qis__mz(%[[VAL_Q]]) {{.*}} -> !cc.ptr<!llvm.struct<"Result", opaque>>
27-
// CHECK: %[[VAL_I:.*]] = cc.cast %[[VAL_R]] : (!cc.ptr<!llvm.struct<"Result", opaque>>) -> i64
26+
// CHECK: %[[VAL_I:.*]] = call @__quantum__qis__mz_handle__to__register(%[[VAL_Q]], {{.*}}) {{.*}} -> i64
2827
// CHECK: %[[VAL_S:.*]] = cc.alloca i64
2928
// CHECK: cc.store %[[VAL_I]], %[[VAL_S]] : !cc.ptr<i64>
3029
// CHECK: %[[VAL_L:.*]] = cc.load %[[VAL_S]] : !cc.ptr<i64>
31-
// CHECK: %[[VAL_P:.*]] = cc.cast %[[VAL_L]] : (i64) -> !cc.ptr<i1>
32-
// CHECK: %[[VAL_B:.*]] = cc.load %[[VAL_P]] : !cc.ptr<i1>
30+
// CHECK: %[[VAL_P:.*]] = cc.cast %[[VAL_L]] : (i64) -> !cc.ptr<!llvm.struct<"Result", opaque>>
31+
// CHECK: %[[VAL_B:.*]] = call @__quantum__qis__read_result__body(%[[VAL_P]]) : (!cc.ptr<!llvm.struct<"Result", opaque>>) -> i1
3332
// CHECK: return %[[VAL_B]] : i1
3433
// CHECK: }
3534

@@ -52,9 +51,9 @@ struct VectorReturn {
5251
// CHECK: cc.loop while
5352
// CHECK: %[[V_QP2:.*]] = func.call @__quantum__rt__array_get_element_ptr_1d(%[[V_ARR]], %{{.*}})
5453
// CHECK: %[[V_Q2:.*]] = cc.load %[[V_QP2]]
55-
// CHECK: %[[V_R:.*]] = func.call @__quantum__qis__mz(%[[V_Q2]]){{.*}}!llvm.struct<"Result"
56-
// CHECK: %[[V_RP:.*]] = cc.cast %[[V_R]] : (!cc.ptr<!llvm.struct<"Result", opaque>>) -> !cc.ptr<i1>
57-
// CHECK: %[[V_B:.*]] = cc.load %[[V_RP]]
54+
// CHECK: %[[V_R:.*]] = func.call @__quantum__qis__mz_handle__to__register(%[[V_Q2]], {{.*}}) {{.*}} -> i64
55+
// CHECK: %[[V_RP:.*]] = cc.cast %[[V_R]] : (i64) -> !cc.ptr<!llvm.struct<"Result", opaque>>
56+
// CHECK: %[[V_B:.*]] = func.call @__quantum__qis__read_result__body(%[[V_RP]]) : (!cc.ptr<!llvm.struct<"Result", opaque>>) -> i1
5857
// CHECK: %[[V_SP:.*]] = cc.compute_ptr %[[V_BUF]][%{{.*}}]
5958
// CHECK: %[[V_BB:.*]] = cc.cast unsigned %[[V_B]] : (i1) -> i8
6059
// CHECK: cc.store %[[V_BB]], %[[V_SP]]

cudaq/test/AST-Quake/qalloc_initialization.cpp

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -478,8 +478,9 @@ __qpu__ bool Peppermint() {
478478
// QIR: call void @__quantum__qis__h(ptr %[[VAL_24]])
479479
// QIR: %[[VAL_31:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_11]], i64 %{{.*}})
480480
// QIR: %[[VAL_32:.*]] = load ptr, ptr %[[VAL_31]]
481-
// QIR: %[[VAL_33:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_32]])
482-
// QIR: %[[VAL_36:.*]] = load i1, ptr %[[VAL_33]]
481+
// QIR: %[[VAL_33:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_32]], ptr nonnull @cstr.00)
482+
// QIR: %[[VAL_33_PTR:.*]] = inttoptr i64 %[[VAL_33]] to ptr
483+
// QIR: %[[VAL_36:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_33_PTR]])
483484
// QIR: %[[VAL_41:.*]] = call ptr @malloc(i64 %[[VAL_13]])
484485
// QIR: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}%[[VAL_41]], ptr nonnull {{.*}}%{{.*}}, i64 %[[VAL_13]], i1 false)
485486
// QIR: %[[VAL_43:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_41]], 0
@@ -513,8 +514,9 @@ __qpu__ bool Peppermint() {
513514
// QIR: call void @__quantum__qis__h(ptr %[[VAL_24]])
514515
// QIR: %[[VAL_31:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_11]], i64 %{{.*}})
515516
// QIR: %[[VAL_32:.*]] = load ptr, ptr %[[VAL_31]]
516-
// QIR: %[[VAL_33:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_32]])
517-
// QIR: %[[VAL_36:.*]] = load i1, ptr %[[VAL_33]]
517+
// QIR: %[[VAL_33:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_32]], ptr nonnull @cstr.00)
518+
// QIR: %[[VAL_33_PTR:.*]] = inttoptr i64 %[[VAL_33]] to ptr
519+
// QIR: %[[VAL_36:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_33_PTR]])
518520
// QIR: %[[VAL_41:.*]] = call ptr @malloc(i64 %[[VAL_13]])
519521
// QIR: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}%[[VAL_41]], ptr nonnull {{.*}}%{{.*}}, i64 %[[VAL_13]], i1 false)
520522
// QIR: %[[VAL_43:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_41]], 0
@@ -564,8 +566,9 @@ __qpu__ bool Peppermint() {
564566
// QIR: call void @__quantum__qis__h(ptr %[[VAL_45]])
565567
// QIR: %[[VAL_52:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_32]], i64 %{{.*}})
566568
// QIR: %[[VAL_53:.*]] = load ptr, ptr %[[VAL_52]]
567-
// QIR: %[[VAL_54:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_53]])
568-
// QIR: %[[VAL_57:.*]] = load i1, ptr %[[VAL_54]]
569+
// QIR: %[[VAL_54:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_53]], ptr nonnull @cstr.00)
570+
// QIR: %[[VAL_54_PTR:.*]] = inttoptr i64 %[[VAL_54]] to ptr
571+
// QIR: %[[VAL_57:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_54_PTR]])
569572
// QIR: %[[VAL_62:.*]] = call ptr @malloc(i64 %[[VAL_34]])
570573
// QIR: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}%[[VAL_62]], ptr nonnull {{.*}}%{{.*}}, i64 %[[VAL_34]], i1 false)
571574
// QIR: %[[VAL_64:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_62]], 0
@@ -594,8 +597,9 @@ __qpu__ bool Peppermint() {
594597
// QIR: call void @__quantum__qis__h(ptr %[[VAL_20]])
595598
// QIR: %[[VAL_22:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_9]], i64 0)
596599
// QIR: %[[VAL_23:.*]] = load ptr, ptr %[[VAL_22]]
597-
// QIR: %[[VAL_24:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_23]])
598-
// QIR: %[[VAL_27:.*]] = load i1, ptr %[[VAL_24]]
600+
// QIR: %[[VAL_24:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_23]], ptr nonnull @cstr.00)
601+
// QIR: %[[VAL_24_PTR:.*]] = inttoptr i64 %[[VAL_24]] to ptr
602+
// QIR: %[[VAL_27:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_24_PTR]])
599603
// QIR: call void @__quantum__rt__qubit_release_array(ptr %[[VAL_9]])
600604
// QIR: ret i1 %[[VAL_27]]
601605
// QIR: }
@@ -620,8 +624,9 @@ __qpu__ bool Peppermint() {
620624
// QIR: call void @__quantum__qis__h(ptr %[[VAL_20]])
621625
// QIR: %[[VAL_22:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_9]], i64 0)
622626
// QIR: %[[VAL_23:.*]] = load ptr, ptr %[[VAL_22]]
623-
// QIR: %[[VAL_24:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_23]])
624-
// QIR: %[[VAL_27:.*]] = load i1, ptr %[[VAL_24]]
627+
// QIR: %[[VAL_24:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_23]], ptr nonnull @cstr.00)
628+
// QIR: %[[VAL_24_PTR:.*]] = inttoptr i64 %[[VAL_24]] to ptr
629+
// QIR: %[[VAL_27:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_24_PTR]])
625630
// QIR: call void @__quantum__rt__qubit_release_array(ptr %[[VAL_9]])
626631
// QIR: ret i1 %[[VAL_27]]
627632
// QIR: }
@@ -646,8 +651,9 @@ __qpu__ bool Peppermint() {
646651
// QIR: call void @__quantum__qis__h(ptr %[[VAL_22]])
647652
// QIR: %[[VAL_29:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_9]], i64 %{{.*}})
648653
// QIR: %[[VAL_30:.*]] = load ptr, ptr %[[VAL_29]]
649-
// QIR: %[[VAL_31:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_30]])
650-
// QIR: %[[VAL_34:.*]] = load i1, ptr %[[VAL_31]]
654+
// QIR: %[[VAL_31:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_30]], ptr nonnull @cstr.00)
655+
// QIR: %[[VAL_31_PTR:.*]] = inttoptr i64 %[[VAL_31]] to ptr
656+
// QIR: %[[VAL_34:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_31_PTR]])
651657
// QIR: %[[VAL_39:.*]] = call ptr @malloc(i64 %[[VAL_11]])
652658
// QIR: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}%[[VAL_39]], ptr nonnull {{.*}}%{{.*}}, i64 %[[VAL_11]], i1 false)
653659
// QIR: %[[VAL_41:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_39]], 0
@@ -676,8 +682,9 @@ __qpu__ bool Peppermint() {
676682
// QIR: call void @__quantum__qis__h(ptr %[[VAL_22]])
677683
// QIR: %[[VAL_29:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_9]], i64 %{{.*}})
678684
// QIR: %[[VAL_30:.*]] = load ptr, ptr %[[VAL_29]]
679-
// QIR: %[[VAL_31:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_30]])
680-
// QIR: %[[VAL_34:.*]] = load i1, ptr %[[VAL_31]]
685+
// QIR: %[[VAL_31:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_30]], ptr nonnull @cstr.00)
686+
// QIR: %[[VAL_31_PTR:.*]] = inttoptr i64 %[[VAL_31]] to ptr
687+
// QIR: %[[VAL_34:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_31_PTR]])
681688
// QIR: %[[VAL_39:.*]] = call ptr @malloc(i64 %[[VAL_11]])
682689
// QIR: call void @llvm.memcpy.p0.p0.i64(ptr {{.*}}%[[VAL_39]], ptr nonnull {{.*}}%{{.*}}, i64 %[[VAL_11]], i1 false)
683690
// QIR: %[[VAL_41:.*]] = insertvalue { ptr, i64 } undef, ptr %[[VAL_39]], 0
@@ -696,8 +703,9 @@ __qpu__ bool Peppermint() {
696703
// QIR: call void @__nvqpp_cudaq_state_delete(ptr %[[VAL_4]])
697704
// QIR: %[[VAL_7:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_5]], i64 0)
698705
// QIR: %[[VAL_9:.*]] = load ptr, ptr %[[VAL_7]]
699-
// QIR: %[[VAL_10:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_9]])
700-
// QIR: %[[VAL_13:.*]] = load i1, ptr %[[VAL_10]]
706+
// QIR: %[[VAL_10:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_9]], ptr nonnull @cstr.00)
707+
// QIR: %[[VAL_10_PTR:.*]] = inttoptr i64 %[[VAL_10]] to ptr
708+
// QIR: %[[VAL_13:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_10_PTR]])
701709
// QIR: call void @__quantum__rt__qubit_release_array(ptr %[[VAL_5]])
702710
// QIR: ret i1 %[[VAL_13]]
703711
// QIR: }
@@ -712,8 +720,9 @@ __qpu__ bool Peppermint() {
712720
// QIR: call void @__nvqpp_cudaq_state_delete(ptr %[[VAL_4]])
713721
// QIR: %[[VAL_7:.*]] = call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_5]], i64 0)
714722
// QIR: %[[VAL_9:.*]] = load ptr, ptr %[[VAL_7]]
715-
// QIR: %[[VAL_10:.*]] = call ptr @__quantum__qis__mz(ptr %[[VAL_9]])
716-
// QIR: %[[VAL_13:.*]] = load i1, ptr %[[VAL_10]]
723+
// QIR: %[[VAL_10:.*]] = call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_9]], ptr nonnull @cstr.00)
724+
// QIR: %[[VAL_10_PTR:.*]] = inttoptr i64 %[[VAL_10]] to ptr
725+
// QIR: %[[VAL_13:.*]] = call i1 @__quantum__qis__read_result__body(ptr %[[VAL_10_PTR]])
717726
// QIR: call void @__quantum__rt__qubit_release_array(ptr %[[VAL_5]])
718727
// QIR: ret i1 %[[VAL_13]]
719728
// QIR: }

cudaq/test/AST-Quake/qir_profiles.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,13 +325,13 @@ struct comprehensive {
325325
// FULL: tail call void (i64, i64, i64, i64, ptr, ...) @generalizedInvokeWithRotationsControlsTargets(i64 0, i64 0, i64 2, i64 1, ptr nonnull @__quantum__qis__x__ctl, ptr %[[VAL_14]], ptr %[[VAL_12]], ptr %[[VAL_8]])
326326
// FULL: tail call void (i64, i64, i64, i64, ptr, ...) @generalizedInvokeWithRotationsControlsTargets(i64 3, i64 0, i64 1, i64 1, ptr nonnull @__quantum__qis__u3__ctl, double 6.200000e+00, double -3.100000e+00, double 0x401F333333333333, ptr %[[VAL_8]], ptr %[[VAL_10]])
327327
// FULL: tail call void (i64, i64, i64, i64, ptr, ...) @generalizedInvokeWithRotationsControlsTargets(i64 0, i64 0, i64 2, i64 1, ptr nonnull @__quantum__qis__x__ctl, ptr %[[VAL_14]], ptr %[[VAL_12]], ptr %[[VAL_8]])
328-
// FULL: %[[VAL_23:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_10]], ptr nonnull @cstr.73696E676C65746F6E00)
329-
// FULL: %[[VAL_25:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_22]], ptr nonnull @cstr.65696E7300)
330-
// FULL: %[[VAL_26:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_18]], ptr nonnull @cstr.64756200)
331-
// FULL: %[[VAL_27:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_20]], ptr nonnull @cstr.64756200)
332-
// FULL: %[[VAL_28:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_12]], ptr nonnull @cstr.7472697000)
333-
// FULL: %[[VAL_29:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_14]], ptr nonnull @cstr.7472697000)
334-
// FULL: %[[VAL_30:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_16]], ptr nonnull @cstr.7472697000)
328+
// FULL: %[[VAL_23:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_10]], ptr nonnull @cstr.73696E676C65746F6E00)
329+
// FULL: %[[VAL_25:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_22]], ptr nonnull @cstr.65696E7300)
330+
// FULL: %[[VAL_26:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_18]], ptr nonnull @cstr.64756200)
331+
// FULL: %[[VAL_27:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_20]], ptr nonnull @cstr.64756200)
332+
// FULL: %[[VAL_28:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_12]], ptr nonnull @cstr.7472697000)
333+
// FULL: %[[VAL_29:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_14]], ptr nonnull @cstr.7472697000)
334+
// FULL: %[[VAL_30:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_16]], ptr nonnull @cstr.7472697000)
335335
// FULL: tail call void @__quantum__rt__qubit_release_array(ptr %[[VAL_0]])
336336
// FULL: ret void
337337
// FULL: }

cudaq/test/AST-Quake/to_qir.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ struct kernel {
4444
// CHECK: %[[VAL_8:.*]] = load ptr, ptr %[[VAL_7]], align 8
4545
// CHECK: tail call void (i64, i64, i64, i64, ptr, ...) @generalizedInvokeWithRotationsControlsTargets(i64 0, i64 0, i64 1, i64 1, ptr nonnull @__quantum__qis__x__ctl, ptr %[[VAL_8]], ptr %[[VAL_4]])
4646
// CHECK: tail call void @__quantum__qis__h(ptr %[[VAL_8]])
47-
// CHECK: %[[VAL_9:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_8]], ptr nonnull @cstr.623000)
48-
// CHECK: %[[VAL_11:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_4]], ptr nonnull @cstr.623100)
49-
// CHECK: %[[VAL_12:.*]] = load i1, ptr %[[VAL_11]], align 1
47+
// CHECK: %[[VAL_9:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_8]], ptr nonnull @cstr.623000)
48+
// CHECK: %[[VAL_11:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_4]], ptr nonnull @cstr.623100)
49+
// CHECK: %[[VAL_11_PTR:.*]] = inttoptr i64 %[[VAL_11]] to ptr
50+
// CHECK: %[[VAL_12:.*]] = tail call i1 @__quantum__qis__read_result__body(ptr %[[VAL_11_PTR]])
5051
// CHECK: br i1 %[[VAL_12]], label %[[VAL_14:.*]], label %[[VAL_15:.*]]
5152
// CHECK: {{[0-9]+}}:
5253
// CHECK: tail call void @__quantum__qis__x(ptr %[[VAL_6]])
5354
// CHECK: br label %[[VAL_15]]
5455
// CHECK: {{[0-9]+}}:
55-
// CHECK: %[[VAL_10:.*]] = load i1, ptr %[[VAL_9]], align 1
56+
// CHECK: %[[VAL_9_PTR:.*]] = inttoptr i64 %[[VAL_9]] to ptr
57+
// CHECK: %[[VAL_10:.*]] = tail call i1 @__quantum__qis__read_result__body(ptr %[[VAL_9_PTR]])
5658
// CHECK: br i1 %[[VAL_10]], label %[[VAL_18:.*]], label %[[VAL_19:.*]]
5759
// CHECK: {{[0-9]+}}:
5860
// CHECK: tail call void @__quantum__qis__z(ptr %[[VAL_6]])

cudaq/test/Transforms/qir_api_measure_handle.qke

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
// RUN: cudaq-opt --convert-to-qir-api %s | FileCheck %s
1010
// RUN: cudaq-opt --convert-to-qir-api -canonicalize %s | FileCheck --check-prefix=CHECK-E2E %s
11+
// RUN: cudaq-opt "--convert-to-qir-api=api=adaptive-profile:1.0 opaque-pointer=true" %s | FileCheck --check-prefix=ADAPT %s
1112

1213
// The module-level `llvm.data_layout` is what `FuseCastCascade` consults to
1314
// gate the `ptr -> int -> ptr` fold; bridge-emitted modules always carry
1415
// the attribute, hand-typed lit modules opt in here so the canonicalizer
1516
// can collapse the legitimate `Result* -> i64 -> ptr<i1>` chain.
17+
1618
module attributes {llvm.data_layout = "e-p:64:64"} {
1719

1820
// -----
@@ -31,6 +33,10 @@ func.func @scalar_handle() -> i1 attributes {"cudaq-entrypoint", "cudaq-kernel"}
3133
// CHECK: %[[VAL_R:.*]] = cc.cast %[[VAL_H]] : (i64) -> !cc.ptr<!llvm.struct<"Result", opaque>>
3234
// CHECK: %[[VAL_B:.*]] = call @__quantum__qis__read_result__body(%[[VAL_R]]) : (!cc.ptr<!llvm.struct<"Result", opaque>>) -> i1
3335
// CHECK: return %[[VAL_B]] : i1
36+
// ADAPT-LABEL: func.func @scalar_handle() -> i1
37+
// ADAPT: call @__quantum__qis__mz__body({{.*}}) {{.*}} : (!cc.ptr<none>, !cc.ptr<none>) -> ()
38+
// ADAPT: %[[VAL_B:.*]] = call @__quantum__rt__read_result({{.*}}) : (!cc.ptr<none>) -> i1
39+
// ADAPT: return %[[VAL_B]] : i1
3440

3541
// -----
3642
// Function signatures with handle parameter and return.
@@ -188,5 +194,9 @@ func.func @scalar_handle_e2e() -> i1 attributes {"cudaq-entrypoint", "cudaq-kern
188194
// CHECK-E2E: %[[VAL_B:.*]] = call @__quantum__qis__read_result__body(%[[VAL_R]]) : (!cc.ptr<!llvm.struct<"Result", opaque>>) -> i1
189195
// CHECK-E2E-NOT: cc.load
190196
// CHECK-E2E: return %[[VAL_B]] : i1
197+
// ADAPT-LABEL: func.func @scalar_handle_e2e() -> i1
198+
// ADAPT: %[[VAL_B:.*]] = call @__quantum__rt__read_result({{.*}}) : (!cc.ptr<none>) -> i1
199+
// ADAPT-NOT: cc.load
200+
// ADAPT: return %[[VAL_B]] : i1
191201

192202
}

cudaq/test/Translate/init_state.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct kernel {
3333
// CHECK: %[[VAL_9:.*]] = phi i64 [ %[[VAL_10:.*]], %[[VAL_6]] ], [ 0, %[[VAL_8]] ]
3434
// CHECK: %[[VAL_11:.*]] = tail call ptr @__quantum__rt__array_get_element_ptr_1d(ptr %[[VAL_2]], i64 %[[VAL_9]])
3535
// CHECK: %[[VAL_13:.*]] = load ptr, ptr %[[VAL_11]], align 8
36-
// CHECK: %[[VAL_14:.*]] = tail call ptr @__quantum__qis__mz__to__register(ptr %[[VAL_13]], ptr nonnull @cstr.726573756C7400)
36+
// CHECK: %[[VAL_14:.*]] = tail call i64 @__quantum__qis__mz_handle__to__register(ptr %[[VAL_13]], ptr nonnull @cstr.726573756C7400)
3737
// CHECK: %[[VAL_10]] = add nuw nsw i64 %[[VAL_9]], 1
3838
// CHECK: %[[VAL_16:.*]] = icmp eq i64 %[[VAL_10]], %[[VAL_4]]
3939
// CHECK: br i1 %[[VAL_16]], label %[[VAL_7]], label %[[VAL_6]]

python/extension/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ target_include_directories(CUDAQuantumPythonSources.Extension INTERFACE
172172
)
173173
target_link_libraries(CUDAQuantumPythonSources.Extension INTERFACE
174174
cudaq
175-
cudaq-analysis
176175
cudaq-logger
177176
cudaq-common
178177
cudaq-em-default

runtime/cudaq/analysis/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# DEM (Detector Error Model) analysis primitive. Implemented in its own
1010
# shared library because `Dem.cpp` includes Stim's headers and links
11-
# `libstim`. Linking `nvqir` privately gives `Dem.cpp` direct use of
11+
# `libstim`. Linking `nvqir` privately gives `Dem.cpp` direct use of
1212
# `nvqir::AnalysisScope` and access to the scope factory `dem::make_scope`.
1313
add_library(cudaq-analysis SHARED Dem.cpp)
1414
set_property(GLOBAL APPEND PROPERTY CUDAQ_RUNTIME_LIBS cudaq-analysis)

0 commit comments

Comments
 (0)