17 Commits

Author SHA1 Message Date
Aart Bik
1c2456d659
[mlir][sparse] remove very thin header file from sparse runtime support (#82820) 2024-02-23 12:37:36 -08:00
Aart Bik
427f120f60
[mlir][sparse] minor edits in runtime lib Cpp files (#68165) 2023-10-03 16:28:54 -07:00
bixia1
e800c664f0 [mlir][sparse] Extend readCOOIndices to support overhead types beyond index_type.
This is to prepare for implementing the C API for reading a COO tensor to the
given buffers for indices and values.

Reviewed By: wrengr

Differential Revision: https://reviews.llvm.org/D143861
2023-02-13 14:51:59 -08:00
wren romano
2af2e4dbb7 [mlir][sparse] Breaking up openSparseTensor to better support non-permutations
This commit updates how the `SparseTensorConversion` pass handles `NewOp`.  It breaks up the underlying `openSparseTensor` function into two parts (`SparseTensorReader::create` and `SparseTensorReader::readSparseTensor`) so that the pass can inject code for constructing `lvlSizes` between those two parts.  Migrating the construction of `lvlSizes` out of the runtime and into the pass is a necessary first step toward fully supporting non-permutations.  (The alternative would be for the pass to generate a `FuncOp` for performing the construction and then passing that to the runtime; which doesn't seem to have any benefits over the design of this commit.)  And since the pass now generates the code to call these two functions, this change also removes the `Action::kFromFile` value from the enum used by `_mlir_ciface_newSparseTensor`.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D138363
2022-12-02 11:10:57 -08:00
wren romano
c518745bba [mlir][sparse] Making way for SparseTensorRuntime to support non-permutations
Systematically updates the SparseTensorRuntime to properly distinguish tensor-dimensions from storage-levels (and their associated ranks, shapes, sizes, indices, etc).  With a few exceptions which are noted in the code, this ensures the runtime has all the **semantic** changes necessary to support non-permutations.

(Whereas **operationally**, since we're still using `std::vector<uing64_t>` to represent the mappings, there's no way to pass in any interesting non-permutations.  Changing the representation to `std::function` will be done in a separate differential.)

Depends On D137680

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D137681
2022-11-14 13:48:41 -08:00
bixia1
461c461a7c [mlir][sparse] Rename SparseTensorFile to SparseTensorReader.
This is to prepare for adding SparseTensorWriter.

Reviewed By: wrengr

Differential Revision: https://reviews.llvm.org/D135477
2022-10-10 08:24:37 -07:00
Nathaniel McVicar
ff7a2b6055 [mlir][sparse] Case coverage fix no errorhandling
Restores the fix from D134925 for MSVC without breaking cpu runner.

Differential Revision: https://reviews.llvm.org/D135304
2022-10-05 15:35:00 -07:00
Vitaly Buka
0df37528eb Revert "[mlir][sparse] Restore case coverage warning fix"
Breaks https://lab.llvm.org/buildbot/#/builders/168/builds/9288

This reverts commit 83839700c32996c58ddebc0c74e3dc4970e005bc.
2022-10-05 09:53:58 -07:00
Nathaniel McVicar
83839700c3 [mlir][sparse] Restore case coverage warning fix
This restores the fix from D134925 to make MSVC and clang happy.

Reviewed By: stella.stamenova

Differential Revision: https://reviews.llvm.org/D135126
2022-10-04 09:59:20 -07:00
Kazu Hirata
e898be2f6e [mlir] Fix warnings
This patch fixes:

  mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1348:31: error: comparison
  of integers of different signs: 'size_t' (aka 'unsigned long') and
  'int64_t' (aka 'long') [-Werror,-Wsign-compare]

  mlir/lib/ExecutionEngine/SparseTensor/File.cpp:110:3: error: default
  label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]
2022-09-30 15:00:56 -07:00
wren romano
97bd83b51f [mlir][sparse] SparseTensorUtils post-refactoring cleanup
This differential corrects a few minor rebasing errors from the recent slew of differentials for factoring out the mlir_sparsetensor_utils library.

Reviewed By: aartbik, Peiming

Differential Revision: https://reviews.llvm.org/D134985
2022-09-30 13:29:46 -07:00
wren romano
c8944c9d4c [mlir][sparse] Fixing case coverage warning
Followup to D133835 for fixing the warning on LLVM's Windows buildbot

Reviewed By: aartbik, Peiming, stella.stamenova

Differential Revision: https://reviews.llvm.org/D134925
2022-09-29 18:20:36 -07:00
wren romano
4792b8ae86 [mlir][sparse] Cleaning up SparseTensorFile::readMMEHeader
This is a followup to the refactoring of D133462, D133830, D133831, and D133833.

Depends On D133833

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133837
2022-09-29 15:00:50 -07:00
wren romano
c8177f845b [mlir][sparse] Factoring out SparseTensorFile::canReadAs predicate
This is a followup to the refactoring of D133462, D133830, D133831, and D133833.

Depends On D133833

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133835
2022-09-29 14:46:45 -07:00
wren romano
164b66f796 [mlir][sparse] refactoring SparseTensorUtils: (4 of 4) documentation
Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* D133462: Part 1: split one file into several
* D133830: Part 2: Reorder chunks within files
* D133831: Part 3: General code cleanup
* (this): Part 4: Update documentation

This part updates existing documentation, adds new documentation, and reflows the test for some existing documentation.

Depends On D133831

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133833
2022-09-29 14:45:36 -07:00
wren romano
329f2f103a [mlir][sparse] refactoring SparseTensorUtils: (3 of 4) code-cleanup
Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* D133462: Part 1: split one file into several
* D133830: Part 2: Reorder chunks within files
* (this): Part 3: General code cleanup
* D133833: Part 4: Update documentation

This part performs some general code cleanup including:
* making more things `const`, especially for the targets of pointers
* using preincrement wherever possible ([[ https://llvm.org/docs/CodingStandards.html#prefer-preincrement | per LLVM style guide ]])
* adding messages to most `assert` statments.
* moving argument casting from the core function/method definitions to the CPP wrappers

Depends On D133830

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133831
2022-09-29 14:44:07 -07:00
wren romano
0fca5c5f45 [mlir][sparse] refactoring SparseTensorUtils: (1 of 4) file-splitting
Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* (this): Part 1: split one file into several
* D133830: Part 2: Reorder chunks within files
* D133831: Part 3: General code cleanup
* D133833: Part 4: Update documentation

This part aims to make no changes other than the 1:N file splitting, and things which are forced to accompany that change.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133462
2022-09-29 14:35:27 -07:00