diff options
| author | Vladislav Vinogradov <vlad.vinogradov@intel.com> | 2021-10-11 18:25:14 +0300 |
|---|---|---|
| committer | Vladislav Vinogradov <vlad.vinogradov@intel.com> | 2021-10-19 12:31:15 +0300 |
| commit | e41ebbecf97ac70326dfa2c54e3ef5fa13df54eb (patch) | |
| tree | f75487d4ed6dc5ef1012f283b45c3ad6d28b43f8 /mlir/lib/Analysis/LoopAnalysis.cpp | |
| parent | cf033bb2d39c42818e3f13829b5ac6cc66b0ed6f (diff) | |
| download | llvm-e41ebbecf97ac70326dfa2c54e3ef5fa13df54eb.tar.gz | |
[mlir][RFC] Refactor layout representation in MemRefType
The change is based on the proposal from the following discussion:
https://llvm.discourse.group/t/rfc-memreftype-affine-maps-list-vs-single-item/3968
* Introduce `MemRefLayoutAttr` interface to get `AffineMap` from an `Attribute`
(`AffineMapAttr` implements this interface).
* Store layout as a single generic `MemRefLayoutAttr`.
This change removes the affine map composition feature and related API.
Actually, while the `MemRefType` itself supported it, almost none of the upstream
can work with more than 1 affine map in `MemRefType`.
The introduced `MemRefLayoutAttr` allows to re-implement this feature
in a more stable way - via separate attribute class.
Also the interface allows to use different layout representations rather than affine maps.
For example, the described "stride + offset" form, which is currently supported in ASM parser only,
can now be expressed as separate attribute.
Reviewed By: ftynse, bondhugula
Differential Revision: https://reviews.llvm.org/D111553
Diffstat (limited to 'mlir/lib/Analysis/LoopAnalysis.cpp')
| -rw-r--r-- | mlir/lib/Analysis/LoopAnalysis.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/mlir/lib/Analysis/LoopAnalysis.cpp b/mlir/lib/Analysis/LoopAnalysis.cpp index d40958e87777..478b212c3b52 100644 --- a/mlir/lib/Analysis/LoopAnalysis.cpp +++ b/mlir/lib/Analysis/LoopAnalysis.cpp @@ -219,15 +219,8 @@ static bool isContiguousAccess(Value iv, LoadOrStoreOp memoryOp, assert(memRefDim && "memRefDim == nullptr"); auto memRefType = memoryOp.getMemRefType(); - auto layoutMap = memRefType.getAffineMaps(); - // TODO: remove dependence on Builder once we support non-identity layout map. - Builder b(memoryOp.getContext()); - if (layoutMap.size() >= 2 || - (layoutMap.size() == 1 && - !(layoutMap[0] == - b.getMultiDimIdentityMap(layoutMap[0].getNumDims())))) { + if (!memRefType.getLayout().isIdentity()) return memoryOp.emitError("NYI: non-trivial layoutMap"), false; - } int uniqueVaryingIndexAlongIv = -1; auto accessMap = memoryOp.getAffineMap(); |
