forked from OSchip/llvm-project
[mlir] Remove "getNumPayloadInductionVariables".
This method always returns 0 after https://reviews.llvm.org/rG7cddf56d608f07b8e49f7e2eeb4a20082611adb6 Differential Revision: https://reviews.llvm.org/D104645
This commit is contained in:
parent
ed31ff9c7a
commit
2e972e366a
|
@ -91,21 +91,6 @@ def LinalgContractionOpInterface : OpInterface<"ContractionOpInterface"> {
|
|||
def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
|
||||
let cppNamespace = "::mlir::linalg";
|
||||
let methods = [
|
||||
//===------------------------------------------------------------------===//
|
||||
// Loop types handling.
|
||||
//===------------------------------------------------------------------===//
|
||||
InterfaceMethod<
|
||||
/*desc=*/[{
|
||||
Return the number of induction variables in the basic block. This should
|
||||
always be 0 for index-free linalg ops. For IndexedGeneric, this must be
|
||||
equal to numLoops
|
||||
}],
|
||||
/*retTy=*/"unsigned",
|
||||
/*methodName=*/"getNumPayloadInductionVariables",
|
||||
/*args=*/(ins),
|
||||
/*methodBody=*/"",
|
||||
/*defaultImplementation=*/""
|
||||
>,
|
||||
//===------------------------------------------------------------------===//
|
||||
// Loop types handling.
|
||||
//===------------------------------------------------------------------===//
|
||||
|
@ -491,8 +476,7 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
|
|||
/*args=*/(ins "OpOperand *":$opOperand),
|
||||
/*methodBody=*/"",
|
||||
/*defaultImplementation=*/[{
|
||||
unsigned bbArgNumber =
|
||||
$_op.getNumPayloadInductionVariables() + opOperand->getOperandNumber();
|
||||
unsigned bbArgNumber = opOperand->getOperandNumber();
|
||||
// Safeguard against the named linalg ops that are manually defined and
|
||||
// that only support buffer semantics: we should not be there.
|
||||
// Such ops have an empty regionBuilder and are not constructed with a
|
||||
|
|
|
@ -28,13 +28,6 @@ class LinalgStructuredBase_Op<string mnemonic, list<OpTrait> props>
|
|||
: Op<Linalg_Dialect, mnemonic, !listconcat(props, [
|
||||
LinalgStructuredInterface, InferShapedTypeOpInterface])> {
|
||||
code structuredOpsBaseDecls = [{
|
||||
// Return the number of induction variables in the basic block. This should
|
||||
// always be 0 for index-free linalg ops. For IndexedGeneric, this must be
|
||||
// equal to numLoops.
|
||||
unsigned getNumPayloadInductionVariables() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Return whether the op accesses the iteration indices.
|
||||
bool hasIndexSemantics() {
|
||||
Operation *op = this->getOperation();
|
||||
|
|
|
@ -440,25 +440,17 @@ LogicalResult mlir::linalg::detail::verifyStructuredOpInterface(Operation *op) {
|
|||
// consistency discussions (i.e. what to do with output tensors whose bbarg is
|
||||
// not used).
|
||||
Block &block = linalgOp->getRegion(0).front();
|
||||
unsigned numBBIvs = linalgOp.getNumPayloadInductionVariables();
|
||||
|
||||
if (linalgOp.getNumInputsAndOutputs() + numBBIvs != block.getNumArguments())
|
||||
if (linalgOp.getNumInputsAndOutputs() != block.getNumArguments())
|
||||
return op->emitOpError("expected as many non-induction variable region "
|
||||
"arguments as the number of input/output operands");
|
||||
|
||||
// Note: the number and type of yield values are checked in the YieldOp.
|
||||
for (unsigned i = 0; i < numBBIvs; ++i)
|
||||
if (!block.getArgument(i).getType().isIndex())
|
||||
return op->emitOpError("expected index block argument #") << i;
|
||||
|
||||
for (OpOperand *opOperand : linalgOp.getInputAndOutputOperands()) {
|
||||
Type elementType = getElementTypeOrSelf(opOperand->get());
|
||||
Type argType =
|
||||
block.getArgument(numBBIvs + opOperand->getOperandNumber()).getType();
|
||||
Type argType = block.getArgument(opOperand->getOperandNumber()).getType();
|
||||
if (elementType != argType)
|
||||
return op->emitOpError("expected type of bb argument #")
|
||||
<< numBBIvs + opOperand->getOperandNumber() << " (" << argType
|
||||
<< ")"
|
||||
<< opOperand->getOperandNumber() << " (" << argType << ")"
|
||||
<< " to match element or self type of the corresponding operand ("
|
||||
<< elementType << ")";
|
||||
}
|
||||
|
|
|
@ -3229,16 +3229,13 @@ struct RemoveIdentityLinalgOps : public OpInterfaceRewritePattern<LinalgOp> {
|
|||
|
||||
// Get the argument number of the returned values. That is the operand
|
||||
// number to use for replacing uses of this operation.
|
||||
unsigned numIndexArgs = op.getNumPayloadInductionVariables();
|
||||
SmallVector<Value, 4> returnedArgs;
|
||||
for (Value yieldVal : yieldOp.values()) {
|
||||
auto yieldArg = yieldVal.dyn_cast<BlockArgument>();
|
||||
if (!yieldArg || yieldArg.getOwner() != &body)
|
||||
return failure();
|
||||
unsigned argumentNumber = yieldArg.getArgNumber();
|
||||
if (argumentNumber < numIndexArgs)
|
||||
return failure();
|
||||
returnedArgs.push_back(op->getOperand(argumentNumber - numIndexArgs));
|
||||
returnedArgs.push_back(op->getOperand(argumentNumber));
|
||||
}
|
||||
if (returnedArgs.size() != op.getOperation()->getNumResults())
|
||||
return failure();
|
||||
|
|
Loading…
Reference in New Issue