-
-
Notifications
You must be signed in to change notification settings - Fork 72
✨ Add Quantum IPO Pass to mqt-cc
#1970
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
base: main
Are you sure you want to change the base?
Changes from all commits
89f8ee3
6d4332d
1a7664c
770e55c
64b162c
137d93c
559c9ff
679f454
5510fe8
64cffab
df2301b
8ca81d6
c55987b
653a8f4
1611c1b
4a158fb
4d98606
2deb2a4
096075c
b1a24cd
b0d060d
7042e3b
58d10b9
febb216
6d4ce73
38bbc15
5e482a9
70de05f
102663b
91fe289
317ebfd
d392185
9253715
10b0f89
2c602ab
8955d72
d1e452a
03954f9
0e9dd2f
54eb424
ce1382a
d0332ee
e54135a
3e5d088
af18628
48d6b07
e9dc05e
9c68990
9059d90
e434323
84d6288
8b23850
8679a54
86f1e6f
7fd6d0a
65c913e
080d946
c6b3b4e
b1a677d
a2be2c6
adced7b
83a7141
52248ad
6f16166
ae6e9e0
eb195d4
316adb0
e48b036
49d9a41
ac46ece
495043b
8621ce0
b365d7b
aed55b4
26d39bd
0dd4d63
29b46cd
0926619
86b46a1
b1a0f81
59f08c4
f120dee
93dd0b7
faf464b
d8becff
ac6bf38
007ac4a
1db4a0f
e42e016
f4884d6
94ad151
edf23d8
9929601
86e0396
fd9b78c
facd700
bcb9c25
d58d93b
f8882f9
e558d11
4aca1d5
21c7b0f
014b2a0
f74f018
4c42236
8684556
8f31dce
3d0d086
69e3928
5aed242
cbcbb1f
41093d7
cd2940d
785d1f4
cfc98b4
eeedb33
9233f94
0c751f3
d6c515b
7ea2b70
306a709
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ | |
|
|
||
| #pragma once | ||
|
|
||
| #include <mlir/IR/BuiltinOps.h> | ||
| #include <mlir/Interfaces/FunctionInterfaces.h> | ||
| #include <mlir/Pass/Pass.h> | ||
| #include <mlir/Pass/PassRegistry.h> | ||
|
|
@@ -33,6 +34,10 @@ namespace mlir::qco { | |
| #define GEN_PASS_REGISTRATION | ||
| #include "mlir/Dialect/QCO/Transforms/Passes.h.inc" // IWYU pragma: export | ||
|
|
||
| void runQuantumArgumentPromotion(ModuleOp module); | ||
| void runAuxiliaryQubitHoisting(ModuleOp module); | ||
| void runQuantumFunctionBoundaryCommutation(ModuleOp module, | ||
| SymbolTable& symbolTable); | ||
|
Comment on lines
+37
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Based on coding guidelines: "Do not use 📍 Affects 4 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| /** | ||
| * @brief Create target-independent two-qubit gate fusion. | ||
| */ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -305,6 +305,18 @@ def ReuseQubits : Pass<"reuse-qubits", "mlir::ModuleOp"> { | |||||||||||||||||||||||||||||||||||||||||||||||||
| }]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def QuantumIPO : Pass<"quantum-ipo", "mlir::ModuleOp"> { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let summary = "Quantum Interprocedural Optimization Pass"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| let description = [{ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Performs interprocedural optimizations on quantum functions. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+309
to
+312
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Expand the The description is one generic sentence. The pass runs four distinct transformations: context-sensitive call specialization, quantum argument promotion, auxiliary-qubit hoisting, and function-boundary commutation. It also has real limitations that a user cannot discover from this text:
Every neighbouring pass in this file documents scope and limitations at this level. Also align the description indentation with the surrounding passes. As per coding guidelines: "When changing MLIR passes, pipelines, or command-line options, align summaries and descriptions with actual scope, defaults, supported operation shapes, limitations, failure modes, and out-of-scope behavior." 📝 Proposed description skeleton def QuantumIPO : Pass<"quantum-ipo", "mlir::ModuleOp"> {
let summary = "Quantum Interprocedural Optimization Pass";
let description = [{
- Performs interprocedural optimizations on quantum functions.
- }];
+ Performs interprocedural optimizations across `func.func` boundaries by
+ running, in order:
+
+ - Context-sensitive specialization of `func.call` sites for recognized
+ qubit states and constant angles.
+ - Quantum argument promotion, turning eligible qubit-tensor arguments into
+ scalar qubit arguments.
+ - Auxiliary-qubit hoisting, moving callee-internal allocations to the
+ caller.
+ - Quantum function-boundary commutation, removing matching self-inverse
+ gates across a call.
+
+ Limitations: public functions and declarations are not transformed;
+ recursive functions are skipped; the pass relies on the QCO calling
+ convention that the i-th qubit result of a call corresponds to its i-th
+ qubit operand; boundary commutation runs a fixed number of iterations
+ rather than to a fixed point.
+ }];📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| let dependentDialects = ["::mlir::func::FuncDialect", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "::mlir::arith::ArithDialect", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "::mlir::qtensor::QTensorDialect", | ||||||||||||||||||||||||||||||||||||||||||||||||||
| "mlir::qco::QCODialect"]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| //===----------------------------------------------------------------------===// | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // Decomposition Passes | ||||||||||||||||||||||||||||||||||||||||||||||||||
| //===----------------------------------------------------------------------===// | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,10 +33,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <mlir/IR/Location.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <mlir/IR/MLIRContext.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <mlir/IR/OwningOpRef.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <mlir/IR/SymbolTable.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <mlir/IR/Value.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <mlir/IR/ValueRange.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <mlir/Support/LLVM.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <algorithm> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <cassert> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <cstddef> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #include <cstdint> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1374,6 +1376,171 @@ QCOProgramBuilder::scfCondition(Value reg, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return scfCondition(condition, yieldedValues); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //===----------------------------------------------------------------------===// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Additional Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //===----------------------------------------------------------------------===// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Type QCOProgramBuilder::getQubitType() { return QubitType::get(ctx); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Type QCOProgramBuilder::getQubitTensorType(const int64_t size) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return RankedTensorType::get({size}, getQubitType()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1385
to
+1387
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win Reject non-positive sizes in
Add the same guard so the failure points at the builder call. 🛡️ Proposed guard Type QCOProgramBuilder::getQubitTensorType(const int64_t size) {
+ if (size <= 0) {
+ llvm::reportFatalUsageError("Size must be positive");
+ }
return RankedTensorType::get({size}, getQubitType());
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bool QCOProgramBuilder::isQubitTensor(Type type) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const auto tensorType = dyn_cast<RankedTensorType>(type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return tensorType && isa<QubitType>(tensorType.getElementType()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SmallVector<Value> QCOProgramBuilder::startFunction(StringRef name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TypeRange argTypes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TypeRange resultTypes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checkFinalized(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (functionScope.has_value()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| llvm::reportFatalUsageError( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Cannot start a function while another one is being built"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FunctionScope scope{.savedInsertPoint = saveInsertionPoint(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .outerQubits = {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .outerTensors = {}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto& [qubit, info] : validQubits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scope.outerQubits.insert(qubit); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto& [tensor, info] : validTensors) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scope.outerTensors.insert(tensor); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setInsertionPointToEnd(cast<ModuleOp>(module).getBody()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto funcOp = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func::FuncOp::create(*this, name, getFunctionType(argTypes, resultTypes)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // The interprocedural passes only consider functions that are not externally | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // visible, so additional functions are private by default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| funcOp.setPrivate(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1414
to
+1419
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Description: Inspect startFunction callers and any existing symbol-uniqueness handling.
set -euo pipefail
# Find all startFunction call sites.
rg -nP -C4 '\bstartFunction\s*\(' --type=cpp --type=cc
# Check whether SymbolTable::insert is used anywhere in the QCO builder.
fd -t f 'QCOProgramBuilder.cpp' | xargs rg -nP -C3 'SymbolTable::(insert|lookupSymbolIn)'Repository: munich-quantum-toolkit/core Length of output: 196 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== QCOProgramBuilder outline =="
ast-grep outline mlir/lib/Dialect/QCO/Builder/QCOProgramBuilder.cpp --match startFunction --view expanded || true
echo "== startFunction definition =="
python3 - <<'PY'
from pathlib import Path
p=Path('mlir/lib/Dialect/QCO/Builder/QCOProgramBuilder.cpp')
lines=p.read_text().splitlines()
for i,l in enumerate(lines):
if 'startFunction' in lines[max(0,i-2):i+1]:
start=max(0,i-18)
end=min(len(lines),i+80)
print(f'-- lines {start+1}-{end} --')
for n in range(start,end):
print(f'{n+1:5}: {lines[n]}')
print()
PY
echo "== all startFunction call sites =="
rg -nP -C4 '\bstartFunction\s*\(' -g '*.{cc,cpp,cxx,h,hpp,hh}'
echo "== SymbolTable usage in QCOProgramBuilder =="
rg -nP -C3 'SymbolTable::(insert|lookupSymbolIn)' mlir/lib/Dialect/QCO/Builder/QCOProgramBuilder.cpp
echo "== uses of func::FuncOp::create =="
rg -nP -C2 'func::FuncOp::create|FuncOp::create' -g '*.{cc,cpp,cxx,h,hpp,hh}'Repository: munich-quantum-toolkit/core Length of output: 388 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== startFunction definition =="
python3 - <<'PY'
from pathlib import Path
p=Path('mlir/lib/Dialect/QCO/Builder/QCOProgramBuilder.cpp')
lines=p.read_text().splitlines()
for i,l in enumerate(lines):
if 'SmallVector<Value> QCOProgramBuilder::startFunction(StringRef name,' in l:
start=max(0,i-15)
end=min(len(lines),i+100)
print(f'-- lines {start+1}-{end} --')
for n in range(start,end):
print(f'{n+1:5}: {lines[n]}')
print()
PY
echo "== all startFunction call sites =="
rg -nP -C4 '\bstartFunction\s*\(' -g '*.cc' -g '*.cpp' -g '*.cxx' -g '*.h' -g '*.hpp' -g '*.hh' .
echo "== SymbolTable usage in QCOProgramBuilder =="
rg -nP -C3 'SymbolTable::(insert|lookupSymbolIn)' mlir/lib/Dialect/QCO/Builder/QCOProgramBuilder.cpp
echo "== uses of func::FuncOp::create =="
rg -nP -C2 'func::FuncOp::create|FuncOp::create' -g '*.cc' -g '*.cpp' -g '*.cxx' -g '*.h' -g '*.hpp' -g '*.hh' .Repository: munich-quantum-toolkit/core Length of output: 50386 🌐 Web query:
💡 Result: In MLIR, a SymbolTable manages operations that define symbols (e.g., func.func) [1][2]. To work with these symbols, you use the mlir::SymbolTable class and its associated static utility methods [3][4]. Creating and Managing a SymbolTable Operations that function as containers for symbols must implement the OpTrait::SymbolTable trait [1][2]. You can create an instance of the SymbolTable class by passing the operation that holds the symbols to its constructor [5][6]: mlir::SymbolTable symbolTable(symbolTableOp); Once the object is created, you can insert new symbol operations into the container [6]: symbolTable.insert(newSymbolOp); Looking Up Symbols The mlir::SymbolTable class provides static utility methods to look up symbols within an operation that has the SymbolTable trait [3][4]. These methods do not require you to explicitly instantiate a SymbolTable object [4][7]. The primary method is lookupSymbolIn, which returns the Operation* matching a given symbol name [3][4]. It is overloaded to accept different types of symbol identifiers [4]: Operation *op = mlir::SymbolTable::lookupSymbolIn(symbolTableOp, StringAttr::get(context, "symbol_name")); Operation *op = mlir::SymbolTable::lookupSymbolIn(symbolTableOp, "symbol_name"); Operation *op = mlir::SymbolTable::lookupSymbolIn(symbolTableOp, symbolRefAttr); Key Points: - Container Requirements: The container operation passed to lookupSymbolIn or the SymbolTable constructor must possess the OpTrait::SymbolTable trait [3][4][2]. - Symbol Requirements: The operations being looked up must satisfy the Symbol trait (e.g., having a sym_name attribute) [1][2]. - Efficiency: lookupSymbolIn is designed to efficiently resolve symbols within the region of the specified symbol table operation [1][6]. - SymbolRefAttr: If you need to resolve complex or nested symbol references (e.g., path-like references), use the version of lookupSymbolIn that accepts a SymbolRefAttr [4][8]. Citations:
Reject duplicate function names in
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto& entryBlock = funcOp.getBody().emplaceBlock(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const SmallVector<Location> locs(argTypes.size(), getLoc()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| entryBlock.addArguments(argTypes, locs); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| setInsertionPointToStart(&entryBlock); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SmallVector<Value> args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto arg : entryBlock.getArguments()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isa<QubitType>(arg.getType())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validQubits.try_emplace(arg, QubitInfo{}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (isQubitTensor(arg.getType())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // A tensor argument acts like a register the callee owns for the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // duration of the call, so give it its own register id. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validTensors.try_emplace(arg, TensorInfo{tensorCounter++}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| args.emplace_back(arg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| functionScope = std::move(scope); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return args; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void QCOProgramBuilder::endFunction(ValueRange returnValues) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checkFinalized(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!functionScope.has_value()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| llvm::reportFatalUsageError( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "endFunction() called without a matching startFunction()"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto value : returnValues) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isa<QubitType>(value.getType())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validateQubitValue(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validQubits.erase(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (isQubitTensor(value.getType())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validateTensorValue(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validTensors.erase(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto& [qubit, info] : validQubits) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!functionScope->outerQubits.contains(qubit)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| llvm::reportFatalUsageError( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Function body has qubit values that are neither returned nor " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "consumed"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto& [tensor, info] : validTensors) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!functionScope->outerTensors.contains(tensor)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| llvm::reportFatalUsageError( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "Function body has tensor values that are neither returned nor " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "deallocated"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| func::ReturnOp::create(*this, returnValues); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1450
to
+1475
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win Validate the return values against the declared result types.
The rest of this API reports misuse eagerly with 🛡️ Proposed check void QCOProgramBuilder::endFunction(ValueRange returnValues) {
checkFinalized();
if (!functionScope.has_value()) {
llvm::reportFatalUsageError(
"endFunction() called without a matching startFunction()");
}
+ auto funcOp = cast<func::FuncOp>(getInsertionBlock()->getParentOp());
+ if (!llvm::equal(returnValues.getTypes(), funcOp.getResultTypes())) {
+ llvm::reportFatalUsageError(
+ "Return values do not match the declared function result types");
+ }
+
for (const auto value : returnValues) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| restoreInsertionPoint(functionScope->savedInsertPoint); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| functionScope.reset(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SmallVector<Value> QCOProgramBuilder::call(StringRef callee, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ValueRange operands) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checkFinalized(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto funcOp = dyn_cast_or_null<func::FuncOp>( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SymbolTable::lookupSymbolIn(module, getStringAttr(callee))); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!funcOp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| llvm::reportFatalUsageError("Callee not found in module"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SmallVector<Value> qubitOperands; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SmallVector<Value> tensorOperands; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto operand : operands) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isa<QubitType>(operand.getType())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validateQubitValue(operand); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| qubitOperands.emplace_back(operand); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (isQubitTensor(operand.getType())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validateTensorValue(operand); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tensorOperands.emplace_back(operand); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| auto callOp = func::CallOp::create(*this, funcOp, operands); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1485
to
+1503
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win The new function APIs defer signature checking to the MLIR verifier.
📍 Affects 1 file
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SmallVector<Value> qubitResults; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| SmallVector<Value> tensorResults; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto result : callOp.getResults()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (isa<QubitType>(result.getType())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| qubitResults.emplace_back(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (isQubitTensor(result.getType())) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tensorResults.emplace_back(result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Thread the i-th linear operand into the i-th linear result of the same | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // kind. Any operand without a matching result is consumed by the call, any | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // result without a matching operand is newly created by it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const auto pairedQubits = std::min(qubitOperands.size(), qubitResults.size()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (size_t i = 0; i < pairedQubits; ++i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updateQubitTracking(qubitOperands[i], qubitResults[i]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (size_t i = pairedQubits; i < qubitOperands.size(); ++i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validQubits.erase(qubitOperands[i]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (size_t i = pairedQubits; i < qubitResults.size(); ++i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validQubits.try_emplace(qubitResults[i], QubitInfo{}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const auto pairedTensors = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::min(tensorOperands.size(), tensorResults.size()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (size_t i = 0; i < pairedTensors; ++i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| updateTensorTracking(tensorOperands[i], tensorResults[i]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (size_t i = pairedTensors; i < tensorOperands.size(); ++i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validTensors.erase(tensorOperands[i]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (size_t i = pairedTensors; i < tensorResults.size(); ++i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| validTensors.try_emplace(tensorResults[i], TensorInfo{tensorCounter++}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return SmallVector<Value>(callOp.getResults()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //===----------------------------------------------------------------------===// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Finalization | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //===----------------------------------------------------------------------===// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: munich-quantum-toolkit/core
Length of output: 1448
Include
mlir/IR/SymbolTable.hforSymbolTable.Passes.hnow declaresSymbolTable& symbolTable, so the header must provide that declaration.🤖 Prompt for AI Agents