Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cudaq/lib/Optimizer/Dialect/Quake/QuakeOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ LogicalResult cudaq::quake::verifyWireArityAndCoarity(Operation *op) {
}

bool cudaq::quake::isSupportedMappingOperation(Operation *op) {
return isa<OperatorInterface, MeasurementInterface, SinkOp, ReturnWireOp>(op);
return isa<OperatorInterface, MeasurementInterface, ResetOp, SinkOp,
ReturnWireOp>(op);
}

ValueRange cudaq::quake::getQuantumTypesFromRange(ValueRange range) {
Expand Down
26 changes: 26 additions & 0 deletions cudaq/test/Transforms/mapping_reset.qke
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ========================================================================== //
// Copyright (c) 2022 - 2026 NVIDIA Corporation & Affiliates. //
// All rights reserved. //
// //
// This source code and the accompanying materials are made available under //
// the terms of the Apache License 2.0 which accompanies this distribution. //
// ========================================================================== //

// RUN: cudaq-opt --qubit-mapping=device=path\(3\) %s | FileCheck %s

quake.wire_set @wires[2147483647]

func.func @test_reset() {
%0 = quake.borrow_wire @wires[0] : !quake.wire
%1 = quake.reset %0 : (!quake.wire) -> !quake.wire
quake.return_wire %1 : !quake.wire
return
}

// CHECK-LABEL: func.func @test_reset() attributes {mapping_reorder_idx = [0], mapping_v2p = [0]} {
// CHECK: %[[VAL_0:.*]] = quake.borrow_wire @mapped_wireset
// CHECK: %[[VAL_1:.*]] = quake.reset %[[VAL_0]] : (!quake.wire) -> !quake.wire
// CHECK: %[[VAL_2:.*]], %[[VAL_3:.*]] = quake.mz %[[VAL_1]] : (!quake.wire) -> (!quake.measure, !quake.wire)
// CHECK: quake.return_wire %[[VAL_3]] : !quake.wire
// CHECK: return
// CHECK: }
Loading