summaryrefslogtreecommitdiff
path: root/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
AgeCommit message (Collapse)Author
2025-07-22[mlir][NFC] update `mlir/Dialect` create APIs (21/n) (#149928)Maksim Levental
See https://github.com/llvm/llvm-project/pull/147168 for more info.
2025-07-12[mlir] Remove unused includes (NFC) (#148396)Kazu Hirata
2025-05-13[mlir] Use llvm::is_contained (NFC) (#139834)Kazu Hirata
2025-03-17[mlir] Use `getSingleElement`/`hasSingleElement` in various places (#131460)Matthias Springer
This is a code cleanup. Update a few places in MLIR that should use `hasSingleElement`/`getSingleElement`. Note: `hasSingleElement` is faster than `.getSize() == 1` when it is used with linked lists etc. Depends on #131508.
2024-08-20[mlir][sparse] support sparsification to coiterate operations. (#102546)Peiming Liu
2024-07-31[mlir][sparse] implement `sparse_tensor.extract_value` operation. (#101220)Peiming Liu
2024-06-17[mlir][sparse] support sparsifying sparse kernels to sparse-iterator-based ↵Peiming Liu
loop (#95858)
2024-04-29[mlir][sparse] fold explicit value during sparsification (#90530)Aart Bik
This ensures the explicit value is generated (and not a load into the values array). Note that actually not storing values array at all is still TBD, this is just the very first step.
2024-04-26[mlir][sparse] fold sparse convert into producer linalg op. (#89999)Peiming Liu
2024-03-12[mlir][sparse] reuse tensor.insert operation to insert elements into … ↵Peiming Liu
(#84987) …a sparse tensor.
2024-03-04[mlir][sparse] support sparsifying batch levels (#83898)Peiming Liu
2024-02-08[mlir][sparse] Implement parsing n out of m (#79935)Yinying Li
1. Add parsing methods for block[n, m]. 2. Encode n and m with the newly extended 64-bit LevelType enum. 3. Update 2:4 methods names/comments to n:m.
2024-02-01[mlir][sparse] Support pretty print to debug sparse iteration. (#80207)Peiming Liu
2024-01-24[mlir][sparse] setup `SparseIterator` to help generating code to traverse a ↵Peiming Liu
sparse tensor level. (#78345)
2024-01-17[mlir][IR] Rename "update root" to "modify op" in rewriter API (#78260)Matthias Springer
This commit renames 4 pattern rewriter API functions: * `updateRootInPlace` -> `modifyOpInPlace` * `startRootUpdate` -> `startOpModification` * `finalizeRootUpdate` -> `finalizeOpModification` * `cancelRootUpdate` -> `cancelOpModification` The term "root" is a misnomer. The root is the op that a rewrite pattern matches against (https://mlir.llvm.org/docs/PatternRewriter/#root-operation-name-optional). A rewriter must be notified of all in-place op modifications, not just in-place modifications of the root (https://mlir.llvm.org/docs/PatternRewriter/#pattern-rewriter). The old function names were confusing and have contributed to various broken rewrite patterns. Note: The new function names use the term "modify" instead of "update" for consistency with the `RewriterBase::Listener` terminology (`notifyOperationModified`).
2024-01-12[mlir][Interfaces] `DestinationStyleOpInterface`: Rename ↵Matthias Springer
`hasTensor/BufferSemantics` (#77574) Rename interface functions as follows: * `hasTensorSemantics` -> `hasPureTensorSemantics` * `hasBufferSemantics` -> `hasPureBufferSemantics` These two functions return "true" if the op has tensor/buffer operands but not buffer/tensor operands. Also drop the "ranked" part from the interface, i.e., do not distinguish between ranked/unranked types. The new function names describe the functions more accurately. They also align their semantics with the notion of "tensor semantics" with the bufferization framework. (An op is supposed to be bufferized if it has tensor operands, and we don't care if it also has memref operands.) This change is in preparation of #75273, which adds `BufferizableOpInterface::hasTensorSemantics`. By renaming the functions in the `DestinationStyleOpInterface`, we can avoid name clashes between the two interfaces.
2024-01-02[mlir][sparse] use a common util function to query the tensor level s… ↵Peiming Liu
(#76764) …et in a lattice point.
2023-12-12[mlir][sparse] refactor utilities into transform/utils dir (#75250)Aart Bik
Separates actual transformation files from supporting utility files in the transforms directory. Includes a bazel overlay fix for the build (as well as a bit of cleanup of that file to be less verbose and more flexible).
2023-12-12[mlir][sparse] cleanup of CodegenEnv reduction API (#75243)Aart Bik
2023-12-11[mlir][sparse] fix bug in custom reduction scalarization code (#74898)Aart Bik
Bug found with BSR of "spy" SDDMM method
2023-12-06[mlir][sparse] use "current" and "curr" consistently (#74656)Aart Bik
Removes at in favor of curr; also makes method delegates consistent
2023-12-06[mlir][sparse] cleanup ldx/idx/depth/at usage (#74654)Aart Bik
This adds a consistent usage with `at` for everything that refers to the current loop nesting. This cleans up some redundant legacy code from when we were still using topSort inside sparsifier code.
2023-12-06[mlir][sparse] remove LoopOrd type (#74540)Aart Bik
Rationale: We no longer deal with topsort during sparsification, so that LoopId == LoopOrd for all methods. This first revision removes the types. A follow up revision will simplify some other remaining constructs that deal with loop order (e.g. at and ldx).
2023-12-05[mlir][sparse] minor refactoring of sparsification file (#74403)Aart Bik
Removed obsoleted TODOs and NOTEs, formatting, removed unused parameter
2023-11-27[mlir][sparse] code simplification: always use synthetical tensor for… ↵Peiming Liu
(#73597) … loop bound.
2023-11-27[mlir][sparse] rename DimLevelType to LevelType (#73561)Aart Bik
The "Dim" prefix is a legacy left-over that no longer makes sense, since we have a very strict "Dimension" vs. "Level" definition for sparse tensor types and their storage.
2023-11-22[mlir][sparse] change dim level type -> level type (#73058)Aart Bik
The "dimension" before "level" does not really make sense Note that renaming the actual type DimLevelType to LevelType is still TBD, since this is an externally visible change (e.g. visible to Python API).
2023-11-16[mlir][sparse] code cleanup (remove dead code related to filter loop). (#72573)Peiming Liu
2023-11-16[mlir][sparse] code cleanup (remove topSort in CodegenEnv). (#72550)Peiming Liu
2023-11-15[mlir][sparse] schedule sparse kernels in a separate pass from ↵Peiming Liu
sparsification. (#72423)
2023-11-14[mlir][affine][nfc] cleanup deprecated T.cast style functions (#71269)long.chen
detail see the docment: https://mlir.llvm.org/deprecation/ Not all changes are made manually, most of them are made through a clang tool I wrote https://github.com/lipracer/cpp-refactor.
2023-11-13[mlir][sparse] remove filter-loop based algorithm support to handle a… ↵Peiming Liu
(#71840) …ffine subscript expressions.
2023-11-10[mlir][sparse] support sparsifying 2:4 block sparsity (#71749)Peiming Liu
2023-11-07Changed the phrase sparse-compiler to sparsifier in comments (#71578)Tim Harvey
When the Powers That Be decided that the name "sparse compiler" should be changed to "sparsifier", we negected to change some of the comments in the code; this pull request completes the name change.
2023-10-25[mlir][sparse] test for linalg tensor semantics (#70254)Aart Bik
This test used to be here, but somehow got lost while linalg rewrote their interfaces. It is essential to test this on entry of sparsification, however, since all subsequent analysis simply assumes tensor types. Fixes: https://github.com/llvm/llvm-project/issues/64325
2023-10-02[mlir][sparse] Fix typos (#67859)Yinying Li
2023-10-02[mlir][sparse] Update Enum name for CompressedWithHigh (#67845)Yinying Li
Change CompressedWithHigh to LooseCompressed.
2023-09-14[mlir][sparse] Migrate more tests to use new syntax (#66443)Yinying Li
**Dense** `lvlTypes = [ "dense", "dense" ]` to `map = (d0, d1) -> (d0 : dense, d1 : dense)` `lvlTypes = [ "dense", "dense" ], dimToLvl = affine_map<(i,j) -> (j,i)>` to `map = (d0, d1) -> (d1 : dense, d0 : dense)` **DCSR** `lvlTypes = [ "compressed", "compressed" ]` to `map = (d0, d1) -> (d0 : compressed, d1 : compressed)` **DCSC** `lvlTypes = [ "compressed", "compressed" ], dimToLvl = affine_map<(i,j) -> (j,i)>` to `map = (d0, d1) -> (d1 : compressed, d0 : compressed)` **Block Row** `lvlTypes = [ "compressed", "dense" ]` to `map = (d0, d1) -> (d0 : compressed, d1 : dense)` **Block Column** `lvlTypes = [ "compressed", "dense" ], dimToLvl = affine_map<(i,j) -> (j,i)>` to `map = (d0, d1) -> (d1 : compressed, d0 : dense)` This is an ongoing effort: #66146, #66309
2023-08-30[mlir][sparse] Pass down constant coefficients of affine index expressions ↵Peiming Liu
to LoopEmitter. Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D158914
2023-08-02[mlir][sparse] code cleanup.Peiming Liu
Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D156941
2023-07-10[mlir][sparse] support dual sparse convolution.Peiming Liu
Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D152601
2023-06-21[mlir][sparse] rewrite arith::SelectOp to semiring operations to sparsify it.Peiming Liu
Reviewed By: aartbik, K-Wu Differential Revision: https://reviews.llvm.org/D153397
2023-06-15[mlir][sparse] proper in-place SDDMM with spy functionAart Bik
This specific operation matches the cuSPARSE SDDMM semantics exactly. Reviewed By: Peiming Differential Revision: https://reviews.llvm.org/D152969
2023-06-15[mlir][sparse] merger extension to support sparsifying arith::CmpI/CmpF ↵Peiming Liu
operation Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D152761
2023-06-14[mlir][sparse] fix crashes when the tensor that defines the loop bound can ↵Peiming Liu
not be found Reviewed By: aartbik, K-Wu Differential Revision: https://reviews.llvm.org/D152877
2023-06-14[mlir][sparse] unifying enterLoopOverTensorAtLvl and ↵Peiming Liu
enterCoIterationOverTensorsAtLvls The tensor levels are now explicitly categorized into different `LoopCondKind` to instruct LoopEmitter generate different code for different kinds of condition (e.g., `SparseCond`, `SparseSliceCond`, `SparseAffineIdxCond`, etc) The process of generating a while loop is now dissembled into three steps and they are dispatched to different LoopCondKind handler. 1. Generate LoopCondition (e.g., `pos <= posHi` for `SparseCond`, `slice.isNonEmpty` for `SparseAffineIdxCond`) 2. Generate LoopBody (e.g., compute the coordinates) 3. Generate ExtraChecks (e.g., `if (onSlice(crd))` for `SparseSliceCond`) Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D152464
2023-06-06[mlir][sparse] refine absent branch feeding into custom opAart Bik
Document better that unary/binary may only feed to the output or the input of a custom reduction (not even a regular reduction since it may have "no value"!). Also fixes a bug when present branch is empty and feeds into custom reduction. Reviewed By: Peiming Differential Revision: https://reviews.llvm.org/D152224
2023-06-03[mlir][sparse] fix crash when using sparse_tensor::UnaryOp and ReduceOp.Peiming Liu
Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D152048
2023-06-02[mlir][sparse] fixed bug with unary op, dense outputAart Bik
Note that by sparse compiler convention, dense output is zerod out when not set, so complement results in zeros where elements were present. Reviewed By: wrengr Differential Revision: https://reviews.llvm.org/D152046
2023-06-02[mlir][sparse] fix various bug to support sparse poolingPeiming Liu
Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D151776