Skip to content

Commit

Permalink
Add missing definition of build method in Flow::CallOp (#19552)
Browse files Browse the repository at this point in the history
In `flow.call` op, there are two custom `OpBuilder` declarations:

https://github.com/iree-org/iree/blob/76a7b893e4c62d52eae2c165bdb23952a8589689/compiler/src/iree/compiler/Dialect/Flow/IR/FlowOps.td#L983-L996

And the second one is defined in `FlowOp.cpp`:

https://github.com/iree-org/iree/blob/76a7b893e4c62d52eae2c165bdb23952a8589689/compiler/src/iree/compiler/Dialect/Flow/IR/FlowOps.cpp#L1579-L1583

However, the function definition of the first one is missing. If we try
to use it, we'll get a linker error like "undefined symbol" in the build
phase.

So in this PR I try to add a definition for the first `OpBuilder`
(inside the tblgen file instead of `FlowOp.cpp`, since it's simple).

---------

Signed-off-by: PragmaTwice <[email protected]>
  • Loading branch information
PragmaTwice authored Jan 6, 2025
1 parent 0c6d267 commit 89afd4e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions compiler/src/iree/compiler/Dialect/Flow/IR/FlowOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,17 @@ void CallOp::build(OpBuilder &builder, OperationState &state,
}));
}

void CallOp::build(OpBuilder &builder, OperationState &state,
SymbolRefAttr callee, TypeRange resultTypes,
ValueRange resultDims, ValueRange arguments,
ArrayAttr tiedOperands,
ArrayRef<NamedAttribute> attributes) {
build(
builder, state, callee, resultTypes, resultDims, arguments,
IREE::Util::buildDynamicDimsForValues(state.location, arguments, builder),
tiedOperands, attributes);
}

FunctionType CallOp::getCalleeType() {
auto argumentTypes = llvm::map_to_vector(
getArgOperands(), [](Value arg) { return arg.getType(); });
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/iree/compiler/Dialect/Flow/IR/FlowOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ def FLOW_CallOp : FLOW_Op<"call", [
let builders = [
OpBuilder<(ins
"SymbolRefAttr":$callee,
"TypeRange":$resultTypes,
"TypeRange":$resultTypes, "ValueRange":$resultDims,
"ValueRange":$arguments,
"ArrayAttr":$tiedOperands,
CArg<"ArrayRef<NamedAttribute>", "{}">:$attributes)>,
Expand Down

0 comments on commit 89afd4e

Please sign in to comment.