Commit Graph

452 Commits

Author SHA1 Message Date
Thomas Raoux
7efdc117b1 [mlir][nvvm] Add lowering of gpu.printf to nvvm
When converting to nvvm lowering gpu.printf to vprintf allows us to
support printing when running on cuda.

Differential Revision: https://reviews.llvm.org/D141049
2023-01-06 17:29:30 +00:00
Matthias Springer
5eee80ce5e [mlir][memref] Add runtime verification for memref::CastOp
Verify unranked -> ranked casts and casts of dynamic sizes/offset/strides to static ones.

Differential Revision: https://reviews.llvm.org/D138671
2023-01-06 14:38:56 +01:00
bixia1
3fdd85da06 [mlir][sparse] Add AOS optimization.
Use an array of structures to represent the indices for the tailing COO region
of a sparse tensor.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D140870
2023-01-04 18:16:04 -08:00
Peiming Liu
988733c600 [mlir][sparse] use sparse_tensor::StorageSpecifier to store dim/memSizes
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D140130
2022-12-23 00:47:36 +00:00
Paul Robinson
977c6f7867 [mlir] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
2022-12-15 14:49:54 -08:00
Aart Bik
78ba3aa765 [mlir][sparse] performs a tab cleanup (NFC)
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D140142
2022-12-15 12:12:06 -08:00
Matthias Springer
325b58d59f [mlir][cf] Print message in cf.assert to LLVM lowering
The assert message was previously ignored. The lowered IR now calls `puts` it in case of a failed assertion.

Differential Revision: https://reviews.llvm.org/D138647
2022-12-15 17:45:34 +01:00
bixia1
089e120060 [mlir][sparse] Make the remaining integration tests run with vectorization.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D140057
2022-12-14 15:13:12 -08:00
bixia1
bfad07268b [mlir][sparse] Add another call to ConvertVectorToLLVMPass, to lower the vector operations added by ConvertMathToLLVMPass.
Run sparse_tanh with vectorization.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D139958
2022-12-14 15:06:34 -08:00
Ivan Butygin
befd167050 [mlir][gpu] Fix cuda integration tests
https://reviews.llvm.org/D138758 has added `uniform` flag to gpu reduce ops, update integration tests.

Differential Revision: https://reviews.llvm.org/D140014
2022-12-14 14:01:00 +01:00
bixia1
a229c162a1 [mlir][sparse] Make some integration tests run with vectorization.
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D139887
2022-12-13 13:26:36 -08:00
Jakub Kuderski
269177eedf Revert "[mlir][sparse] Make some integration tests run with vectorization."
This reverts commit 2d7e3ec6b5.

This broke buildbots [1] and I can also reproduce this locally.

[1] https://lab.llvm.org/buildbot#builders/61/builds/36953
2022-12-13 13:41:28 -05:00
bixia1
2d7e3ec6b5 [mlir][sparse] Make some integration tests run with vectorization.
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D139887
2022-12-13 10:02:44 -08:00
bixia1
efaa78cae0 [mlir][sparse] Replace vector.print with printMemref for some tests.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D139489
2022-12-12 16:54:41 -08:00
bixia1
ea4be70cea [mlir][sparse] Fix problems in creating complex zero for initialization.
Reviewed By: aartbik, wrengr

Differential Revision: https://reviews.llvm.org/D139591
2022-12-08 07:49:27 -08:00
Navdeep Katel
3d35546cd1 Support transpose mode for gpu.subgroup WMMA ops
Add support for loading, computing, and storing `gpu.subgroup` WMMA ops
in transpose mode as well. Update the GPU to NVVM lowerings to support
`transpose` mode and update integration tests as well.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D139021
2022-12-05 22:37:02 +05:30
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
Quentin Colombet
786cbb09ed Re-apply "[mlir][MemRefToLLVM] Remove the code for lowering subview"
This reverts commit d0650d1089.

Original commit message:
Subviews are supposed to be expanded before we hit the lowering
code.
The expansion is done with the pass called
expand-strided-metadata.

Add a test that demonstrate how these passes can be linked up to achieve
the desired lowering.

This patch is NFC in spirit but not in practice because `subview` gets
lowered into `reinterpret_cast(extract_strided_metadata, <some math>)`
which lowers in two memref descriptors (one for `reinterpert_cast` and
one for `extract_strided_metadata`), which creates some noise of the
form: `extractvalue(unrealized_cast(extractvalue[0]))[0]` that is
currently not simplified within MLIR but that is really just noop in
that case.

Differential Revision: https://reviews.llvm.org/D136377
2022-12-02 15:26:58 +00:00
bixia1
101a0c84f7 [mlir][sparse] Improve concatenate operator rewrite for annotated all dense dimensions results.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D138823
2022-11-29 12:25:52 -08:00
Diego Caballero
eb7e2998d1 Reland "[mlir][Vector] Re-define masking semantics in vector.transfer ops""
This relands commit 847b5f82a4.

Differential Revision: https://reviews.llvm.org/D138079
2022-11-29 03:36:54 +00:00
Diego Caballero
f6d90055fd [mlir][Vector] Remove 'lower-permutation-maps' option from VectorToSCF
This patch is part of a larger simplification effort of vector transfer
operations. It removes the flag `lower-permutation-maps` from
VectorToSCF conversion and enables the lowering of permutation maps
by default. This means that VectorToSCF will always lower permutation
maps to independent broadcast/transpose operations before lowering
vector operations to SCF.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D138742
2022-11-28 23:56:43 +00:00
Hanhan Wang
0a1569a400 [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
2022-11-28 15:26:30 -08:00
bixia1
974b4bf9fd [mlir][sparse] Add expand_symmetry attribute to the new operator.
The attribute tells the operator to handle symmetric structures for 2D tensors.
By default, the operator assumes the input tensor is not symmetric.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D138230
2022-11-23 16:32:15 -08:00
Peiming Liu
e5e4deca5e [mlir][sparse] support affine expression on sparse dimensions (codegen implementation)
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D138172
2022-11-23 00:04:55 +00:00
zhanghb97
ee82b864f2 [mlir] Initial MLIR VP intrinsic integration test on host and RVV emulator.
This patch adds the initial VP intrinsic integration test on the host backend and RVV emulator. Please see more detailed [discussion on the discourse](https://discourse.llvm.org/t/mlir-vp-ops-on-rvv-backend-integration-test-and-issues-report/66343).

- Run the test cases on the host by configuring the CMake option: `-DMLIR_INCLUDE_INTEGRATION_TESTS=ON`
- Build the RVV environment and run the test cases on RVV QEMU by [this doc](https://gist.github.com/zhanghb97/ad44407e169de298911b8a4235e68497).

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D137816
2022-11-22 17:30:24 +08:00
bixia1
ee74d371a3 [mlir][sparse] Make three integration tests run with the codegen path.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D138233
2022-11-17 13:22:04 -08:00
bixia1
96b3bf4292 [mlir][sparse] Fix a problem in the new operator rewriter.
The getSparseTensorReaderNextX functions should return void.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D138226
2022-11-17 13:21:10 -08:00
Peiming Liu
8d615a23ef [mlir][sparse] fix crash on sparse_tensor.foreach operation on tensors with complex<T> elements.
Reviewed By: aartbik, bixia

Differential Revision: https://reviews.llvm.org/D138223
2022-11-17 19:36:15 +00:00
bixia1
c374ef2eb7 [mlir][sparse] Extend the operator new rewriter to handle isSymmetric flag.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D138214
2022-11-17 10:48:24 -08:00
Jakub Kuderski
0436214b6d [mlir][arith] Add Max*I and Min*I support to WIE
This includes LIT IR tests and runtime tests.

Reviewed By: Mogball

Differential Revision: https://reviews.llvm.org/D138184
2022-11-17 13:36:15 -05:00
bixia1
b5276b50e9 [mlir][sparse] Run an integration test with codegen.
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D138213
2022-11-17 09:59:53 -08:00
bixia1
b5d74f0e83 [mlir][sparse] Make integration tests run on both library and codegen pathes.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D138145
2022-11-16 12:01:14 -08:00
bixia1
555e7835f4 [mlir][sparse] Fix rewriting for convert op and concatenate op.
Fix a problem in convert op rewriting where it used the original index for
ToIndicesOp.

Extend the concatenate op rewriting to handle dense destination and dynamic
shape destination.

Make the concatenate op integration test run on the codegen path.

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D138057
2022-11-15 14:45:21 -08:00
bixia1
13c41757b1 [mlir][sparse] Only insert non-zero values to the result of the concatenate operation.
Modify the integration test to check number_of_entries and use it to limit for
outputing sparse tensor values.

Reviewed By: aartbik, Peiming

Differential Revision: https://reviews.llvm.org/D138046
2022-11-15 11:52:52 -08:00
Jakub Kuderski
64333332db [mlir][arith] Add arith.shrsi support to WIE
This includes LIT tests over the generated ops and runtime tests.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D137965
2022-11-14 20:52:10 -05:00
Peiming Liu
2d9d805c74 [mlir][sparse] fix memory leak in test cases
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D137985
2022-11-14 23:03:46 +00:00
bixia1
40edb8b4ab [mlir][sparse] Make three tests run with the codegen path.
Reviewed By: aartbik, Peiming

Differential Revision: https://reviews.llvm.org/D137964
2022-11-14 14:22:25 -08:00
bixia1
4f729d5a70 [mlir][sparse] Add rewriting rules for sparse_tensor.sort_coo.
Refactor the rewriting of sparse_tensor.sort to support the implementation of
sparse_tensor.sort_coo.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D137522
2022-11-14 08:48:53 -08:00
bixia1
fa46de16db [mlir][sparse][NFC] Add comments to tests that are run for with and without runtime libraries.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D137869
2022-11-14 08:21:33 -08:00
Peiming Liu
725e0849b7 [mlir][sparse] fix incorrect coordinates ordering computed by the foreach operation.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D137877
2022-11-12 04:08:50 +00:00
Jakub Kuderski
7e835ae57c [mlir][arith] Add arith.cmpi support to WIE
This inludes both LIT tests over IR and runtime checks.

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D137846
2022-11-11 15:14:02 -05:00
bixia1
da749560e1 [mlir][sparse] Extend more integration to run on the codegen path.
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D137850
2022-11-11 09:42:23 -08:00
bixia1
57416d872a [mlir][sparse] Fix a bug in rewriting dense2dense convert op.
Permutation wasn't handled correctly. Add a test for the rewriting.

Extend an integration test to run with enable_runtime_library=false to
also test the rewriting.

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D137845
2022-11-11 09:11:54 -08:00
bixia1
1f48f4d674 [mlir][sparse] Fix a test to check all output coordinates.
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D137805
2022-11-10 15:25:48 -08:00
bixia1
f151274454 [mlir][sparse] Fix Python interface for bufferization.alloc_tensor.
Add size_hint operand to the Python interface.
Fix pytaco.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D137754
2022-11-09 21:38:51 -08:00
Aart Bik
e6cbb91483 [mlir][sparse] skip zeros during dense2sparse
This enables the full matmul integration test with runtime_lib=true/false!

Background:
https://github.com/llvm/llvm-project/issues/51657

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D137750
2022-11-09 20:54:27 -08:00
Aart Bik
a61a9a700a [mlir][sparse] first end-to-end matmul with codegen
(1) also fixes memory leak in sparse2dense rewriting
(2) still needs fix in dense2sparse by skipping zeros

Reviewed By: wrengr

Differential Revision: https://reviews.llvm.org/D137736
2022-11-09 13:40:05 -08:00
Peiming Liu
7175f9dde1 [mlir][sparse] extend foreach operation to iterator over sparse constant.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D137679
2022-11-09 01:50:34 +00:00
Aart Bik
99fe3d2661 [mlir][sparse] 3-dimensional sparse tensor insertion test
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D137668
2022-11-08 14:49:31 -08:00
Aart Bik
70633a8d55 [mlir][sparse] first general insertion implementation with pure codegen
This revision generalizes lowering the sparse_tensor.insert op into actual code that directly operates on the memrefs of a sparse storage scheme. The current insertion strategy does *not* rely on a cursor anymore, with introduces some testing overhead for each insertion (but still proportional to the rank, as before). Over time, we can optimize the code generation, but this version enables us to finish the effort to migrate from library to actual codegen.

Things to do:
(1) carefully deal with (un)ordered and (not)unique
(2) omit overhead when not needed
(3) optimize and specialize
(4) try to avoid the pointer "cleanup" (at HasInserts), and make sure the storage scheme is consistent at every insertion point (so that it can "escape" without concerns).

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D137457
2022-11-08 13:10:05 -08:00