Skip to content

Commit 2e972e3

Browse files
committed
[mlir] Remove "getNumPayloadInductionVariables".
This method always returns 0 after https://reviews.llvm.org/rG7cddf56d608f07b8e49f7e2eeb4a20082611adb6 Differential Revision: https://reviews.llvm.org/D104645
1 parent ed31ff9 commit 2e972e3

File tree

4 files changed

+5
-39
lines changed

4 files changed

+5
-39
lines changed

mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,6 @@ def LinalgContractionOpInterface : OpInterface<"ContractionOpInterface"> {
9191
def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
9292
let cppNamespace = "::mlir::linalg";
9393
let methods = [
94-
//===------------------------------------------------------------------===//
95-
// Loop types handling.
96-
//===------------------------------------------------------------------===//
97-
InterfaceMethod<
98-
/*desc=*/[{
99-
Return the number of induction variables in the basic block. This should
100-
always be 0 for index-free linalg ops. For IndexedGeneric, this must be
101-
equal to numLoops
102-
}],
103-
/*retTy=*/"unsigned",
104-
/*methodName=*/"getNumPayloadInductionVariables",
105-
/*args=*/(ins),
106-
/*methodBody=*/"",
107-
/*defaultImplementation=*/""
108-
>,
10994
//===------------------------------------------------------------------===//
11095
// Loop types handling.
11196
//===------------------------------------------------------------------===//
@@ -491,8 +476,7 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
491476
/*args=*/(ins "OpOperand *":$opOperand),
492477
/*methodBody=*/"",
493478
/*defaultImplementation=*/[{
494-
unsigned bbArgNumber =
495-
$_op.getNumPayloadInductionVariables() + opOperand->getOperandNumber();
479+
unsigned bbArgNumber = opOperand->getOperandNumber();
496480
// Safeguard against the named linalg ops that are manually defined and
497481
// that only support buffer semantics: we should not be there.
498482
// Such ops have an empty regionBuilder and are not constructed with a

mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ class LinalgStructuredBase_Op<string mnemonic, list<OpTrait> props>
2828
: Op<Linalg_Dialect, mnemonic, !listconcat(props, [
2929
LinalgStructuredInterface, InferShapedTypeOpInterface])> {
3030
code structuredOpsBaseDecls = [{
31-
// Return the number of induction variables in the basic block. This should
32-
// always be 0 for index-free linalg ops. For IndexedGeneric, this must be
33-
// equal to numLoops.
34-
unsigned getNumPayloadInductionVariables() {
35-
return 0;
36-
}
37-
3831
// Return whether the op accesses the iteration indices.
3932
bool hasIndexSemantics() {
4033
Operation *op = this->getOperation();

mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -440,25 +440,17 @@ LogicalResult mlir::linalg::detail::verifyStructuredOpInterface(Operation *op) {
440440
// consistency discussions (i.e. what to do with output tensors whose bbarg is
441441
// not used).
442442
Block &block = linalgOp->getRegion(0).front();
443-
unsigned numBBIvs = linalgOp.getNumPayloadInductionVariables();
444443

445-
if (linalgOp.getNumInputsAndOutputs() + numBBIvs != block.getNumArguments())
444+
if (linalgOp.getNumInputsAndOutputs() != block.getNumArguments())
446445
return op->emitOpError("expected as many non-induction variable region "
447446
"arguments as the number of input/output operands");
448447

449-
// Note: the number and type of yield values are checked in the YieldOp.
450-
for (unsigned i = 0; i < numBBIvs; ++i)
451-
if (!block.getArgument(i).getType().isIndex())
452-
return op->emitOpError("expected index block argument #") << i;
453-
454448
for (OpOperand *opOperand : linalgOp.getInputAndOutputOperands()) {
455449
Type elementType = getElementTypeOrSelf(opOperand->get());
456-
Type argType =
457-
block.getArgument(numBBIvs + opOperand->getOperandNumber()).getType();
450+
Type argType = block.getArgument(opOperand->getOperandNumber()).getType();
458451
if (elementType != argType)
459452
return op->emitOpError("expected type of bb argument #")
460-
<< numBBIvs + opOperand->getOperandNumber() << " (" << argType
461-
<< ")"
453+
<< opOperand->getOperandNumber() << " (" << argType << ")"
462454
<< " to match element or self type of the corresponding operand ("
463455
<< elementType << ")";
464456
}

mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3229,16 +3229,13 @@ struct RemoveIdentityLinalgOps : public OpInterfaceRewritePattern<LinalgOp> {
32293229

32303230
// Get the argument number of the returned values. That is the operand
32313231
// number to use for replacing uses of this operation.
3232-
unsigned numIndexArgs = op.getNumPayloadInductionVariables();
32333232
SmallVector<Value, 4> returnedArgs;
32343233
for (Value yieldVal : yieldOp.values()) {
32353234
auto yieldArg = yieldVal.dyn_cast<BlockArgument>();
32363235
if (!yieldArg || yieldArg.getOwner() != &body)
32373236
return failure();
32383237
unsigned argumentNumber = yieldArg.getArgNumber();
3239-
if (argumentNumber < numIndexArgs)
3240-
return failure();
3241-
returnedArgs.push_back(op->getOperand(argumentNumber - numIndexArgs));
3238+
returnedArgs.push_back(op->getOperand(argumentNumber));
32423239
}
32433240
if (returnedArgs.size() != op.getOperation()->getNumResults())
32443241
return failure();

0 commit comments

Comments
 (0)