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"> {
|
def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
|
||||||
let cppNamespace = "::mlir::linalg";
|
let cppNamespace = "::mlir::linalg";
|
||||||
let methods = [
|
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.
|
// Loop types handling.
|
||||||
//===------------------------------------------------------------------===//
|
//===------------------------------------------------------------------===//
|
||||||
|
@ -491,8 +476,7 @@ def LinalgStructuredInterface : OpInterface<"LinalgOp"> {
|
||||||
/*args=*/(ins "OpOperand *":$opOperand),
|
/*args=*/(ins "OpOperand *":$opOperand),
|
||||||
/*methodBody=*/"",
|
/*methodBody=*/"",
|
||||||
/*defaultImplementation=*/[{
|
/*defaultImplementation=*/[{
|
||||||
unsigned bbArgNumber =
|
unsigned bbArgNumber = opOperand->getOperandNumber();
|
||||||
$_op.getNumPayloadInductionVariables() + opOperand->getOperandNumber();
|
|
||||||
// Safeguard against the named linalg ops that are manually defined and
|
// Safeguard against the named linalg ops that are manually defined and
|
||||||
// that only support buffer semantics: we should not be there.
|
// that only support buffer semantics: we should not be there.
|
||||||
// Such ops have an empty regionBuilder and are not constructed with a
|
// 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, [
|
: Op<Linalg_Dialect, mnemonic, !listconcat(props, [
|
||||||
LinalgStructuredInterface, InferShapedTypeOpInterface])> {
|
LinalgStructuredInterface, InferShapedTypeOpInterface])> {
|
||||||
code structuredOpsBaseDecls = [{
|
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.
|
// Return whether the op accesses the iteration indices.
|
||||||
bool hasIndexSemantics() {
|
bool hasIndexSemantics() {
|
||||||
Operation *op = this->getOperation();
|
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
|
// consistency discussions (i.e. what to do with output tensors whose bbarg is
|
||||||
// not used).
|
// not used).
|
||||||
Block &block = linalgOp->getRegion(0).front();
|
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 "
|
return op->emitOpError("expected as many non-induction variable region "
|
||||||
"arguments as the number of input/output operands");
|
"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()) {
|
for (OpOperand *opOperand : linalgOp.getInputAndOutputOperands()) {
|
||||||
Type elementType = getElementTypeOrSelf(opOperand->get());
|
Type elementType = getElementTypeOrSelf(opOperand->get());
|
||||||
Type argType =
|
Type argType = block.getArgument(opOperand->getOperandNumber()).getType();
|
||||||
block.getArgument(numBBIvs + opOperand->getOperandNumber()).getType();
|
|
||||||
if (elementType != argType)
|
if (elementType != argType)
|
||||||
return op->emitOpError("expected type of bb argument #")
|
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 ("
|
<< " to match element or self type of the corresponding operand ("
|
||||||
<< elementType << ")";
|
<< elementType << ")";
|
||||||
}
|
}
|
||||||
|
|
|
@ -3229,16 +3229,13 @@ struct RemoveIdentityLinalgOps : public OpInterfaceRewritePattern<LinalgOp> {
|
||||||
|
|
||||||
// Get the argument number of the returned values. That is the operand
|
// Get the argument number of the returned values. That is the operand
|
||||||
// number to use for replacing uses of this operation.
|
// number to use for replacing uses of this operation.
|
||||||
unsigned numIndexArgs = op.getNumPayloadInductionVariables();
|
|
||||||
SmallVector<Value, 4> returnedArgs;
|
SmallVector<Value, 4> returnedArgs;
|
||||||
for (Value yieldVal : yieldOp.values()) {
|
for (Value yieldVal : yieldOp.values()) {
|
||||||
auto yieldArg = yieldVal.dyn_cast<BlockArgument>();
|
auto yieldArg = yieldVal.dyn_cast<BlockArgument>();
|
||||||
if (!yieldArg || yieldArg.getOwner() != &body)
|
if (!yieldArg || yieldArg.getOwner() != &body)
|
||||||
return failure();
|
return failure();
|
||||||
unsigned argumentNumber = yieldArg.getArgNumber();
|
unsigned argumentNumber = yieldArg.getArgNumber();
|
||||||
if (argumentNumber < numIndexArgs)
|
returnedArgs.push_back(op->getOperand(argumentNumber));
|
||||||
return failure();
|
|
||||||
returnedArgs.push_back(op->getOperand(argumentNumber - numIndexArgs));
|
|
||||||
}
|
}
|
||||||
if (returnedArgs.size() != op.getOperation()->getNumResults())
|
if (returnedArgs.size() != op.getOperation()->getNumResults())
|
||||||
return failure();
|
return failure();
|
||||||
|
|
Loading…
Reference in New Issue