diff --git a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td --- a/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td +++ b/mlir/include/mlir/Dialect/Linalg/IR/LinalgInterfaces.td @@ -898,503 +898,6 @@ /*methodName=*/"getRegionBuilder", (ins), [{ return ConcreteOp::getRegionBuilder(); }] - >, - //===------------------------------------------------------------------===// - // DEPRECATED METHODS - //===------------------------------------------------------------------===// - InterfaceMethod< - /*desc=*/[{ - Return true if the payload uses the value loaded from `opOperand`. This - is useful to avoid loading from "write-only" memory that may be - uninitialized, as well as properly cloning "read-write" operands. - }], - /*retTy=*/"bool", - /*methodName=*/"payloadUsesValueFromOpOperand", - /*args=*/(ins "OpOperand *":$opOperand), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - unsigned bbArgNumber = - $_op.getNumPayloadInductionVariables() + 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 - // region for now. In the future they are slated to disappear. - assert(this->getOperation()->getNumRegions() == 1 && "unexpected " - "missing region (calling `payloadUsesValueFromOpOperand` on " - "manually defined named Linalg op?)"); - Block &block = this->getOperation()->getRegion(0).front(); - // Init tensors have uses. - return !block.getArgument(bbArgNumber).use_empty(); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return true if the payload uses the value loaded from input operand - `index`. - }], - /*retTy=*/"bool", - /*methodName=*/"payloadUsesValueFromInputOperandIndex", - /*args=*/(ins "unsigned":$index), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return payloadUsesValueFromOpOperand(getInputOperand(index)); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return true if the payload uses the value loaded from output operand - `index`. - }], - /*retTy=*/"bool", - /*methodName=*/"payloadUsesValueFromOutputOperandIndex", - /*args=*/(ins "unsigned":$index), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return payloadUsesValueFromOpOperand(getOutputOperand(index)); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the `i`-th input operand. - }], - /*retTy=*/"Value", - /*methodName=*/"getInput", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - assert(i < $_op.getNumInputs()); - return this->getOperation()->getOperand(i); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the `i`-th input shaped type - }], - /*retTy=*/"ShapedType", - /*methodName=*/"getInputShapedType", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return getInput(i).getType().template cast(); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the range of input operands. - }], - /*retTy=*/"Operation::operand_range", - /*methodName=*/"getInputs", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - auto range = this->getOperation()->getOperands(); - return {range.begin(), range.begin() + $_op.getNumInputs()}; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the OpOperands for the input operands. - }], - /*retTy=*/" MutableArrayRef", - /*methodName=*/"getInputOpOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return this->getOperation()->getOpOperands().take_front(getNumInputs()); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the subset of input operands that are of buffer type. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getInputBuffers", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return llvm::to_vector<4>(llvm::make_filter_range( - getInputs(), [](Value in){ return in.getType().template isa(); })); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the number of input buffer operands. - }], - /*retTy=*/"unsigned", - /*methodName=*/"getNumInputBuffers", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return $_op.getInputBuffers().size(); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the `index`^th input buffer. - }], - /*retTy=*/"Value", - /*methodName=*/"getInputBuffer", - /*args=*/(ins "unsigned":$index), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - assert(index < getNumInputBuffers()); - return getInputBuffers()[index]; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the subset of input operands that are of buffer type. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getInputBuffersOpOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - SmallVector res; - res.reserve(getNumInputs()); - for (OpOperand &o : getInputOpOperands()) - if (o.get().getType().isa()) - res.push_back(&o); - return res; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the subset of input operands that are of tensor type. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getInputTensors", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return llvm::to_vector<4>(llvm::make_filter_range( - getInputs(), - [](Value in){ return in.getType().template isa(); })); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the subset of op operands that are of tensor type. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getInputTensorsOpOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - SmallVector res; - res.reserve(getNumInputs()); - for (OpOperand &o : getInputOpOperands()) - if (o.get().getType().isa()) - res.push_back(&o); - return res; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the `i`-th output operand. - }], - /*retTy=*/"Value", - /*methodName=*/"getOutput", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - assert(i < $_op.getNumOutputs()); - return this->getOperation()->getOperand(i + $_op.getNumInputs()); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the `i`-th output shaped type - }], - /*retTy=*/"ShapedType", - /*methodName=*/"getOutputShapedType", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return getOutput(i).getType().template cast(); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the range of output operands. - }], - /*retTy=*/"Operation::operand_range", - /*methodName=*/"getOutputs", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - auto start = - this->getOperation()->getOperands().begin() + $_op.getNumInputs(); - return {start, start + $_op.getNumOutputs()}; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the OpOperands for the output operands. - }], - /*retTy=*/" MutableArrayRef", - /*methodName=*/"getOutputOpOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return this->getOperation()->getOpOperands().slice( - getNumInputs(), getNumOutputs()); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the subset of output operands that are of buffer type. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getOutputBuffers", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return llvm::to_vector<4>(llvm::make_filter_range( - getOutputs(), [](Value in){ return in.getType().template isa(); })); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the `index`^th output buffer. - }], - /*retTy=*/"Value", - /*methodName=*/"getOutputBuffer", - /*args=*/(ins "unsigned":$index), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - assert(index < getNumOutputBuffers()); - return getOutputBuffers()[index]; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the subset of output operands that are of buffer type. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getOutputBuffersOpOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - SmallVector res; - res.reserve(getNumOutputs()); - for (OpOperand &o : getOutputOpOperands()) - if (o.get().getType().isa()) - res.push_back(&o); - return res; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the number of output buffer operands. - }], - /*retTy=*/"unsigned", - /*methodName=*/"getNumOutputBuffers", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return $_op.getOutputBuffers().size(); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the subset of output operands that are of tensor type. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getOutputTensors", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return llvm::to_vector<4>(llvm::make_filter_range( - getOutputs(), - [](Value in){ return in.getType().template isa(); })); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the subset of output operands that are of tensor type. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getOutputTensorsOpOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - SmallVector res; - res.reserve(getNumOutputs()); - for (OpOperand &o : getOutputOpOperands()) - if (o.get().getType().isa()) - res.push_back(&o); - return res; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the number of output tensor operands. - }], - /*retTy=*/"unsigned", - /*methodName=*/"getNumOutputTensors", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return $_op.getOutputTensors().size(); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the number of input and output operands. - }], - /*retTy=*/"unsigned", - /*methodName=*/"getNumShapedOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return $_op.getNumInputs() + $_op.getNumOutputs(); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the `i`-th shaped operand value. - }], - /*retTy=*/"Value", - /*methodName=*/"getShapedOperand", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - assert(i < $_op.getNumShapedOperands()); - return this->getOperation()->getOperand(i); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the range over input and output operands. - }], - /*retTy=*/"Operation::operand_range", - /*methodName=*/"getShapedOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - auto range = this->getOperation()->getOperands(); - return {range.begin(), range.begin() + getNumShapedOperands()}; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the OpOperands for all the shaped operands. - }], - /*retTy=*/" MutableArrayRef", - /*methodName=*/"getShapedOpOperands", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return this->getOperation()->getOpOperands().take_front( - getNumShapedOperands()); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the OpOperands for all the shaped operands. - }], - /*retTy=*/" OpOperand&", - /*methodName=*/"getShapedOpOperand", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return *(this->getShapedOpOperands().begin() + i); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the range over input and output operands. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getShapedOperandTypes", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return llvm::to_vector<4>( - llvm::map_range( - getShapedOperands(), - [](Value v) { return v.getType().cast(); })); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the `i`-th shaped type - }], - /*retTy=*/"ShapedType", - /*methodName=*/"getShapedType", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - return $_op.getShapedOperand(i).getType().template cast(); - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the input or output indexing map at index `i`. - }], - /*retTy=*/"AffineMap", - /*methodName=*/"getIndexingMap", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - assert(i < $_op.getNumShapedOperands()); - return getIndexingMaps()[i]; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the input indexing map at index `i`. - }], - /*retTy=*/"AffineMap", - /*methodName=*/"getInputIndexingMap", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - assert(i < $_op.getNumInputs()); - return getIndexingMaps()[i]; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the input indexing maps. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getInputIndexingMaps", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - auto maps = $_op.getIndexingMaps(); - return SmallVector{maps.begin(), - maps.begin() + $_op.getNumInputs()}; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the output indexing map at index `i`. - }], - /*retTy=*/"AffineMap", - /*methodName=*/"getOutputIndexingMap", - /*args=*/(ins "unsigned":$i), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - assert(i < $_op.getNumOutputs()); - return getIndexingMaps()[i + $_op.getNumInputs()]; - }] - >, - InterfaceMethod< - /*desc=*/[{ - Return the output indexing maps. - }], - /*retTy=*/"SmallVector", - /*methodName=*/"getOutputIndexingMaps", - /*args=*/(ins), - /*methodBody=*/"", - /*defaultImplementation=*/[{ - auto maps = $_op.getIndexingMaps(); - return SmallVector{maps.begin() + $_op.getNumInputs(), - maps.begin() + $_op.getNumShapedOperands()}; - }] > ];