Skip to content

Commit 1a708bd

Browse files
committed
Revert "[mlir] share argument attributes interface between calls and callables (llvm#123176)"
This reverts commit 327d627.
1 parent c06d0ff commit 1a708bd

File tree

32 files changed

+256
-452
lines changed

32 files changed

+256
-452
lines changed

flang/include/flang/Optimizer/Dialect/CUF/CUFOps.td

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,7 @@ def cuf_KernelLaunchOp : cuf_Op<"kernel_launch", [CallOpInterface,
207207
I32:$block_z,
208208
Optional<I32>:$bytes,
209209
Optional<I32>:$stream,
210-
Variadic<AnyType>:$args,
211-
OptionalAttr<DictArrayAttr>:$arg_attrs,
212-
OptionalAttr<DictArrayAttr>:$res_attrs
210+
Variadic<AnyType>:$args
213211
);
214212

215213
let assemblyFormat = [{

flang/include/flang/Optimizer/Dialect/FIROps.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2432,8 +2432,6 @@ def fir_CallOp : fir_Op<"call",
24322432
let arguments = (ins
24332433
OptionalAttr<SymbolRefAttr>:$callee,
24342434
Variadic<AnyType>:$args,
2435-
OptionalAttr<DictArrayAttr>:$arg_attrs,
2436-
OptionalAttr<DictArrayAttr>:$res_attrs,
24372435
OptionalAttr<fir_FortranProcedureFlagsAttr>:$procedure_attrs,
24382436
DefaultValuedAttr<Arith_FastMathAttr,
24392437
"::mlir::arith::FastMathFlags::none">:$fastmath
@@ -2520,8 +2518,6 @@ def fir_DispatchOp : fir_Op<"dispatch", []> {
25202518
fir_ClassType:$object,
25212519
Variadic<AnyType>:$args,
25222520
OptionalAttr<I32Attr>:$pass_arg_pos,
2523-
OptionalAttr<DictArrayAttr>:$arg_attrs,
2524-
OptionalAttr<DictArrayAttr>:$res_attrs,
25252521
OptionalAttr<fir_FortranProcedureFlagsAttr>:$procedure_attrs
25262522
);
25272523

flang/lib/Lower/ConvertCall.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,7 @@ Fortran::lower::genCallOpAndResult(
594594

595595
builder.create<cuf::KernelLaunchOp>(
596596
loc, funcType.getResults(), funcSymbolAttr, grid_x, grid_y, grid_z,
597-
block_x, block_y, block_z, bytes, stream, operands,
598-
/*arg_attrs=*/nullptr, /*res_attrs=*/nullptr);
597+
block_x, block_y, block_z, bytes, stream, operands);
599598
callNumResults = 0;
600599
} else if (caller.requireDispatchCall()) {
601600
// Procedure call requiring a dynamic dispatch. Call is created with
@@ -622,8 +621,7 @@ Fortran::lower::genCallOpAndResult(
622621
dispatch = builder.create<fir::DispatchOp>(
623622
loc, funcType.getResults(), builder.getStringAttr(procName),
624623
caller.getInputs()[*passArg], operands,
625-
builder.getI32IntegerAttr(*passArg), /*arg_attrs=*/nullptr,
626-
/*res_attrs=*/nullptr, procAttrs);
624+
builder.getI32IntegerAttr(*passArg), procAttrs);
627625
} else {
628626
// NOPASS
629627
const Fortran::evaluate::Component *component =
@@ -638,17 +636,15 @@ Fortran::lower::genCallOpAndResult(
638636
passObject = builder.create<fir::LoadOp>(loc, passObject);
639637
dispatch = builder.create<fir::DispatchOp>(
640638
loc, funcType.getResults(), builder.getStringAttr(procName),
641-
passObject, operands, nullptr, /*arg_attrs=*/nullptr,
642-
/*res_attrs=*/nullptr, procAttrs);
639+
passObject, operands, nullptr, procAttrs);
643640
}
644641
callNumResults = dispatch.getNumResults();
645642
if (callNumResults != 0)
646643
callResult = dispatch.getResult(0);
647644
} else {
648645
// Standard procedure call with fir.call.
649646
auto call = builder.create<fir::CallOp>(
650-
loc, funcType.getResults(), funcSymbolAttr, operands,
651-
/*arg_attrs=*/nullptr, /*res_attrs=*/nullptr, procAttrs);
647+
loc, funcType.getResults(), funcSymbolAttr, operands, procAttrs);
652648

653649
callNumResults = call.getNumResults();
654650
if (callNumResults != 0)

flang/lib/Optimizer/CodeGen/TargetRewrite.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,6 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
518518
newOpers.insert(newOpers.end(), trailingOpers.begin(), trailingOpers.end());
519519

520520
llvm::SmallVector<mlir::Value, 1> newCallResults;
521-
// TODO propagate/update call argument and result attributes.
522521
if constexpr (std::is_same_v<std::decay_t<A>, mlir::gpu::LaunchFuncOp>) {
523522
auto newCall = rewriter->create<A>(
524523
loc, callOp.getKernel(), callOp.getGridSizeOperandValues(),
@@ -558,7 +557,6 @@ class TargetRewrite : public fir::impl::TargetRewritePassBase<TargetRewrite> {
558557
loc, newResTys, rewriter->getStringAttr(callOp.getMethod()),
559558
callOp.getOperands()[0], newOpers,
560559
rewriter->getI32IntegerAttr(*callOp.getPassArgPos() + passArgShift),
561-
/*arg_attrs=*/nullptr, /*res_attrs=*/nullptr,
562560
callOp.getProcedureAttrsAttr());
563561
if (wrap)
564562
newCallResults.push_back((*wrap)(dispatchOp.getOperation()));

flang/lib/Optimizer/Transforms/AbstractResult.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ class CallConversion : public mlir::OpRewritePattern<Op> {
147147
newResultTypes.emplace_back(getVoidPtrType(result.getContext()));
148148

149149
Op newOp;
150-
// TODO: propagate argument and result attributes (need to be shifted).
151150
// fir::CallOp specific handling.
152151
if constexpr (std::is_same_v<Op, fir::CallOp>) {
153152
if (op.getCallee()) {
@@ -190,11 +189,9 @@ class CallConversion : public mlir::OpRewritePattern<Op> {
190189
if (op.getPassArgPos())
191190
passArgPos =
192191
rewriter.getI32IntegerAttr(*op.getPassArgPos() + passArgShift);
193-
// TODO: propagate argument and result attributes (need to be shifted).
194192
newOp = rewriter.create<fir::DispatchOp>(
195193
loc, newResultTypes, rewriter.getStringAttr(op.getMethod()),
196194
op.getOperands()[0], newOperands, passArgPos,
197-
/*arg_attrs=*/nullptr, /*res_attrs=*/nullptr,
198195
op.getProcedureAttrsAttr());
199196
}
200197

flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,8 @@ struct DispatchOpConv : public OpConversionPattern<fir::DispatchOp> {
205205
// Make the call.
206206
llvm::SmallVector<mlir::Value> args{funcPtr};
207207
args.append(dispatch.getArgs().begin(), dispatch.getArgs().end());
208-
rewriter.replaceOpWithNewOp<fir::CallOp>(
209-
dispatch, resTypes, nullptr, args, dispatch.getArgAttrsAttr(),
210-
dispatch.getResAttrsAttr(), dispatch.getProcedureAttrsAttr());
208+
rewriter.replaceOpWithNewOp<fir::CallOp>(dispatch, resTypes, nullptr, args,
209+
dispatch.getProcedureAttrsAttr());
211210
return mlir::success();
212211
}
213212

mlir/docs/Interfaces.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -753,15 +753,10 @@ interface section goes as follows:
753753
- (`C++ class` -- `ODS class`(if applicable))
754754

755755
##### CallInterfaces
756+
756757
* `CallOpInterface` - Used to represent operations like 'call'
757758
- `CallInterfaceCallable getCallableForCallee()`
758759
- `void setCalleeFromCallable(CallInterfaceCallable)`
759-
- `ArrayAttr getArgAttrsAttr()`
760-
- `ArrayAttr getResAttrsAttr()`
761-
- `void setArgAttrsAttr(ArrayAttr)`
762-
- `void setResAttrsAttr(ArrayAttr)`
763-
- `Attribute removeArgAttrsAttr()`
764-
- `Attribute removeResAttrsAttr()`
765760
* `CallableOpInterface` - Used to represent the target callee of call.
766761
- `Region * getCallableRegion()`
767762
- `ArrayRef<Type> getArgumentTypes()`

mlir/examples/toy/Ch4/include/toy/Ops.td

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,7 @@ def GenericCallOp : Toy_Op<"generic_call",
215215

216216
// The generic call operation takes a symbol reference attribute as the
217217
// callee, and inputs for the call.
218-
let arguments = (ins
219-
FlatSymbolRefAttr:$callee,
220-
Variadic<F64Tensor>:$inputs,
221-
OptionalAttr<DictArrayAttr>:$arg_attrs,
222-
OptionalAttr<DictArrayAttr>:$res_attrs
223-
);
218+
let arguments = (ins FlatSymbolRefAttr:$callee, Variadic<F64Tensor>:$inputs);
224219

225220
// The generic call operation returns a single value of TensorType.
226221
let results = (outs F64Tensor);

mlir/examples/toy/Ch5/include/toy/Ops.td

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,7 @@ def GenericCallOp : Toy_Op<"generic_call",
214214

215215
// The generic call operation takes a symbol reference attribute as the
216216
// callee, and inputs for the call.
217-
let arguments = (ins
218-
FlatSymbolRefAttr:$callee,
219-
Variadic<F64Tensor>:$inputs,
220-
OptionalAttr<DictArrayAttr>:$arg_attrs,
221-
OptionalAttr<DictArrayAttr>:$res_attrs
222-
);
217+
let arguments = (ins FlatSymbolRefAttr:$callee, Variadic<F64Tensor>:$inputs);
223218

224219
// The generic call operation returns a single value of TensorType.
225220
let results = (outs F64Tensor);

mlir/examples/toy/Ch6/include/toy/Ops.td

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,7 @@ def GenericCallOp : Toy_Op<"generic_call",
214214

215215
// The generic call operation takes a symbol reference attribute as the
216216
// callee, and inputs for the call.
217-
let arguments = (ins
218-
FlatSymbolRefAttr:$callee,
219-
Variadic<F64Tensor>:$inputs,
220-
OptionalAttr<DictArrayAttr>:$arg_attrs,
221-
OptionalAttr<DictArrayAttr>:$res_attrs
222-
);
217+
let arguments = (ins FlatSymbolRefAttr:$callee, Variadic<F64Tensor>:$inputs);
223218

224219
// The generic call operation returns a single value of TensorType.
225220
let results = (outs F64Tensor);

0 commit comments

Comments
 (0)