Initially we were passing wrong numSymbols argument while calling
AffineMap::get() for creaating affine map with linearized result
expressions. The main problems was the number of symbols of the newly
to be created map may be different from that of the source map, as
new symbolic identifiers may be introduced while creating strided layout
linearized expressions.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp | ||
---|---|---|
390–410 | You can completely get rid of hasEncounteredSymbol if you just actually compute numSymbols. You can drop maxSymbolPosition as well. numSymbols = std::max(numSymbols, symbolExpr.getPosition() + 1); A single variable will do and it's more natural and compact. |
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp | ||
---|---|---|
390 | This revision is also duplicating existing functionality, and implementing it with recursion, just like in D114238. Either: return AffineMap::inferFromtExprList(...); Absolute worst case, you can expose: template <typename AffineExprContainer> static void getMaxDimAndSymbol(ArrayRef<AffineExprContainer> exprsList, int64_t &maxDim, int64_t &maxSym) { as a util and reuse it rather than reimplement a 5 line iterative algorithm with a longer recursive one. |
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp | ||
---|---|---|
388–412 | Do you need the extra parentheses? |
This revision isn't properly based -- please rebase on the current master tip and update.
Nit: sourceMap in backticks.