| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[mlir][Tensor] Generalize the pattern to swap tensor.collapse_shape -> tensor.expand_shape. (#133819) The current patterns compared the reassocation indices for the two ops and failed if neither of them were of size 1. This patch relaxes this restriction by handling a new case where the reassociation indices might be of the same size. Also generalizes to cases where when generating the swapped tensor.expand_shape -> tensor.collapse_shape if one of them is degenerate, those are not generated. Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com> | 1 年前 | |
[MLIR] Bubble up tensor.extract_slice through tensor.collapse_shape (#131982) Add a pattern that bubbles up tensor.extract_slice through tensor.collapse_shape. The pattern is registered in a pattern population function that is used by the transform op transform.apply_patterns.tensor.bubble_up_extract_slice and by the tranform op transform.structured.fuse as a cleanup pattern. This pattern enables tiling and fusing op chains which contain tensor.collapse_shape if added as a cleanup pattern of tile and fuse utility. Without this pattern that would not be possible, as tensor.collapse_shape does not implement the tiling interface. This is an additional pattern to the one added in PR #126898 | 1 年前 | |
[mlir][linalg] Genericize MapOp (#162742) This PR modifies the definition of linalg::MapOp so that it has the same structure of linalg::GenericOp and all other linalg ops. Mainly, it adds an out bbarg for the body of the op. Although the out arg is never used in the body, there doesn't seem to be much benefit in specializing the op to exclude it. In fact it only makes things more complicated because it doesn't align with the GenericOp structure. For example, linalg-generalize-named-ops avoided converting linalg.map purely because it didn't have the structure to do so. Moreover, although some fusion patterns are applied explicitly to GenericOp, we can change them to be applied to the base LinalgOp which will enable fusion for any fusion-compatible linalg op, but that requires the op having a generic structure. So these changes will enable us to use existing generic transformation patterns on MapOp that weren't possible before. They can either be applied to MapOp directly or applied after converting to GenericOp. | 8 个月前 | |
[mlir][tensor] Fold identity reshape of 0d-tensors (#146375) Just like 1d-tensors, reshapes of 0d-tensors (aka scalars) are always no-folds as they only have one possible layout. This PR adds logic to the fold implementation to optimize these away as is currently implemented for 1d tensors. | 1 年前 | |
[mlir][Tensor] Move concat operation decomposition as a method of the concat operation. (#116004) Currently the implementation is within a pattern that cannot be used without a pattern rewriter. Move the decomposition as a method of the operation to make it usable outside of pattern rewrites. Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com> | 1 年前 | |
[mlir][Tensor] Check for out-of-bounds slice in insert/extract_slice verifier (#130487) Also fix test cases that had invalid ops. | 1 年前 | |
[mlir][tensor] add tensor insert/extract op folders (#142458) Adds a few canonicalizers, folders, and rewrite patterns to tensor ops: * tensor.insert folder: insert into a constant is replaced with a new constant * tensor.extract folder: extract from a parent tensor that was inserted at the same indices is folded into the inserted value * rewrite pattern added that replaces an extract of a collapse shape with an extract of the source tensor (requires static source dimensions) Signed-off-by: Asra Ali <asraa@google.com> | 1 年前 | |
[mlir][affine] Add static basis support to affine.delinearize (#113846) This commit makes affine.delinealize join other indexing operators, like vector.extract, which store a mixed static/dynamic set of sizes, offsets, or such. In this case, the basis (the set of values that will be used to decompose the linear index) is now stored as an array of index attributes where the basis is statically known, eliminating the need to cretae constants. This commit also adds copies of the delinearize utility in the affine dialect to allow it to take an array of OpFoldResults and extends te DynamicIndexList parser/printer to allow specifying the delimiters in tablegen (this is needed to avoid breaking existing syntax). --------- Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com> | 1 年前 | |
[mlir] Add a pattern to fold single- and zero-iteration scf.forall ops. Differential Revision: https://reviews.llvm.org/D145368 | 3 年前 | |
[mlir][NFC] Update textual references of func to func.func in Tensor/Tosa/Vector tests The special case parsing of func operations is being removed. | 4 年前 | |
[mlir][tensor][linalg] Move Pack/UnPack Ops to Linalg (#123902) Moves PackOp and UnPackOp from the Tensor dialect to Linalg. This change was discussed in the following RFC: * https://discourse.llvm.org/t/rfc-move-tensor-pack-and-tensor-unpack-into-linalg This change involves significant churn but only relocates existing code - no new functionality is added. **Note for Downstream Users** Downstream users must update references to PackOp and UnPackOp as follows: * Code: s/tensor::(Up)PackOp/linalg::(Un)PackOp/g * Tests: s/tensor.(un)pack/linalg.(un)pack/g No other modifications should be required. | 1 年前 | |
[mlir][linalg] Take artificial padding into account for pack/unpack folding. (#150272) The revision only folds the tensor.pad/extract_slice op into linalg.pack/unpack ops only when it is safe to fold. It is not valid to have artificial padding. The documentation improvement and verifier update will be done in a separate PR (i.e., https://github.com/llvm/llvm-project/pull/149624). The revision is a step towards it. --------- Signed-off-by: hanhanW <hanhan0912@gmail.com> | 1 年前 | |
[mlir][tensor] Fold unpadding collapse_shape into extract_slice (#93554) | 2 年前 | |
[mlir] Drop outermost dims in slice rank reduction inference (#95020) The getDroppedDims utility function does not follow the convention of dropping outermost unit dimensions first when inferring a rank reduction mask for a slice. This PR updates the implementation to match this convention. | 2 年前 | |
[mlir][Tensor] Check for out-of-bounds slice in insert/extract_slice verifier (#130487) Also fix test cases that had invalid ops. | 1 年前 | |
[mlir][IntRangeInference] Infer values for {memref,tensor}.dim (#122945) Implement the integer range inference niterface for memref.dim and tetnor.dim using shared code. The inference will infer the dim of dynamic dimensions to [0, index_max] and take the union of all the dimensions that the dim argument could be validly referring to. | 1 年前 | |
[mlir][tensor] Relax input type requirement on tensor.splat (#145893) tensor.splat is currently restricted to only accepting input values that are of integer, index or float type. This is much more restrictive than the tensor type itself as well as any lowerings of it. This PR therefore removes this restriction by using AnyType for the input value. Whether the type is actually valid or not for a tensor remains verified through the type equality of the result tensor element type and the input type. | 1 年前 | |
[mlir][bufferization] Fix OneShotBufferize when defaultMemorySpaceFn is used (#91524) As described in issue llvm/llvm-project#91518, a previous PR llvm/llvm-project#78484 introduced the defaultMemorySpaceFn into bufferization options, allowing one to inform OneShotBufferize that it should use a specified function to derive the memory space attribute from the encoding attribute attached to tensor types. However, introducing this feature exposed unhandled edge cases, examples of which are introduced by this change in the new test under test/Dialect/Bufferization/Transforms/one-shot-bufferize-encodings.mlir. Fixing the inconsistencies introduced by defaultMemorySpaceFn is pretty simple. This change: - Updates the bufferization.to_memref and bufferization.to_tensor operations to explicitly include operand and destination types, whereas previously they relied on type inference to deduce the tensor types. Since the type inference cannot recover the correct tensor encoding/memory space, the operand and result types must be explicitly included. This is a small assembly format change, but it touches a large number of test files. - Makes minor updates to other bufferization functions to handle the changes in building the above ops. - Updates bufferization of tensor.from_elements to handle memory space. Integration/upgrade guide: In downstream projects, if you have tests or MLIR files that explicitly use bufferization.to_tensor or bufferization.to_memref, then update them to the new assembly format as follows: %1 = bufferization.to_memref %0 : memref<10xf32> %2 = bufferization.to_tensor %1 : memref<10xf32> becomes %1 = bufferization.to_memref %0 : tensor<10xf32> to memref<10xf32> %2 = bufferization.to_tensor %0 : memref<10xf32> to tensor<10xf32> | 1 年前 | |
[mlir][bufferization] Remove allow-return-allocs and create-deallocs pass options, remove bufferization.escape attribute (#66619) This commit removes the deallocation capabilities of one-shot-bufferization. One-shot-bufferization should never deallocate any memrefs as this should be entirely handled by the ownership-based-buffer-deallocation pass going forward. This means the allow-return-allocs pass option will default to true now, create-deallocs defaults to false and they, as well as the escape attribute indicating whether a memref escapes the current region, will be removed. A new allow-return-allocs-from-loops option is added as a temporary workaround for some bufferization limitations. | 2 年前 | |
[mlir][bufferize] Make drop-equivalent-buffer-results support mult blocks (#163388) Enable Make drop-equivalent-buffer-results to handle return ops in multiple blocks within a function. | 9 个月前 | |
[mlir][tensor] Relax input type requirement on tensor.splat (#145893) tensor.splat is currently restricted to only accepting input values that are of integer, index or float type. This is much more restrictive than the tensor type itself as well as any lowerings of it. This PR therefore removes this restriction by using AnyType for the input value. Whether the type is actually valid or not for a tensor remains verified through the type equality of the result tensor element type and the input type. | 1 年前 | |
[mlir][memref] Add a new ReifyResultShapes pass (#145927) This pass reifies the shapes of a subset of ReifyRankedShapedTypeOpInterface ops with tensor results. The pass currently only supports result shape type reification for: - tensor::PadOp - tensor::ConcatOp It addresses a representation gap where implicit op semantics are needed to infer static result types from dynamic operands. But it does so by using ReifyRankedShapedTypeOpInterface as the source of truth rather than the op itself. As a consequence, this cannot generalize today. TODO: in the future, we should consider coupling this information with op "transfer functions" (e.g. IndexingMapOpInterface) to provide a source of truth that can work across result shape inference, canonicalization and op verifiers. The pass replaces the operations with their reified versions, when more static information can be derived, and inserts casts when results shapes are updated. Example: mlir #map = affine_map<(d0) -> (-d0 + 256)> func.func @func(%arg0: f32, %arg1: index, %arg2: tensor<64x?x64xf32>) -> tensor<1x?x64xf32> { %0 = affine.apply #map(%arg1) %extracted_slice = tensor.extract_slice %arg2[0, 0, 0] [1, %arg1, 64] [1, 1, 1] : tensor<64x?x64xf32> to tensor<1x?x64xf32> %padded = tensor.pad %extracted_slice low[0, 0, 0] high[0, %0, 0] { ^bb0(%arg3: index, %arg4: index, %arg5: index): tensor.yield %arg0 : f32 } : tensor<1x?x64xf32> to tensor<1x?x64xf32> return %padded : tensor<1x?x64xf32> } // mlir-opt --reify-result-shapes #map = affine_map<()[s0] -> (-s0 + 256)> func.func @func(%arg0: f32, %arg1: index, %arg2: tensor<64x?x64xf32>) -> tensor<1x?x64xf32> { %0 = affine.apply #map()[%arg1] %extracted_slice = tensor.extract_slice %arg2[0, 0, 0] [1, %arg1, 64] [1, 1, 1] : tensor<64x?x64xf32> to tensor<1x?x64xf32> %padded = tensor.pad %extracted_slice low[0, 0, 0] high[0, %0, 0] { ^bb0(%arg3: index, %arg4: index, %arg5: index): tensor.yield %arg0 : f32 } : tensor<1x?x64xf32> to tensor<1x256x64xf32> %cast = tensor.cast %padded : tensor<1x256x64xf32> to tensor<1x?x64xf32> return %cast : tensor<1x?x64xf32> } --------- Co-authored-by: Fabian Mora <fabian.mora-cordero@amd.com> | 1 年前 | |
[mlir][tensor] Fix ReifyRankedShapedTypeOpInterface impl. of reshape ops reifyResultShapes should return an Attribute if and only if the respective dimension is static. This fixes #64256. Differential Revision: https://reviews.llvm.org/D158166 | 2 年前 | |
[mlir][tensor] Implement constant folder for tensor.pad (#92691) Extend the folding ability of the RewriteAsConstant patterns to include tensor.pad operations on constants. The new pattern with constant fold tensor.pad operations which operate on tensor constants and have statically resolvable padding sizes/values. %init = arith.constant dense<[[6, 7], [8, 9]]> : tensor<2x2xi32> %pad_value = arith.constant 0 : i32 %0 = tensor.pad %init low[1, 1] high[1, 1] { ^bb0(%arg1: index, %arg2: index): tensor.yield %pad_value : i32 } : tensor<2x2xi32> to tensor<4x4xi32> becomes %cst = arith.constant dense<[[0, 0, 0, 0], [0, 6, 7, 0], [0, 8, 9, 0], [0, 0, 0, 0]]> : tensor<4x4xi32> Co-authored-by: Spenser Bauman <sabauma@fastmail> | 2 年前 | |
[NFC][mlir][mesh,shard] Fixing misnomers in mesh dialect, renaming 'mesh' dialect to 'shard' (#150177) Dialect to 'shard' (discourse 87053) - dialect name mesh -> shard - (device) mesh -> (device) grid - spmdize -> partition A lot of diffs, but simple renames only. @tkarna @yaochengji | 1 年前 | |
[MLIR][Transform] FuseOp: accept transform params, add use_forall argument (#161883) Changes to linalg structured.fuse transform op: * Adds an optional use_forall boolean argument which generates a tiled scf.forall loop instead of scf.for loops. * tile_sizes can now be any parameter or handle. * tile_interchange can now be any parameter or handle. * IR formatting changes from transform.structured.fuse %0 [4, 8] ... to transform.structured.fuse %0 tile_sizes [4, 8] ... - boolean arguments are now UnitAttrs and should be set via the op attr-dict: {apply_cleanup, use_forall} | 9 个月前 | |
[mlir][tensor] Fix bug in utility tensor::isCastLikeExtractSliceOp Fixes an issue where isCastLikeExtractSliceOp did not account for the fact that tensor.extract_slice may drop non-unit dimensions. This change makes the utility function behave inline with its name/description. The only user of this function is in the FindPayloadReplacementOpInterface for the tensor::ExtractSliceOp. This can potentially cause downstream projects to have more "listener could not find replacement op" errors when interpreting Transform IR, but the behavior is inline with the documented conservative behavior of the Transform dialect's TrackingListener. Reviewed By: springerm Differential Revision: https://reviews.llvm.org/D158635 | 2 年前 | |
[mlir][transform] Add an op for replacing values with function calls (#78398) Adds transform.func.cast_and_call that takes a set of inputs and outputs and replaces the uses of those outputs with a call to a function at a specified insertion point. The idea with this operation is to allow users to author independent IR outside of a to-be-compiled module, and then match and replace a slice of the program with a call to the external function. Additionally adds a mechanism for populating a type converter with a set of conversion materialization functions that allow insertion of casts on the inputs/outputs to and from the types of the function signature. | 2 年前 | |
[mlir] use transform-interpreter in test passes (#70040) Update most test passes to use the transform-interpreter pass instead of the test-transform-dialect-interpreter-pass. The new "main" interpreter pass has a named entry point instead of looking up the top-level op with PossibleTopLevelOpTrait, which is arguably a more understandable interface. The change is mechanical, rewriting an unnamed sequence into a named one and wrapping the transform IR in to a module when necessary. Add an option to the transform-interpreter pass to target a tagged payload op instead of the root anchor op, which is also useful for repro generation. Only the test in the transform dialect proper and the examples have not been updated yet. These will be updated separately after a more careful consideration of testing coverage of the transform interpreter logic. | 2 年前 | |
[mlir][tensor] Make tensor::PadOp a ReifyRankedShapedTypeOpInterface (#145867) Co-authored-by: Fabian Mora <fmora.dev@gmail.com> | 1 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 1 年前 | ||
| 1 年前 | ||
| 8 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 |