Replace the uses of deprecated Structured Op Interface methods in Bufferize.cpp, Detensorize.cpp, and Interchange.cpp. The patch is based on https://reviews.llvm.org/D103394.
Differential Revision: https://reviews.llvm.org/D103530
Value resultTensor = outputs[resultIndex];
// Clone output buffers whose value is actually used.
- if (linalgOp.payloadUsesValueFromOutputOperandIndex(resultIndex)) {
+ OpOperand *tiedOpOperand = linalgOp.getOutputOperand(resultIndex);
+ if (linalgOp.payloadUsesValueFromOperand(tiedOpOperand)) {
resultBuffers.push_back(cloneMemref(loc, resultTensor, b));
continue;
}
bool shouldBeDetensored(Operation *op, TypeConverter typeConverter) {
GenericOp genericOp = dyn_cast_or_null<GenericOp>(op);
- return genericOp && llvm::all_of(genericOp.getShapedOperandTypes(),
- [&](ShapedType shapedType) {
- return !typeConverter.isLegal(shapedType);
- });
+ return genericOp &&
+ llvm::all_of(
+ genericOp.getInputAndOutputOperands(), [&](OpOperand *opOperand) {
+ return !typeConverter.isLegal(opOperand->get().getType());
+ });
}
/// A conversion patttern for detensoring `linalg.generic` ops.
// 2. Compute the interchanged indexing maps.
SmallVector<Attribute, 4> newIndexingMaps;
- ArrayRef<Attribute> indexingMaps = genericOp.indexing_maps().getValue();
- for (unsigned i = 0, e = genericOp.getNumShapedOperands(); i != e; ++i) {
- AffineMap m = indexingMaps[i].cast<AffineMapAttr>().getValue();
+ for (OpOperand *opOperand : genericOp.getInputAndOutputOperands()) {
+ AffineMap m = genericOp.getTiedIndexingMap(opOperand);
if (!permutationMap.isEmpty())
m = m.compose(permutationMap);
newIndexingMaps.push_back(AffineMapAttr::get(m));