| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[Linalg] Add *Conv1D* matchers (#168050) -- This commit is the second in the series of adding matchers for linalg.*conv*/*pool*. Refer: https://github.com/llvm/llvm-project/pull/163724 -- In this commit all variants of Conv1D convolution ops have been added. -- For sake of completion for a specific infra required for those ops which don't require dilations/strides information during their creation, this commit also includes a basic Conv2D and Conv3D op as part of the lit test. Signed-off-by: Abhishek Varma <abhvarma@amd.com> | 9 个月前 | |
[mlir][linalg] Morphism across linalg -- named, category and generic ops. (#148424) Adds linalg-morph-ops pass to convert an op from one representation to another: named-op <--> category_op (elementwise, contraction, ..) <--> generic e.g. mlir %exp = linalg.exp ins(%A : tensor<16x8xf32>) outs(%B : tensor<16x8xf32>) -> tensor<16x8xf32> After mlir-opt -linalg-morph-ops=named-to-category .. ``mlir %0 = linalg.elementwise kind=#linalg.elementwise_kind<exp> ins(%arg0 : tensor<16x8xf32> .. Note: this is generalization of --linalg-generalize-named-ops is the path named-op --> generic-op --linalg-specialize-generic-ops is the path named-op <-- generic-op` email: quic_mabsar@quicinc.com | 1 年前 | |
[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][vector] Missing indices on vectorization of 1-d reduction to 1-ranked memref (#166959) Vectorization of a 1-d reduction where the output variable is a 1-ranked memref can generate an invalid vector.transfer_write with no indices for the memref, e.g.: vector.transfer_write"(%vec, %buff) <{...}> : (vector<f32>, memref<1xf32>) -> () This patch solves the problem by providing the expected amount of indices (i.e. matching the rank of the memref). | 9 个月前 | |
[mlir][Linalg] NFC - Retire LinalgToLLVM pass | 3 年前 | |
[MLIR][Linalg] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
[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] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
[MLIR] Generalize expand_shape to take shape as explicit input (#90040) This patch generalizes tensor.expand_shape and memref.expand_shape to consume the output shape as a list of SSA values. This enables us to implement generic reshape operations with dynamic shapes using collapse_shape/expand_shape pairs. The output_shape input to expand_shape follows the static/dynamic representation that's also used in tensor.extract_slice. Differential Revision: https://reviews.llvm.org/D140821 --------- Signed-off-by: Gaurav Shukla<gaurav.shukla@amd.com> Signed-off-by: Gaurav Shukla <gaurav.shukla@amd.com> Co-authored-by: Ramiro Leal-Cavazos <ramiroleal050@gmail.com> | 2 年前 | |
[mlir][bufferization][NFC] Rename to_memref to to_buffer (#137180) As part of the work on transitioning bufferization dialect, ops, and associated logic to operate on newly added type interfaces (see 00eaff3e9c897c263a879416d0f151d7ca7eeaff), rename the bufferization.to_memref to highlight the generic nature of the op. Bufferization process produces buffers while memref is a builtin type rather than a generic term. Preserve the current API (to_buffer still produces a memref), however, as the new type interfaces are not used yet. | 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. | 9 个月前 | |
[mlir][linalg] Fix memref type verification in CollapseLinalgDimensions (#147245) When collapsing linalg dimensions we check if its memref operands are guaranteed to be collapsible. However, we currently assume that the matching indexing map is the identity map. This commit modifies this behavior and checks if the memref is collapsible on the transformed dimensions. | 1 年前 | |
[mlir][linalg] Add linalg.transpose constant folding (#92589) There was existing support for constant folding a linalg.generic that was actually a transpose. This commit adds support for the named op, linalg.transpose, as well by making use of the LinalgOp interface. | 2 年前 | |
[MLIR][Transform] Consolidate result of structured.split into one list (#111171) Follow-up a review comment from https://github.com/llvm/llvm-project/pull/82792#discussion_r1604925239 as a separate PR: E.g.: %0:2 = transform.structured.split is changed to %t = transform.structured.split %0:2 = transform.split_handle %t | 1 年前 | |
[MLIR][Transform] Consolidate result of structured.split into one list (#111171) Follow-up a review comment from https://github.com/llvm/llvm-project/pull/82792#discussion_r1604925239 as a separate PR: E.g.: %0:2 = transform.structured.split is changed to %t = transform.structured.split %0:2 = transform.split_handle %t | 1 年前 | |
Revert "Revert "[mlir][linalg] Replace "string" iterator_types attr with enums in LinalgInterface."" With python code fixed. This reverts commit 41280908e43d47903960c66237ab49caa5641b4d. | 3 年前 | |
[mlir][linalg] Propagate filter tensor encoding in im2col (#160099) In the im2col decomposition, propagate the filter tensor encoding (if specified) through the tensor.collapse_shape op, so that it can be used by the consuming linalg.generic matmul op. Signed-off-by: Fabrizio Indirli <Fabrizio.Indirli@arm.com> | 10 个月前 | |
[mlir] Add helper to check elementwise-mappable ops with tensors and scalars (#154872) This patch introduces a more general helper for identifying elementwise-mappable operations. The existing utility, isElementwiseMappableOpOnRankedTensors, only accepted operations when all operands were ranked tensors. In practice, many elementwise operations in MLIR allow mixing tensor operands with scalars. The new helper relaxes the restriction by accepting operands that are either ranked tensors or “scalar-like” types. | 11 个月前 | |
[mlir][linalg] Use ub.poison in data layout propagation if a packed operand requires padding. (#159467) In the past, it was hard to set padding values because we did not have ub.poison. It is not always correct if we set zeros as padding values. Now we can use ub.poison in this case. The revision adds the support for setting padding value using ub.poison when padding is required in the propagation. Otherwise, it creates an invalid pack op. Additionally the revision adds a control option for allowing padding in the pattern which is false by default. To correctly do this, a new requirePaddingValueStrict method is added which assumes dynamic dims would mean padding is required. The revision also removes trailing white space in the lit test file. Co-authored-by : Nirvedh Meshram <nirvedh@gmail.com> --------- Signed-off-by: hanhanW <hanhan0912@gmail.com> Signed-off-by: Nirvedh Meshram <nirvedh@gmail.com> Co-authored-by: Nirvedh Meshram <nirvedh@gmail.com> | 10 个月前 | |
[mlir][linalg] unfold projected permutation. (#114704) Patterns to decompose the input operand(s) of a linalg.generic that has a projected permutation affine-map -- i.e. effectively a folded transpose, broadcast`, or a mixture of two -- into explicit transpose and broadcast. This is useful for instance when trying to recognize named ops. email: quic_mabsar@quicinc.com | 1 年前 | |
[mlir][NFC] Remove trailing whitespaces from *.td and *.mlir files. This is generated by running sed --in-place 's/[[:space:]]\+$//' mlir/**/*.td sed --in-place 's/[[:space:]]\+$//' mlir/**/*.mlir Reviewed By: rriddle, dcaballe Differential Revision: https://reviews.llvm.org/D138866 | 3 年前 | |
[mlir][linalg][nfc] Rename test files for linalg.{un}pack Following on from #123902, removes "tensor" from test file names for linalg.pack and linalg.unpack (which prior to #123902 were Tensor dialect Ops). To minimize PR noise, I am submitting this without a review. However, please ping me if you believe this or similar changes should be reviewed before merging. | 1 年前 | |
[mlir][linalg] Extend DecomposeOuterUnitDimsPackOpPattern (linalg.pack) (#162666) Similarly to #152960, this PR fixes getTiledOuterDims for linalg.pack by ensuring that the outer_dims_perm attributeis properly taken into account. This enables the main change in this PR: relaxing the constraints in * DecomposeOuterUnitDimsPackOpPattern. Specifically, the pattern is extended to allow non-unit untiled outer dimensions. For example: mlir func.func @example( %src: tensor<2x32x16x8xf32>, %dest: tensor<2x1x16x8x32xf32>) -> tensor<2x1x16x8x32xf32> { %pack = linalg.pack %src inner_dims_pos = [1] inner_tiles = [32] into %dest : tensor<2x32x16x8xf32> -> tensor<2x1x16x8x32xf32> return %pack : tensor<2x1x16x8x32xf32> } decomposes as: mlir func.func @example( %src: tensor<2x32x16x8xf32>, %dest: tensor<2x1x16x8x32xf32>) -> tensor<2x1x16x8x32xf32> { %0 = tensor.empty() : tensor<2x16x8x32xf32> %transposed = linalg.transpose ins(%src : tensor<2x32x16x8xf32>) outs(%init : tensor<2x16x8x32xf32>) permutation = [0, 2, 3, 1] %inserted_slice = tensor.insert_slice %transposed into %dest[0, 0, 0, 0, 0] [2, 1, 16, 8, 32] [1, 1, 1, 1, 1] : tensor<2x16x8x32xf32> into tensor<2x1x16x8x32xf32> return %inserted_slice : tensor<2x1x16x8x32xf32> } Importantly, this change makes DecomposeOuterUnitDimsPackOpPattern (the decomposition pattern for linalg.pack) consistent with the corresponding pattern for linalg.unpack: * DecomposeOuterUnitDimsUnPackOpPattern. One notable assumption remains: untiled outer dimensions are not permuted. This was already the case but is now explicitly documented. Co-authored by: Max Bartel <bartel@roofline.ai> | 10 个月前 | |
[mlir][linalg] Extract GeneralizePadOpPattern into a standalone transformation (#117329) Currently, GeneralizePadOpPattern is grouped under populatePadOpVectorizationPatterns. However, as noted in #111349, this transformation "decomposes" rather than "vectorizes" tensor.pad. As such, it functions as: * a vectorization _pre-processing_ transformation, not * a vectorization transformation itself. To clarify its purpose, this PR turns GeneralizePadOpPattern into a standalone transformation by: * introducing a dedicated populateDecomposePadPatterns method, * adding a apply_patterns.linalg.decompose_pad Transform Dialect Op, * removing it from populatePadOpVectorizationPatterns. In addition, to better reflect its role, it is renamed as "decomposition" rather then "generalization". This is in line with the recent renaming of similar ops, i.e. tensor.pack/tensor.unpack Ops in #116439. | 1 年前 | |
[mlir][linalg][nfc] Rename test files for linalg.{un}pack Following on from #123902, removes "tensor" from test file names for linalg.pack and linalg.unpack (which prior to #123902 were Tensor dialect Ops). To minimize PR noise, I am submitting this without a review. However, please ping me if you believe this or similar changes should be reviewed before merging. | 1 年前 | |
| 1 年前 | ||
[mlir][linalg][NFC] Remove references to IREE (#151825) | 1 年前 | |
[mlir][NFC] Remove trailing whitespaces from *.td and *.mlir files. This is generated by running sed --in-place 's/[[:space:]]\+$//' mlir/**/*.td sed --in-place 's/[[:space:]]\+$//' mlir/**/*.mlir Reviewed By: rriddle, dcaballe Differential Revision: https://reviews.llvm.org/D138866 | 3 年前 | |
[mlir] Fix block merging (#102038) With this PR I am trying to address: https://github.com/llvm/llvm-project/issues/63230. What changed: - While merging identical blocks, don't add a block argument if it is "identical" to another block argument. I.e., if the two block arguments refer to the same Value. The operations operands in the block will point to the argument we already inserted. This needs to happen to all the arguments we pass to the different successors of the parent block - After merged the blocks, get rid of "unnecessary" arguments. I.e., if all the predecessors pass the same block argument, there is no need to pass it as an argument. - This last simplification clashed with BufferDeallocationSimplification. The reason, I think, is that the two simplifications are clashing. I.e., BufferDeallocationSimplification contains an analysis based on the block structure. If we simplify the block structure (by merging and/or dropping block arguments) the analysis is invalid . The solution I found is to do a more prudent simplification when running that pass. **Note-1**: I ran all the integration tests (-DMLIR_INCLUDE_INTEGRATION_TESTS=ON) and they passed. **Note-2**: I fixed a bug found by @Dinistro in #97697 . The issue was that, when looking for redundant arguments, I was not considering that the block might have already some arguments. So the index (in the block args list) of the i-th newArgument is i+numOfOldArguments. | 2 年前 | |
[mlir] Fix block merging (#102038) With this PR I am trying to address: https://github.com/llvm/llvm-project/issues/63230. What changed: - While merging identical blocks, don't add a block argument if it is "identical" to another block argument. I.e., if the two block arguments refer to the same Value. The operations operands in the block will point to the argument we already inserted. This needs to happen to all the arguments we pass to the different successors of the parent block - After merged the blocks, get rid of "unnecessary" arguments. I.e., if all the predecessors pass the same block argument, there is no need to pass it as an argument. - This last simplification clashed with BufferDeallocationSimplification. The reason, I think, is that the two simplifications are clashing. I.e., BufferDeallocationSimplification contains an analysis based on the block structure. If we simplify the block structure (by merging and/or dropping block arguments) the analysis is invalid . The solution I found is to do a more prudent simplification when running that pass. **Note-1**: I ran all the integration tests (-DMLIR_INCLUDE_INTEGRATION_TESTS=ON) and they passed. **Note-2**: I fixed a bug found by @Dinistro in #97697 . The issue was that, when looking for redundant arguments, I was not considering that the block might have already some arguments. So the index (in the block args list) of the i-th newArgument is i+numOfOldArguments. | 2 年前 | |
[mlir][Pass] Include anchor op in -pass-pipeline In D134622 the printed form of a pass manager is changed to include the name of the op that the pass manager is anchored on. This updates the -pass-pipeline argument format to include the anchor op as well, so that the printed form of a pipeline can be directly passed to -pass-pipeline. In most cases this requires updating -pass-pipeline='pipeline' to -pass-pipeline='builtin.module(pipeline)'. This also fixes an outdated assert that prevented running a PassManager anchored on 'any'. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D134900 | 3 年前 | |
[mlir] Fix block merging (#102038) With this PR I am trying to address: https://github.com/llvm/llvm-project/issues/63230. What changed: - While merging identical blocks, don't add a block argument if it is "identical" to another block argument. I.e., if the two block arguments refer to the same Value. The operations operands in the block will point to the argument we already inserted. This needs to happen to all the arguments we pass to the different successors of the parent block - After merged the blocks, get rid of "unnecessary" arguments. I.e., if all the predecessors pass the same block argument, there is no need to pass it as an argument. - This last simplification clashed with BufferDeallocationSimplification. The reason, I think, is that the two simplifications are clashing. I.e., BufferDeallocationSimplification contains an analysis based on the block structure. If we simplify the block structure (by merging and/or dropping block arguments) the analysis is invalid . The solution I found is to do a more prudent simplification when running that pass. **Note-1**: I ran all the integration tests (-DMLIR_INCLUDE_INTEGRATION_TESTS=ON) and they passed. **Note-2**: I fixed a bug found by @Dinistro in #97697 . The issue was that, when looking for redundant arguments, I was not considering that the block might have already some arguments. So the index (in the block args list) of the i-th newArgument is i+numOfOldArguments. | 2 年前 | |
[mlir] Fix block merging (#102038) With this PR I am trying to address: https://github.com/llvm/llvm-project/issues/63230. What changed: - While merging identical blocks, don't add a block argument if it is "identical" to another block argument. I.e., if the two block arguments refer to the same Value. The operations operands in the block will point to the argument we already inserted. This needs to happen to all the arguments we pass to the different successors of the parent block - After merged the blocks, get rid of "unnecessary" arguments. I.e., if all the predecessors pass the same block argument, there is no need to pass it as an argument. - This last simplification clashed with BufferDeallocationSimplification. The reason, I think, is that the two simplifications are clashing. I.e., BufferDeallocationSimplification contains an analysis based on the block structure. If we simplify the block structure (by merging and/or dropping block arguments) the analysis is invalid . The solution I found is to do a more prudent simplification when running that pass. **Note-1**: I ran all the integration tests (-DMLIR_INCLUDE_INTEGRATION_TESTS=ON) and they passed. **Note-2**: I fixed a bug found by @Dinistro in #97697 . The issue was that, when looking for redundant arguments, I was not considering that the block might have already some arguments. So the index (in the block args list) of the i-th newArgument is i+numOfOldArguments. | 2 年前 | |
[mlir] Fix block merging (#102038) With this PR I am trying to address: https://github.com/llvm/llvm-project/issues/63230. What changed: - While merging identical blocks, don't add a block argument if it is "identical" to another block argument. I.e., if the two block arguments refer to the same Value. The operations operands in the block will point to the argument we already inserted. This needs to happen to all the arguments we pass to the different successors of the parent block - After merged the blocks, get rid of "unnecessary" arguments. I.e., if all the predecessors pass the same block argument, there is no need to pass it as an argument. - This last simplification clashed with BufferDeallocationSimplification. The reason, I think, is that the two simplifications are clashing. I.e., BufferDeallocationSimplification contains an analysis based on the block structure. If we simplify the block structure (by merging and/or dropping block arguments) the analysis is invalid . The solution I found is to do a more prudent simplification when running that pass. **Note-1**: I ran all the integration tests (-DMLIR_INCLUDE_INTEGRATION_TESTS=ON) and they passed. **Note-2**: I fixed a bug found by @Dinistro in #97697 . The issue was that, when looking for redundant arguments, I was not considering that the block might have already some arguments. So the index (in the block args list) of the i-th newArgument is i+numOfOldArguments. | 2 年前 | |
[MLIR] Add InParallelOpInterface for parallel combining operations (#157736) This commit: - Introduces a new InParallelOpInterface, along with the ParallelCombiningOpInterface, represent the parallel updating operations we have in a parallel loop of scf.forall. - Change the name of ParallelCombiningOpInterface to InParallelOpInterface as the naming was quite confusing. - ParallelCombiningOpInterface now is used to generalize operations that insert into shared tensors within parallel combining regions. Previously, only tensor.parallel_insert_slice was supported directly in scf.InParallelOp regions. - tensor.parallel_insert_slice now implements ParallelCombiningOpInterface. This change enables future extensions to support additional parallel combining operations beyond tensor.parallel_insert_slice, which have different update semantics, so the in_parallel region can correctly and safely represent these kinds of operation without potential mistakes such as races. Author credits: @qedawkins | 11 个月前 | |
[mlir][linalg] Fold duplicate and unused inputs in linalg.generic If an input bbArg is not used, its corresponding input operand is removed. If there are duplicate input operands or input operands that are also used as output operands, the duplicate input operands are removed. Output operands are never modified. Differential Revision: https://reviews.llvm.org/D139709 | 3 年前 | |
[mlir][NFC] Update textual references of func to func.func in Linalg tests The special case parsing of func operations is being removed. | 4 年前 | |
[MLIR] Generalize expand_shape to take shape as explicit input (#90040) This patch generalizes tensor.expand_shape and memref.expand_shape to consume the output shape as a list of SSA values. This enables us to implement generic reshape operations with dynamic shapes using collapse_shape/expand_shape pairs. The output_shape input to expand_shape follows the static/dynamic representation that's also used in tensor.extract_slice. Differential Revision: https://reviews.llvm.org/D140821 --------- Signed-off-by: Gaurav Shukla<gaurav.shukla@amd.com> Signed-off-by: Gaurav Shukla <gaurav.shukla@amd.com> Co-authored-by: Ramiro Leal-Cavazos <ramiroleal050@gmail.com> | 2 年前 | |
[mlir][transform] Emit error message with emitSilenceableFailure (#86146) The previous implementation used a notifyMatchFailure to emit failure message inappropriately and then used the emitDefaultSilenceableFailure. This patch changes this to use the more appropriate emitSilenceableFailure with error message. Additionally a failure test has been added. | 2 年前 | |
[MLIR][Linalg] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
[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][NFC] Update textual references of func to func.func in Linalg tests The special case parsing of func operations is being removed. | 4 年前 | |
[mlir][linalg] Fix partial fuse by collapse (#136326) Similar to FoldWithProducerReshapeOpByCollapsing, FoldReshapeWithGenericOpByCollapsing needs to be able to handle partial fusion of a reshape by collapsing. This means that the source of the generated expand_shape op (aka the collapsed linalg op) might not match the type of the original collapse_shape op. This change instead replaces the original linalg op with the new expand_shape op which is guaranteed to be the same type. Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu> | 1 年前 | |
[mlir][linalg] Fix to Elementwise Fusion when preserving results (#149843) In the linalg ElementwiseOpFusion transform, a pre-requisite for the fusion between a producer and consumer op is that the producer's output indexing map associated to the result to be fused must be invertible (e.g. a simple permutation). Before this patch, only the first output indexing map was being checked; this bug produced issues when the operand to fuse was not the 1st result of the producer op. For example, this situation arises when the producer op has multiple results because it's the result of previous fusions where the original result had been preserved: in these cases, the pass ought to check the indexing map of the result being fused, which is not necessarily the 1st one. Signed-off-by: Fabrizio Indirli <Fabrizio.Indirli@arm.com> | 1 年前 | |
[mlir][Linalg] Avoid unnecessary propagating producer result to fused op result. Elementwise op fusion conserves the result of the producer in the fused op, relying on later clean up patterns to drop unused results of the fused op. Instead, if the producer result has no other use apart from the consumer op, avoid making the producer result available in the fused node. This saves some unnecessary IR manipulations. Differential Revision: https://reviews.llvm.org/D138096 | 3 年前 | |
[MLIR][Linalg] Fix linalg crash during elementwise op fusion (#117667) isOpOperandCanBeDroppedAfterFusedLinalgs crashes when indexingMaps is empty. This can occur when producer only has DPS init operands and consumer only has a single DPS input operand (all operands are ignored and nothing gets added to indexingMaps). This is because concatAffineMaps wasn't handling the maps being empty properly. Similar to canOpOperandsBeDroppedImpl, I added an early return when the maps are of size zero. Additionally, concatAffineMaps's declaration comment says it returns an empty map when maps is empty but it has no way to get the MLIRContext needed to construct the empty affine map when the array is empty. So, I changed this to take the context. __NOTE: concatAffineMaps now takes an MLIRContext to be able to construct an empty map in the case where maps is empty.__ --------- Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu> Co-authored-by: Quinn Dawkins <quinn.dawkins@gmail.com> | 1 年前 | |
[mlir][Linalg] Make Elementwise op fusion return a map from existing values to values in the fused op. This replacement can be used to eliminate all uses of the producer/consumer for case where producer/consumer has other uses outside of the producer/consumer pair. This makes the producer/consumer dead. Add test and minor fixup to the test harness. Reviewed By: hanchung Differential Revision: https://reviews.llvm.org/D142848 | 3 年前 | |
[mlir][Linalg] Fix linalg.generic iteration domain collapse for dynamic dims (#118208) This pr fixes how iteration domain of linalg.generic is collapsed when fusing with tensor.expand_shape. Previously, the output_shape for tensor.expand shape was infered, which doesn't always work except some special cases. This patch makes the logic explicitly set the bounds of the new collapsed iteration domain, because we already know them. --------- Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com> | 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. | 9 个月前 | |
[MLIR][Linalg] Remove elemwise_unary and elemwise_binary (#147082) RFC: https://discourse.llvm.org/t/rfc-deprecate-linalg-elemwise-unary-and-elemwise-binary/87144 Remove the two operations and fix the tests by: * Cleaning simple operation tests of the old ops * Changing linalg.elemwise_{u|bi}nary with linalg.{exp|add} on transform tests * Changing some of the tests with linalg.elementwise instead, to broaden test coverage * Surgically removing the elemwise_* part in the Python tests * Update MLIR transform examples (text and tests) with linalg.elementwise instead Nothing else changed. | 1 年前 | |
[mlir][linalg] Prevent hoisting of transfer pairs in the presence of aliases (#145235) This patch adds additional checks to the hoisting logic to prevent hoisting of vector.transfer_read / vector.transfer_write pairs when the underlying memref has users that introduce aliases via operations implementing ViewLikeOpInterface. Note: This may conservatively block some valid hoisting opportunities and could affect performance. However, as demonstrated by the included tests, the current logic is too permissive and can lead to incorrect transformations. If this change prevents hoisting in cases that are provably safe, please share a minimal repro - I'm happy to explore ways to relax the check. Special treatment is given to memref.assume_alignment, mainly to accommodate recent updates in: * https://github.com/llvm/llvm-project/pull/139521 Note that such special casing does not scale and should generally be avoided. The current hoisting logic lacks robust alias analysis. While better support would require more work, the broader semantics of memref.assume_alignment remain somewhat unclear. It's possible this op may eventually be replaced with the "alignment" attribute added in: * https://github.com/llvm/llvm-project/pull/144344 | 1 年前 | |
| 1 年前 | ||
[mlir][NFC] Update textual references of func to func.func in Linalg tests The special case parsing of func operations is being removed. | 4 年前 | |
[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. | 9 个月前 | |
[MLIR][Linalg] Remove elemwise_unary and elemwise_binary (#147082) RFC: https://discourse.llvm.org/t/rfc-deprecate-linalg-elemwise-unary-and-elemwise-binary/87144 Remove the two operations and fix the tests by: * Cleaning simple operation tests of the old ops * Changing linalg.elemwise_{u|bi}nary with linalg.{exp|add} on transform tests * Changing some of the tests with linalg.elementwise instead, to broaden test coverage * Surgically removing the elemwise_* part in the Python tests * Update MLIR transform examples (text and tests) with linalg.elementwise instead Nothing else changed. | 1 年前 | |
[mlir][linalg][test] Fix flaky test linalg-morph-category-ops.mlir (#153080) This is another followup to a test added in #148424 that I missed in #152805 This test runs mlir-opt %s | mlir-opt %s | FileCheck to test the round trip behavior, but the second command takes input from the pipe, not the lit test, so it should be mlir-opt %s | mlir-opt | FileCheck. | 1 年前 | |
[mlir][linalg][test] Fix flaky test linalg-morph-multi-step.mlir (#152805) This test runs mlir-opt %s | mlir-opt %s | FileCheck to test the round trip behavior, but the second command takes input from the pipe, not the lit test, so it should be mlir-opt %s | mlir-opt | FileCheck. For some reason I haven't figured out, this causes ~50% flakiness when testing in certain environments (not reproducible in my shell, but reproduces in an internal buildbot), due to the pipeline raising SIGPIPE. Test added in #148424. | 1 年前 | |
[mlir] Add apply_patterns.linalg.generalize_pack_unpack TD Op (#116373) This PR introduces populateGeneralizePatterns, which collects the following patterns: * GeneralizeOuterUnitDimsPackOpPattern, * GeneralizeOuterUnitDimsUnPackOpPattern (currently a TODO). These patterns are wrapped in a new Transform Dialect Op: apply_patterns.linalg.generalize_pack_unpack. This Op facilitates creating more involved end-to-end compilation pipelines for tensor.pack and tensor.unpack operations. It will be required in an upcoming PR building on top of #115698. No new tests are added in this PR. Instead, existing tests from: * "generalize-tensor-pack.mlir" are reused. To achieve this: * I've updated the test to use transform.apply_patterns.linalg.generalize_pack_unpack instead of the flag --test-linalg-transform-patterns="test-generalize-tensor-pack", avoiding artificial tests solely for the TD Op. * The TD sequence is saved to a new file, "generalize_pack.mlir", and pre-loaded using the option: --transform-preload-library='transform-library-paths=%p/td/generalize_pack.mlir' This avoids duplicating the sequence for every "split" in the input file. * Added "lit.local.cfg" to exclude the "test/Dialect/Linalg/td" directory from test discovery, ensuring "generalize_pack.mlir" is not treated as a test file. | 1 年前 | |
[MLIR][Linalg] Introduce linalg.contract (#123618) A new op that allows for representing arbitrary contractions on operands of arbitrary rank, with arbitrary transposes and arbitrary broadcasts specified through its indexing_maps attribute. Supports the expected lowerings to linalg.generic and to vector.contract. Corresponding RFC is here: https://discourse.llvm.org/t/mlir-rfc-introduce-linalg-contract/83589 | 1 年前 | |
| 10 个月前 | ||
[mlir][transform] Add elementwise criteria to match.structured.body (#79626) As far as I am aware, there is no simple way to match on elementwise ops. I propose to add an elementwise criteria to the match.structured.body op. Although my only hesitation is that elementwise is not only determined by the body, but also the indexing maps. So if others find this too awkward, I can implement a separate match op instead. | 2 年前 | |
[mlir] add structured (Linalg) transform op matchers Add a set of transform operations into the "structured" extension of the Transform dialect that allow one to select transformation targets more specifically than the currently available matching. In particular, add the mechanism for identifying the producers of operands (input and init in destination-passing style) and users of results, as well as mechanisms for reasoning about the shape of the iteration space. Additionally, add several transform operations to manipulate parameters that could be useful to implement more advanced selectors. Specifically, new operations let one produce and compare parameter values to implement shape-driven transformations. New operations are placed in separate files to decrease compilation time. Some relayering of the extension is necessary to avoid repeated generation of enums. Depends on D148013 Depends on D148014 Depends on D148015 Reviewed By: chelini Differential Revision: https://reviews.llvm.org/D148017 | 3 年前 | |
[mlir] Add optimization to bubbleUpPadSlice pattern for no pad case (#135859) In cases where there is no padding on a dim, we do not need to compute new offsets, lengths and padding, for example the new test case added can just be lowered to %extracted_slice = tensor.extract_slice %arg0[%arg2, 1, 2] [%arg2, 2, 1] [1, 1, 1] : tensor<3x4x5xf32> to tensor<?x2x1xf32> without this PR we will have affine maps like #map = affine_map<()[s0] -> (3, s0)> #map1 = affine_map<()[s0, s1] -> (-s0 + 3, s1)> %0 = affine.min #map()[%arg2] %1 = affine.min #map1()[%0, %arg2] %extracted_slice = tensor.extract_slice %arg0[%0, 1, 2] [%1, 2, 1] [1, 1, 1] : tensor<3x4x5xf32> to tensor<?x2x1xf32> which are unnecessary Signed-off-by: Nirvedh <nirvedh@gmail.com> | 1 年前 | |
[MLIR][Transform] Consolidate result of structured.split into one list (#111171) Follow-up a review comment from https://github.com/llvm/llvm-project/pull/82792#discussion_r1604925239 as a separate PR: E.g.: %0:2 = transform.structured.split is changed to %t = transform.structured.split %0:2 = transform.split_handle %t | 1 年前 | |
[MLIR][Linalg] Ternary Op & Linalg select (#91461) Following #90236, adding select to linalg as arith.select. No implicit type casting. OpDSL doesn't expose a type restriction for bool, but I saw no reason in adding it (put a separate symbolic type and check the semantics in the builder). --------- Co-authored-by: Renato Golin <rengolin@systemcall.eu> Co-authored-by: Maksim Levental <maksim.levental@gmail.com> | 2 年前 | |
[MLIR][Linalg] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
[mlir][linalg][NFC] Cleanup: Drop linalg.inplaceable attribute bufferization.writable is used in most cases instead. All remaining test cases are updated. Some code that is no longer needed is deleted. Differential Revision: https://reviews.llvm.org/D129739 | 4 年前 | |
[MLIR][Linalg] Remove elemwise_unary and elemwise_binary (#147082) RFC: https://discourse.llvm.org/t/rfc-deprecate-linalg-elemwise-unary-and-elemwise-binary/87144 Remove the two operations and fix the tests by: * Cleaning simple operation tests of the old ops * Changing linalg.elemwise_{u|bi}nary with linalg.{exp|add} on transform tests * Changing some of the tests with linalg.elementwise instead, to broaden test coverage * Surgically removing the elemwise_* part in the Python tests * Update MLIR transform examples (text and tests) with linalg.elementwise instead Nothing else changed. | 1 年前 | |
[mlir][linalg] Fix for invalid IR in eliminate_empty_tensors (#73513) The transform.structured.eliminate_empty_tensors can produce mis-typed IR when traversing use-def chains past tensor reshaping operations for sharing candidates. This results in Linalg operations whose output types do not match their 'outs' arguments. This patch filters out candidate tensor.empty operations when their types do not match the candidate input operand. | 2 年前 | |
[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. | 9 个月前 | |
Revert "[MLIR] Make OneShotModuleBufferize use OpInterface (#110322)" (#113124) This reverts commit 2026501cf107fcb3cbd51026ba25fda3af823941. Failing bot: * https://lab.llvm.org/staging/#/builders/125/builds/389 | 1 年前 | |
[mlir][tensor] Make tensor::PadOp a ReifyRankedShapedTypeOpInterface (#145867) Co-authored-by: Fabian Mora <fmora.dev@gmail.com> | 1 年前 | |
[mlir][SCF] scf.parallel: Make reductions part of the terminator (#75314) This commit makes reductions part of the terminator. Instead of scf.yield, scf.reduce now terminates the body of scf.parallel ops. scf.reduce may contain an arbitrary number of reductions, with one region per reduction. Example: mlir %init = arith.constant 0.0 : f32 %r:2 = scf.parallel (%iv) = (%lb) to (%ub) step (%step) init (%init, %init) -> f32, f32 { %elem_to_reduce1 = load %buffer1[%iv] : memref<100xf32> %elem_to_reduce2 = load %buffer2[%iv] : memref<100xf32> scf.reduce(%elem_to_reduce1, %elem_to_reduce2 : f32, f32) { ^bb0(%lhs : f32, %rhs: f32): %res = arith.addf %lhs, %rhs : f32 scf.reduce.return %res : f32 }, { ^bb0(%lhs : f32, %rhs: f32): %res = arith.mulf %lhs, %rhs : f32 scf.reduce.return %res : f32 } } scf.reduce operations can no longer be interleaved with other ops in the body of scf.parallel. This simplifies the op and makes it possible to assign the RecursiveMemoryEffects trait to scf.reduce. (This was not possible before because the op was not a terminator, causing the op to be DCE'd.) | 2 年前 | |
[mlir][memref] Verify out-of-bounds access for memref.subview (#133086) * Improve the verifier of memref.subview to detect out-of-bounds extractions. * Improve the documentation of memref.subview to make clear that out-of-bounds extractions are not allowed. Rewrite examples to use the new strided<> notation instead of affine_map layout maps. Also remove all unrelated operations (memref.alloc) from the examples. * Fix various test cases where memref.subview ops ran out-of-bounds. * Update canonicalizations patterns to ensure that they do not fold IR if it would generate IR that no longer verifies. Related discussion on Discourse: https://discourse.llvm.org/t/out-of-bounds-semantics-of-memref-subview/85293 This is a re-upload of #131876, which was reverted due to failing GPU tests. These tests were faulty and fixed in #133051. | 1 年前 | |
[mlir][linalg] Allow promotion to use the original subview size (#144334) linalg promotion attempts to compute a constant upper bound for the allocated buffer size. Only when failed to compute an upperbound it fallbacks to the original subview size, which may be dynamic. Adding a promotion option to use the original subview size by default, thus minimizing the allocation size. Fixes #144268. | 1 年前 | |
[MLIR][Linalg] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
[MLIR] Generalize expand_shape to take shape as explicit input (#90040) This patch generalizes tensor.expand_shape and memref.expand_shape to consume the output shape as a list of SSA values. This enables us to implement generic reshape operations with dynamic shapes using collapse_shape/expand_shape pairs. The output_shape input to expand_shape follows the static/dynamic representation that's also used in tensor.extract_slice. Differential Revision: https://reviews.llvm.org/D140821 --------- Signed-off-by: Gaurav Shukla<gaurav.shukla@amd.com> Signed-off-by: Gaurav Shukla <gaurav.shukla@amd.com> Co-authored-by: Ramiro Leal-Cavazos <ramiroleal050@gmail.com> | 2 年前 | |
[mlir][Linalg] Allow expand shape propagation across linalg ops with dynamic shapes. (#127943) With tensor.expand_shape allowing expanding dynamic dimension into multiple dynamic dimension, adapt the reshape propagation through expansion to handle cases where one dynamic dimension is expanded into multiple dynamic dimension. --------- Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com> | 1 年前 | |
[mlir][tensor] Make tensor::PadOp a ReifyRankedShapedTypeOpInterface (#145867) Co-authored-by: Fabian Mora <fmora.dev@gmail.com> | 1 年前 | |
[mlir][linalg] raise generic to named ops. (#110421) Add support for specializing linalg.broadcast and linalg.transform from generic. Also, does some refactoring to reuse specialization checks, migrating some common uses to op interface methods. | 1 年前 | |
[MLIR][Linalg] Add pass to convert linalg.generic back to named ops (#95656) Add a new mlir-opt pass --linalg-specialize-generic-ops which lifts generic, where possible, to linalg named ops. Much like -linalg-generalize-named-ops lowers named ops to linalg.generic . Also add patterns to recognize contractions which can be specialized from linalg.generic to named op: linalg.{batch_}?matmul{_transpose_(a|b)}? | 2 年前 | |
[mlir][linalg] raise generic to named ops. (#110421) Add support for specializing linalg.broadcast and linalg.transform from generic. Also, does some refactoring to reuse specialization checks, migrating some common uses to op interface methods. | 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. | 9 个月前 | |
[MLIR] Fix test failures for generate-runtime-verification pass from PR #160331 (#162533) [MLIR] Fix test failures for generate-runtime-verification pass from PR #160331 PR #160331 introduced a mistake that removed the error message for generate-runtime-verification pass, leading to test failures during test-build-check-mlir-build-only-check-mlir. This patch restores the missing error message. In addition, for related tests, the op strings used in FileChecks are updated with the same op formats as used in input mlirs. Verified locally. Fixes post-merge regression from: https://github.com/llvm/llvm-project/pull/160331 | 10 个月前 | |
[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 年前 | |
[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][Linalg] Rename convolution pass (#154400) Rename the pass LinalgNamedOpConversionPass to SimplifyDepthwiseConvPass to avoid conflating it with the new morphisms we are creating between the norms. | 1 年前 | |
[mlir] Reapply "Loosen restrictions on folding dynamic reshapes" (#142827) The original PR https://github.com/llvm/llvm-project/pull/137963 had a nvidia bot failure. This appears to be a flaky test because rerunning the build was successful. This change needs commit 6f2ba47 to fix incorrect usage of getReassociationIndicesForCollapse. Reverts llvm/llvm-project#142639 Co-authored-by: Artem Gindinson <gindinson@roofline.ai> | 1 年前 | |
| 1 年前 | ||
[MLIR][Linalg] Add pass to convert linalg.generic back to named ops (#95656) Add a new mlir-opt pass --linalg-specialize-generic-ops which lifts generic, where possible, to linalg named ops. Much like -linalg-generalize-named-ops lowers named ops to linalg.generic . Also add patterns to recognize contractions which can be specialized from linalg.generic to named op: linalg.{batch_}?matmul{_transpose_(a|b)}? | 2 年前 | |
[mlir][Linalg] Fix crash in LinalgToStandard Properly handle appendMangledType failure instead of asserting. Fixes #59986. | 3 年前 | |
[mlir] Support rank-reduced extract_slice in ExtractSliceOfPadTensorSwapPattern (#138921) This PR fixes ExtractSliceOfPadTensorSwapPattern to support rank-reducing tensor.extract_slice ops, which were previously unhandled and could cause crashes. To support this, an additional tensor.extract_slice is inserted after tensor.pad to reduce the result rank. | 1 年前 | |
[mlir][linalg] Swap tensor.extract_slice(linalg.fill) This commit adds a pattern to swap tensor.extract_slice(linalg.fill(%cst, %init)) into linalg.fill(%cst, tensor.extract_slice(%init)) when the linalg.fill op have no other users. This helps to reduce the fill footprint. Reviewed By: mravishankar Differential Revision: https://reviews.llvm.org/D134102 | 3 年前 | |
[mlir][Linalg] Cleanup the drop unit dims pass in Linalg. TL;DR the following API functions have been merged void populateFoldUnitExtentDimsViaReshapesPatterns(RewritePatternSet &patterns); void populateFoldUnitExtentDimsViaSlicesPatterns(RewritePatternSet &patterns); into void populateFoldUnitExtentDimsPatterns(RewritePatternSet &patterns, ControlDropUnitDims &options); To use the previous functionality use ControlDropUnitDims options; // By default options.rankReductionStrategy is // ControlDropUnitDims::RankReductionStrategy::ReassociativeReshape. populateFoldUnitExtentDimsPatterns(patterns, options); and ControlDropUnitDims options; options.rankReductionStrategy = ControlDropUnitDims::RankReductionStrategy::ExtractInsertSlice populateFoldUnitExtentDimsPatterns(patterns, options); This pass is quite old and needed to be updated based on the current approach to transformations in Linalg - Instead of two patterns, one to just remove loop dimensions that are unit extent (and using 0 in the indexing maps), and another to drop the unit-extents in the operand shapes, combine into a single transformation. This avoid creating an intermediate step with indexing maps having 0's in the domains exp ressions. - Expose the core transformation as a utility function and add a pattern that calls this transformation. This is a mostly NFC change, apart from the API change and dropping the patterns/test that only dropped the loops that are unit extents. Differential Revision: https://reviews.llvm.org/D155518 | 3 年前 | |
[MLIR][Linalg] Fix insert_slice fusion with rank reduction (#130961) Insert_slice fusion with a linalg producer does not account for possible rank-reduction in the insert_slice return type. When that happens, a tensor.cast gets generated due to the type mismatch which is invalid for tensor with different rank. This later trips other pass. | 1 年前 | |
[mlir][transform] Consistent linalg transform op syntax for dynamic index lists (#90897) This patch is a first pass at making consistent syntax across the LinalgTransformOps that use dynamic index lists for size parameters. Previously, there were two different forms: inline types in the list, or place them in the functional style tuple. This patch goes for the latter. In order to do this, the printPackedOrDynamicIndexList, printDynamicIndexList and their parse counterparts were modified so that the types can be optionally provided to the corresponding custom directives. All affected ops now use tablegen assemblyFormat, so custom parse/print functions have been removed. There are a couple ops that will likely add dynamic size support, and once that happens it should be made sure that the assembly remains consistent with the changes in this patch. The affected ops are as follows: pack, pack_greedily, tile_using_forall. The tile_using_for and vectorize ops already used this syntax, but their custom assembly was removed. --------- Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com> | 2 年前 | |
[mlir][affine]introducing new symbol rules that the result of a Pure operation that whose operands are valid symbolic identifiers (#118478) introducing new symbol rules that the result of a Pure operation that whose operands are valid symbolic identifiers. | 1 年前 | |
[mlir] computeSliceParameters: Fix offset when m(0) != 0 (#122492) For affine maps where m(0) != 0, like affine_map<(d0) -> (d0 + 3) in %generic = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0 + 3)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%arg0: tensor<9xf32>) outs(%empty : tensor<6xf32>) { ^bb0(%in : f32, %out: f32): linalg.yield %in : f32 } -> tensor<6xf32> tiling currently computes the wrong slice offsets. When tiling above example with a size of 3, it would compute scf.for %i = ... %slice = tensor.extract_slice %arg0[%i + 3] [6] [1] linalg.generic {indexing_maps = [affine_map<(d0) -> (d0 + 3)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%slice: tensor<6xf32>) and thus apply the +3 twice (once in the extract slice and a second time in the linalg.generic). This PR fixes this to yield an offset of tensor.extract_slice %arg0[%i] [6] [1] instead. | 1 年前 | |
[mlir][transform] Consistent linalg transform op syntax for dynamic index lists (#90897) This patch is a first pass at making consistent syntax across the LinalgTransformOps that use dynamic index lists for size parameters. Previously, there were two different forms: inline types in the list, or place them in the functional style tuple. This patch goes for the latter. In order to do this, the printPackedOrDynamicIndexList, printDynamicIndexList and their parse counterparts were modified so that the types can be optionally provided to the corresponding custom directives. All affected ops now use tablegen assemblyFormat, so custom parse/print functions have been removed. There are a couple ops that will likely add dynamic size support, and once that happens it should be made sure that the assembly remains consistent with the changes in this patch. The affected ops are as follows: pack, pack_greedily, tile_using_forall. The tile_using_for and vectorize ops already used this syntax, but their custom assembly was removed. --------- Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com> | 2 年前 | |
[MLIR][Linalg] Introduce linalg.contract (#123618) A new op that allows for representing arbitrary contractions on operands of arbitrary rank, with arbitrary transposes and arbitrary broadcasts specified through its indexing_maps attribute. Supports the expected lowerings to linalg.generic and to vector.contract. Corresponding RFC is here: https://discourse.llvm.org/t/mlir-rfc-introduce-linalg-contract/83589 | 1 年前 | |
[MLIR][Linalg] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
Reapply "[mlir][linalg] Restrict linalg.pack to not have artificial padding." (#150675) (#150680) This reverts commit https://github.com/llvm/llvm-project/commit/0844812b2e9d7f5ab005223443791c9287bcf5a2 with a shape fix in https://github.com/llvm/llvm-project/commit/1db4c6b27500e686fad9e55bbbe7c7c68b246b7e The revision restrict the linalg.pack op to not have artificial padding semantics. E.g., the below is valid without the change, and it becomes invalid with the change. mlir func.func @foo(%src: tensor<9xf32>) -> tensor<100x8xf32> { %cst = arith.constant 0.000000e+00 : f32 %dest = tensor.empty() : tensor<100x8xf32> %pack = linalg.pack %src padding_value(%cst : f32) inner_dims_pos = [0] inner_tiles = [8] into %dest : tensor<9xf32> -> tensor<100x8xf32> return %pack : tensor<100x8xf32> } IMO, it is a misuse if we use pack ops with artificial padding sizes because the intention of the pack op is to relayout the source based on target intrinsics, etc. The output shape is expected to be tensor<2x8xf32>. If people need extra padding sizes, they can create a new pad op followed by the pack op. This also makes consumer tiling much easier because the consumer fusion does not support artificial padding sizes. It is very hard to make it work without using ad-hoc patterns because the tiling sizes are about source, which implies that you don't have a core_id/thread_id to write padding values to the whole tile. People may have a question how why pad tiling implementation works. The answer is that it creates an if-else branch to handle the case. In my experience, it is very struggle in transformation because most of the time people only need one side of the branch given that the tile sizes are usually greater than padding sizes. However, the implementation is conservatively correct in terms of semantics. Given that the introduction of pack op is to serve the relayout needs better, having the restriction makes sense to me. Removed tests: - no_bubble_up_pack_extending_dimension_through_expand_cannot_reassociate from data-layout-propagation.mlir: it is a dup test to bubble_up_pack_non_expanded_dims_through_expand after we fix the shape. - fuse_pack_consumer_with_untiled_extra_padding from tile-and-fuse-consumer.mlir: it was created for artificial padding in the consumer fusion implementation. The other changes in lit tests are just fixing the shape. --------- Signed-off-by: hanhanW <hanhan0912@gmail.com> | 1 年前 | |
[mlir][tensor] Make tensor::PadOp a ReifyRankedShapedTypeOpInterface (#145867) Co-authored-by: Fabian Mora <fmora.dev@gmail.com> | 1 年前 | |
[mlir][transform] Consistent linalg transform op syntax for dynamic index lists (#90897) This patch is a first pass at making consistent syntax across the LinalgTransformOps that use dynamic index lists for size parameters. Previously, there were two different forms: inline types in the list, or place them in the functional style tuple. This patch goes for the latter. In order to do this, the printPackedOrDynamicIndexList, printDynamicIndexList and their parse counterparts were modified so that the types can be optionally provided to the corresponding custom directives. All affected ops now use tablegen assemblyFormat, so custom parse/print functions have been removed. There are a couple ops that will likely add dynamic size support, and once that happens it should be made sure that the assembly remains consistent with the changes in this patch. The affected ops are as follows: pack, pack_greedily, tile_using_forall. The tile_using_for and vectorize ops already used this syntax, but their custom assembly was removed. --------- Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com> | 2 年前 | |
[mlir][linalg] Fix neutral elt for softmax (#118952) The decomposition of linalg.softmax uses maxnumf, but the identity element that is used in the generated code is the one for maximumf. They are not the same, as the identity for maxnumf is NaN, while the one of maximumf is -Infty. This is wrong and prevents the maxnumf from being folded. Related to #114595, which fixed the folder for maxnumf. | 1 年前 | |
[mlir][linalg-transform] dyn_cast DestinationStyleOpInterface and early return (#166299) Use dyn_cast instead of cast and early return if op does not implement the DestinationStyleOpInterface. Before the change the following IR would cause a segfault when the transform interpreter is run, where myop.a and myop.b implement the TilingInterface and not the DestinationStyleOpInterface. Tried looking for ops in the upstream dialect that implement the TilingInterface and not the DestinationStyleOpInterface to add a test but could not find any. mlir module { func.func @fuse(%arg0: tensor<4x4x4xf32>, %arg1: tensor<4x4x4xf32>) -> tensor<4x4x4xf32> { %mul = "myop.a"(%arg0, %arg1) : (tensor<4x4x4xf32>, tensor<4x4x4xf32>) -> tensor<4x4x4xf32> %add = "myop.b"(%mul, %mul) : (tensor<4x4x4xf32>, tensor<4x4x4xf32>) -> tensor<4x4x4xf32> return %add : tensor<4x4x4xf32> } transform.sequence failures(propagate) { ^bb0(%func: !transform.any_op): %mul = transform.structured.match ops{["myop.a"]} in %func : (!transform.any_op) -> !transform.any_op %add = transform.structured.match ops{["myop.b"]} in %func : (!transform.any_op) -> !transform.any_op %loop, %tiled = transform.structured.tile_using_forall %add tile_sizes [1, 2, 4] : (!transform.any_op) -> (!transform.any_op, !transform.any_op) %mul_fused, %mul_containing = transform.structured.fuse_into_containing_op %mul into %tiled : (!transform.any_op, !transform.any_op) -> (!transform.any_op, !transform.any_op) } } | 9 个月前 | |
[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} | 10 个月前 | |
[MLIR][Linalg] Remove elemwise_unary and elemwise_binary (#147082) RFC: https://discourse.llvm.org/t/rfc-deprecate-linalg-elemwise-unary-and-elemwise-binary/87144 Remove the two operations and fix the tests by: * Cleaning simple operation tests of the old ops * Changing linalg.elemwise_{u|bi}nary with linalg.{exp|add} on transform tests * Changing some of the tests with linalg.elementwise instead, to broaden test coverage * Surgically removing the elemwise_* part in the Python tests * Update MLIR transform examples (text and tests) with linalg.elementwise instead Nothing else changed. | 1 年前 | |
[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][Transform] Hoist Pad generates linalg.transpose (#109669) For readability purpose, generate linalg named ops when possible. For maintainability purpose, get rid of duplicated code. | 1 年前 | |
[MLIR][Transform] Hoist Pad generates linalg.transpose (#109669) For readability purpose, generate linalg named ops when possible. For maintainability purpose, get rid of duplicated code. | 1 年前 | |
[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] 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][Linalg] Add transform to convert linalg.copy into memref.copy (#132422) Targeted rewrite of a linalg.copy on memrefs to a memref.copy. This is useful when bufferizing copies to a linalg.copy, applying some transformations, and then rewriting the copy into a memref.copy. If the element types of the source and destination differ, or if the source is a scalar, the transform produces a silenceable failure. | 1 年前 | |
[mlir] introduce debug transform dialect extension (#77595) Introduce a new extension for simple print-debugging of the transform dialect scripts. The initial version of this extension consists of two ops that are printing the payload objects associated with transform dialect values. Similar ops were already available in the test extenion and several downstream projects, and were extensively used for testing. | 2 年前 | |
[mlir][nfc] Update Linalg matmul -> Vector OP test (#81416) Updates "transform-op-matmul-to-outerproduct.mlir". Summary: * refines TD sequence so that it's easier to reason about the compilation pipeline (e.g. transform.structured.vectorize_children_and_apply_patterns is replaced withtransform.structured.vectorize ), * new input dims to be able to distinguish parallel from reduction dims, * updates LIT variable names (makes the output easier to follow), * removes "noise" from the expected LIT output (e.g. types). These Linalg -> Vector tests using Transform Dialect are great reference points for constructing lowering pipelines. This simplification + clean-up will hopefully make it easier to follow. | 2 年前 | |
[mlir][transform] Consistent linalg transform op syntax for dynamic index lists (#90897) This patch is a first pass at making consistent syntax across the LinalgTransformOps that use dynamic index lists for size parameters. Previously, there were two different forms: inline types in the list, or place them in the functional style tuple. This patch goes for the latter. In order to do this, the printPackedOrDynamicIndexList, printDynamicIndexList and their parse counterparts were modified so that the types can be optionally provided to the corresponding custom directives. All affected ops now use tablegen assemblyFormat, so custom parse/print functions have been removed. There are a couple ops that will likely add dynamic size support, and once that happens it should be made sure that the assembly remains consistent with the changes in this patch. The affected ops are as follows: pack, pack_greedily, tile_using_forall. The tile_using_for and vectorize ops already used this syntax, but their custom assembly was removed. --------- Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com> | 2 年前 | |
[mlir] introduce debug transform dialect extension (#77595) Introduce a new extension for simple print-debugging of the transform dialect scripts. The initial version of this extension consists of two ops that are printing the payload objects associated with transform dialect values. Similar ops were already available in the test extenion and several downstream projects, and were extensively used for testing. | 2 年前 | |
[mlir] Fix crash when verifying linalg.transpose (#131733) Adds checks in isPermutationVector for indices that are outside of the bounds and removes the assert. Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu> | 1 年前 | |
[mlir][linalg] Fix padding shape computation in PadTilingInterface for convs (#149576) This PR fixes the computation of padded shapes for convolution-style affine maps (e.g., d0 + d1) in PadTilingInterface. Previously, the codes used the direct sum of loop upper bounds, leading to over-padding. For example, the following conv_2d_nhwc_fhwc op, if only padding the c dimensions to multiples of 16, it also incorrectly pads the convolved dimensions and generates the wrong input shape as: %padded = tensor.pad %arg0 low[0, 0, 0, 0] high[0, 1, 1, 12] { ^bb0(%arg3: index, %arg4: index, %arg5: index, %arg6: index): tensor.yield %cst : f32 } : tensor<1x16x16x4xf32> to tensor<1x17x17x16xf32> %padded_0 = tensor.pad %arg1 low[0, 0, 0, 0] high[0, 0, 0, 12] { ^bb0(%arg3: index, %arg4: index, %arg5: index, %arg6: index): tensor.yield %cst : f32 } : tensor<16x3x3x4xf32> to tensor<16x3x3x16xf32> %0 = linalg.conv_2d_nhwc_fhwc {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} ins(%padded, %padded_0 : tensor<1x17x17x16xf32>, tensor<16x3x3x16xf32>) outs(%arg2 : tensor<1x14x14x16xf32>) -> tensor<1x14x14x16xf32> return %0 : tensor<1x14x14x16xf32> The new implementation uses the maximum accessed index as the input for affine map and then adds 1 after aggregating all the terms to get the final padded size. This fixed https://github.com/llvm/llvm-project/issues/148679. | 1 年前 | |
[mlir][TD] Support padding with poison (#152003) Signed-off-by: James Newling <james.newling@gmail.com> | 1 年前 | |
[MLIR][Linalg] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
[mlir][transform] Consistent linalg transform op syntax for dynamic index lists (#90897) This patch is a first pass at making consistent syntax across the LinalgTransformOps that use dynamic index lists for size parameters. Previously, there were two different forms: inline types in the list, or place them in the functional style tuple. This patch goes for the latter. In order to do this, the printPackedOrDynamicIndexList, printDynamicIndexList and their parse counterparts were modified so that the types can be optionally provided to the corresponding custom directives. All affected ops now use tablegen assemblyFormat, so custom parse/print functions have been removed. There are a couple ops that will likely add dynamic size support, and once that happens it should be made sure that the assembly remains consistent with the changes in this patch. The affected ops are as follows: pack, pack_greedily, tile_using_forall. The tile_using_for and vectorize ops already used this syntax, but their custom assembly was removed. --------- Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com> | 2 年前 | |
[mlir][transform] Consistent linalg transform op syntax for dynamic index lists (#90897) This patch is a first pass at making consistent syntax across the LinalgTransformOps that use dynamic index lists for size parameters. Previously, there were two different forms: inline types in the list, or place them in the functional style tuple. This patch goes for the latter. In order to do this, the printPackedOrDynamicIndexList, printDynamicIndexList and their parse counterparts were modified so that the types can be optionally provided to the corresponding custom directives. All affected ops now use tablegen assemblyFormat, so custom parse/print functions have been removed. There are a couple ops that will likely add dynamic size support, and once that happens it should be made sure that the assembly remains consistent with the changes in this patch. The affected ops are as follows: pack, pack_greedily, tile_using_forall. The tile_using_for and vectorize ops already used this syntax, but their custom assembly was removed. --------- Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com> | 2 年前 | |
[mlir][Symbol] Add verification that symbol's parent is a SymbolTable (#80590) Following the discussion in https://discourse.llvm.org/t/symboltable-and-symbol-parent-child-relationship/75446, we should enforce that a symbol's immediate parent is a symbol table. I changed some tests to pass the verification. In most cases, we can wrap the func with a module, change the func to another op with regions i.e. scf.if, or change the expected error message. --------- Co-authored-by: Mehdi Amini <joker.eph@gmail.com> | 2 年前 | |
[mlir][tensor] Make tensor::PadOp a ReifyRankedShapedTypeOpInterface (#145867) Co-authored-by: Fabian Mora <fmora.dev@gmail.com> | 1 年前 | |
[mlir][transform] Consistent linalg transform op syntax for dynamic index lists (#90897) This patch is a first pass at making consistent syntax across the LinalgTransformOps that use dynamic index lists for size parameters. Previously, there were two different forms: inline types in the list, or place them in the functional style tuple. This patch goes for the latter. In order to do this, the printPackedOrDynamicIndexList, printDynamicIndexList and their parse counterparts were modified so that the types can be optionally provided to the corresponding custom directives. All affected ops now use tablegen assemblyFormat, so custom parse/print functions have been removed. There are a couple ops that will likely add dynamic size support, and once that happens it should be made sure that the assembly remains consistent with the changes in this patch. The affected ops are as follows: pack, pack_greedily, tile_using_forall. The tile_using_for and vectorize ops already used this syntax, but their custom assembly was removed. --------- Co-authored-by: Oleksandr "Alex" Zinenko <ftynse@gmail.com> | 2 年前 | |
[MLIR][Linalg] Add pass to convert linalg.generic back to named ops (#95656) Add a new mlir-opt pass --linalg-specialize-generic-ops which lifts generic, where possible, to linalg named ops. Much like -linalg-generalize-named-ops lowers named ops to linalg.generic . Also add patterns to recognize contractions which can be specialized from linalg.generic to named op: linalg.{batch_}?matmul{_transpose_(a|b)}? | 2 年前 | |
[MLIR][Linalg] Add pass to convert linalg.generic back to named ops (#95656) Add a new mlir-opt pass --linalg-specialize-generic-ops which lifts generic, where possible, to linalg named ops. Much like -linalg-generalize-named-ops lowers named ops to linalg.generic . Also add patterns to recognize contractions which can be specialized from linalg.generic to named op: linalg.{batch_}?matmul{_transpose_(a|b)}? | 2 年前 | |
[MLIR][Linalg] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
[mlir][linalg] Add support for inlined const to isaFillOpInterface (#144870) | 1 年前 | |
[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][arith] Add neutral element support to arith.maxnumf/arith.minnumf (#93278) For maxnumf and minnumf, the result of calculations involving NaN will be another value, so their neutral element is set to NaN. | 2 年前 | |
[mlir][affine]introducing new symbol rules that the result of a Pure operation that whose operands are valid symbolic identifiers (#118478) introducing new symbol rules that the result of a Pure operation that whose operands are valid symbolic identifiers. | 1 年前 | |
[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][scf] Modify the return logic of generateLoopNestUsingForOp (NFC) (#159394) When loops is empty, avoid executing yieldTiledValuesFn and Add a test which all tile sizes are set to zero. | 11 个月前 | |
[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] Improve error message when number of operands and types differ (#118488) If using a variadic operand, the error message given if the number of types and operands do not match would be along the lines of: 3 operands present, but expected 2 This error message is confusing for multiple reasons, particular for beginners: * If the intention is to have 3 operands, it does not point out why it expects 2. The user may actually just want to add a type to the type list * It reads as if a verifier error rather than a parser error, giving the impression the Op only supports 2 operands. This PR attempts to improve the error message by first noting the issue ("number of operands and types mismatch") and mentioning how many operands and types it received. | 1 年前 | |
[MLIR][Transform] Consolidate result of structured.split into one list (#111171) Follow-up a review comment from https://github.com/llvm/llvm-project/pull/82792#discussion_r1604925239 as a separate PR: E.g.: %0:2 = transform.structured.split is changed to %t = transform.structured.split %0:2 = transform.split_handle %t | 1 年前 | |
[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][nfc] Delete references to args_in/args_out (#111517) After the refactor in: * ed229132f1c4ea2ba0644fc345d8279e47a00565, the args_in and args_out attributes are no longer used by linalg.generic. This patch removes most the remaining references. I've left out BufferDeallocationInternals.md, which doesn't seem maintained anymore and is quite out of sync with other bits of MLIR (e.g. test.generic instead of linalg.generic). | 1 年前 | |
[mlir][memref] Improve memref.subview type inference (#96421) The memref.subview result type inference (SubViewOp::inferResultType) sometimes used to produce a dynamic offset when a static offset is possible. When a dynamic value (stride, size, etc.) is multiplied with zero, the result is always a "static 0". Based on this, the result type inference implementation can be improved to produce more static type information in memref types. | 2 年前 | |
[mlir][SCF] Add scf::tileAndFuseConsumer that tiles a consumer into a given tiled loop nest. (#167634) The existing scf::tileAndFuseConsumerOfSlices takes a list of slices (and loops they are part of), tries to find the consumer of these slices (all slices are expected to be the same consumer), and then tiles the consumer into the loop nest using the TilingInterface. A more natural way of doing consumer fusion is to just start from the consumer, look for operands that are produced by the loop nest passed in as loops (presumably these loops are generated by tiling, but that is not a requirement for consumer fusion). Using the consumer you can find the slices of the operands that are accessed within the loop which you can then use to tile and fuse the consumer (using TilingInterface). This handles more naturally the case where multiple operands of the consumer come from the loop nest. The scf::tileAndFuseConsumerOfSlices was implemented as a mirror of scf::tileAndFuseProducerOfSlice. For the latter, the slice has a single producer for the source of the slice, which makes it a natural way of specifying producer fusion. But for consumers, the result might have multiple users, resulting in multiple candidates for fusion, as well as a fusion candidate using multiple results from the tiled loop nest. This means using slices (tensor.insert_slice/tensor.parallel_insert_slice) as a hook for consumer fusion turns out to be quite hard to navigate. The use of the consumer directly avoids all those pain points. In time the scf::tileAndFuseConsumerOfSlices should be deprecated in favor of scf::tileAndFuseConsumer. There is a lot of tech-debt that has accumulated in scf::tileAndFuseConsumerOfSlices that needs to be cleanedup. So while that gets cleaned up, and required functionality is moved to scf::tileAndFuseConsumer, the old path is still maintained. The test for scf::tileAndFuseConsumerUsingSlices is copied to tile-and-fuse-consumer.mlir to tile-and-fuse-consumer-using-slices.mlir. All the tests that were there in this file are now using the tileAndFuseConsumer method. The test op test.tile_and_fuse_consumer is modified to call scf::tileAndFuseConsumer, while a new op test.tile_and_fuse_consumer_of_slice is used to keep the old path tested while it is deprecated. --------- Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com> | 9 个月前 | |
[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][linalg] Constrain the parameters m, r in Winograd ops (#144657) We only support fixed set of minimum filtering algorithm for Winograd Conv2D decomposition. Instead of letting users specify any integer, define a fixed set of enumeration values for the parameters of minimum filtering algorithm. | 1 年前 | |
[mlir][TilingInterface] Allow tile and fuse to work with ReductionTilingStrategy::PartialReductionOuterParallelStrategy. (#147593) Since scf::tileUsingSCF is the core method used for tiling the root operation within the scf::tileConsumersAndFuseProducersUsingSCF, the latter can fuse into any tiled loop generated using scf::tileUsingSCF. This patch adds a test for tiling a root operation using ReductionTilingStrategy::PartialReductionOuterParallelStrategy and fusing producers with it. Since this strategy generates a rank-reducing extract slice tensor::replaceExtractSliceWithTiledProducer which is the core method used for the fusion was extended to handle the rank-reducing slices. Also fix a small bug in the computation of the reduction induction variable (which needs to use floorDiv instead of ceilDiv) Signed-off-by: MaheshRavishankar <mahesh.ravishankar@gmail.com> | 1 年前 | |
[mlir][linalg] Constrain the parameters m, r in Winograd ops (#144657) We only support fixed set of minimum filtering algorithm for Winograd Conv2D decomposition. Instead of letting users specify any integer, define a fixed set of enumeration values for the parameters of minimum filtering algorithm. | 1 年前 | |
[mlir][linalg] Constrain the parameters m, r in Winograd ops (#144657) We only support fixed set of minimum filtering algorithm for Winograd Conv2D decomposition. Instead of letting users specify any integer, define a fixed set of enumeration values for the parameters of minimum filtering algorithm. | 1 年前 | |
[MLIR][Linalg] (NFC) Drop verify-diagnostics from transpose-conv2d.mlir We are not checking diagnostics in this test. | 2 年前 | |
| 2 年前 | ||
| 2 年前 | ||
[MLIR][Linalg] Remove matmul_transpose variants (#147961) Removes the (batch_)matmul_transpose_{a|b} variants from OpDSL and replace it with matmul affine_maps [...] whenever appropriate. This is in line with the [plan](https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863), and can be done since #104783 merged. See: https://discourse.llvm.org/t/deprecate-batch-matmul-transpose-a-b-linalg-operations/87245 Issues investigated: * pad transform tests that could use matmul instead, so change to that. * ArmSME test using transpose actually needed it, so changed to matmul + affine maps. Arm tests validated by @banach-space (thanks!!). | 1 年前 | |
[mlir][GPU] Implement ValueBoundsOpInterface for GPU ID operations (#122190) The GPU ID operations already implement InferIntRangeInterface, which gives constant lower and upper bounds on those IDs when appropriate metadata is prentent on the operations or in the surrounding context. This commit uses that existing code to implement the ValueBoundsOpInterface, which is used when analyzing affine operations (unlike the integer range interface, which is used for arithmetic optimization). It also implements the interface for gpu.launch, where we can use it to express the constraint that block/grid sizes are equal to their value from outside the launch op and that the corresponding IDs are bounded above by that size. As a consequence, the test pass for this inference is updated to work on a FunctionOpInterface and not a func.func, creating minor churn in other tests. | 1 年前 | |
[MLIR][Linalg] Fix winograd op lowering for types smaller than f32 (#158500) The winograd transform constant array is always emitted as f32, but previously the creation would pass through the original type. If this type was smaller (like f16), you would get an assertion failure during attribute creation. This fixes this by ensuring that the types match and adding a test for this case. | 10 个月前 | |
[mlir][linalg] Constrain the parameters m, r in Winograd ops (#144657) We only support fixed set of minimum filtering algorithm for Winograd Conv2D decomposition. Instead of letting users specify any integer, define a fixed set of enumeration values for the parameters of minimum filtering algorithm. | 1 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 9 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 10 个月前 | ||
| 11 个月前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 11 个月前 | ||
| 3 年前 | ||
| 4 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 4 年前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 4 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 9 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 9 个月前 | ||
| 10 个月前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 11 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 9 个月前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 年前 | ||
| 1 年前 | ||
| 10 个月前 | ||
| 1 年前 |