Introduce a new attribute to represent the strided memref layout. Strided layouts are omnipresent in code generation flows and are the only kind of layouts produced and supported by a half of operation in the memref dialect (view-related, shape-related). However, they are internally represented as affine maps that require a somewhat fragile extraction of the strides from the linear form that also comes with an overhead. Furthermore, textual representation of strided layouts as affine maps is difficult to read: compare `affine_map<(d0, d1, d2)[s0, s1] -> (d0*32 + d1*s0 + s1 + d2)>` with `strides: [32, ?, 1], offset: ?`. While a rudimentary support for parsing a syntactically sugared version of the strided layout has existed in the codebase for a long time, it does not go as far as this commit to make the strided layout a first-class attribute in the IR. This introduces the attribute and updates the tests that using the pre-existing sugared form to use the new attribute instead. Most memref created programmatically, e.g., in passes, still use the affine form with further extraction of strides and will be updated separately. Update and clean-up the memref type documentation that has gotten stale and has been referring to the details of affine map composition that are long gone. See https://discourse.llvm.org/t/rfc-materialize-strided-memref-layout-as-an-attribute/64211. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D132864 |
||
|---|---|---|
| .. | ||
| Bindings | ||
| Dialects | ||
| Rationale | ||
| Tools | ||
| Tutorials | ||
| includes/img | ||
| AttributesAndTypes.md | ||
| BufferDeallocationInternals.md | ||
| Bufferization.md | ||
| BytecodeFormat.md | ||
| CAPI.md | ||
| CMakeLists.txt | ||
| Canonicalization.md | ||
| DataLayout.md | ||
| DebugActions.md | ||
| DeclarativeRewrites.md | ||
| DefiningDialects.md | ||
| Diagnostics.md | ||
| DialectConversion.md | ||
| Interfaces.md | ||
| LangRef.md | ||
| OpDefinitions.md | ||
| PDLL.md | ||
| PassManagement.md | ||
| Passes.md | ||
| PatternRewriter.md | ||
| Quantization.md | ||
| README.txt | ||
| SPIRVToLLVMDialectConversion.md | ||
| ShapeInference.md | ||
| SymbolsAndSymbolTables.md | ||
| TargetLLVMIR.md | ||
| Traits.md | ||
| doxygen-mainpage.dox | ||
| doxygen.cfg.in | ||
README.txt
MLIR documentation ================== Please note mlir.llvm.org is where MLIR's rendered documentation is displayed. The viewing experience on GitHub or elsewhere may not match those of the website. For any changes please verify instead that they work on the main website first. See https://github.com/llvm/mlir-www for the website generation information.