Commit Graph

789 Commits

Author SHA1 Message Date
Aart Bik
f388a3a446 [mlir][sparse] update doc and examples of the [dis]assemble operations (#88213)
The doc and examples of the [dis]assemble operations did not reflect all
the recent changes on order of the operands. Also clarified some of the
text.
2024-04-10 09:42:12 -07:00
Aart Bik
dc4cfdbb8f [mlir][sparse] provide an AoS "view" into sparse runtime support lib (#87116)
Note that even though the sparse runtime support lib always uses SoA
storage for COO storage (and provides correct codegen by means of views
into this storage), in some rare cases we need the true physical SoA
storage as a coordinate buffer. This PR provides that functionality by
means of a (costly) coordinate buffer call.

Since this is currently only used for testing/debugging by means of the
sparse_tensor.print method, this solution is acceptable. If we ever want
a performing version of this, we should truly support AoS storage of COO
in addition to the SoA used right now.
2024-03-29 15:30:36 -07:00
Andrzej Warzyński
d7753989ea [mlir][linalg] Add e2e test for linalg.mmt4d + pack/unpack (#84964)
This is a follow-up for #81790. This patch basically extends:

  * test/Integration/Dialect/Linalg/CPU/mmt4d.mlir

with pack/unpack ops so that to overall computation is a matrix
multiplication (as opposed to linalg.mmt4d). For comparison (and to make
it easier to verify correctness), linalg.matmul is also included in the
test.
2024-03-28 14:52:08 +00:00
Andrzej Warzynski
0bdb883e7c [mlir][SVE] Add e2e for 1D depthwise WC convolution
Follow-up for #81625

Relands #85225 with a minor update to the RUN line to fix buildbot
failures:
```diff
-// RUN: %{compile} | %{run} | FileCheck %s
+// RUN: rm -f %t && %{compile} && %{run} | FileCheck %s
```

Failing buildbots after landing #85225:
 * https://lab.llvm.org/buildbot/#/builders/184/builds/11363
 * https://lab.llvm.org/buildbot/#/builders/176/builds/9331
2024-03-25 15:13:52 +00:00
Andrzej Warzyński
f7e7064992 [mlir][SVE] Fix memory leaks in integration tests (#86488)
Buffers are no longer deallocated by One-Shot Bufferize - this is now
done by a separate buffer deallocation pass.

In order to see the leaks in SVE integration tests, use the following
CMake flags (enables the address sanitizer and SVE integration tests):

    -DLLVM_USE_SANITIZER="Address"
    -DMLIR_INCLUDE_INTEGRATION_TESTS=On
    -DMLIR_RUN_ARM_SVE_TESTS=On

Follow-up for #85366
2024-03-25 14:09:52 +00:00
Muhammad Omair Javaid
f317fd266c Revert "[mlir][SVE] Add e2e for 1D depthwise WC convolution (#85225)"
This reverts commit 01b1b0c1f7.

Breaks following AArch64 SVE buildbots:
https://lab.llvm.org/buildbot/#/builders/184/builds/11363
https://lab.llvm.org/buildbot/#/builders/176/builds/9331
2024-03-23 15:32:46 +05:00
Andrzej Warzyński
01b1b0c1f7 [mlir][SVE] Add e2e for 1D depthwise WC convolution (#85225)
Follow-up for https://github.com/llvm/llvm-project/pull/81625
2024-03-22 15:53:04 +00:00
long.chen
631e54aa1a [mlir][arith] fix wrong floordivsi fold (#83248)
Fixs https://github.com/llvm/llvm-project/issues/83079
2024-03-22 23:52:47 +08:00
Matthias Springer
a5d7fc1d10 [mlir][sparse] Fix typos in comments (#86074) 2024-03-21 12:30:48 +09:00
Oleksandr "Alex" Zinenko
5a9bdd85ee [mlir] split transform interfaces into a separate library (#85221)
Transform interfaces are implemented, direction or via extensions, in
libraries belonging to multiple other dialects. Those dialects don't
need to depend on the non-interface part of the transform dialect, which
includes the growing number of ops and transitive dependency footprint.

Split out the interfaces into a separate library. This in turn requires
flipping the dependency from the interface on the dialect that has crept
in because both co-existed in one library. The interface shouldn't
depend on the transform dialect either.

As a consequence of splitting, the capability of the interpreter to
automatically walk the payload IR to identify payload ops of a certain
kind based on the type used for the entry point symbol argument is
disabled. This is a good move by itself as it simplifies the interpreter
logic. This functionality can be trivially replaced by a
`transform.structured.match` operation.
2024-03-20 22:15:17 +01:00
Kai Sasaki
ccf042e90e [mlir][complex] Make CPU runner test platform agnostic (#85607) 2024-03-19 20:03:05 +09:00
Matthias Springer
b1752ddf0a [mlir][sparse] Fix memory leaks (part 4) (#85729)
This commit fixes memory leaks in sparse tensor integration tests by
adding `bufferization.dealloc_tensor` ops.

Note: Buffer deallocation will be automated in the future with the
ownership-based buffer deallocation pass, making `dealloc_tensor`
obsolete (only codegen path, not when using the runtime library).

This commit fixes the remaining memory leaks in the MLIR test suite.
`check-mlir` now passes when built with ASAN.
2024-03-19 15:38:16 +09:00
Matthias Springer
53c4418753 [mlir][linalg, tosa] Fix memory leaks in integration tests (#85366)
Buffers are no longer deallocation by One-Shot Bufferize. This is now
done by a separate buffer deallocation pass.

Also fix a bug in the `vector.mask` folding, which was triggered by
`-buffer-deallocation-pipeline`, which runs the canonicalizer.
2024-03-16 12:23:44 +09:00
Matthias Springer
fadc38efed [mlir][memref] Fix memory leaks in runtime verification tests (#85362)
Change `memref.alloc` to `memref.alloca`, which does not require manual
deallocation.
2024-03-16 12:13:56 +09:00
Aart Bik
f3a8af07fa [mlir][sparse] best effort finalization of escaping empty sparse tensors (#85482)
This change lifts the restriction that purely allocated empty sparse
tensors cannot escape the method. Instead it makes a best effort to add
a finalizing operation before the escape.

This assumes that
(1) we never build sparse tensors across method boundaries
    (e.g. allocate in one, insert in other method)
(2) if we have other uses of the empty allocation in the
    same method, we assume that either that op will fail
    or will do the finalization for us.

This is best-effort, but fixes some very obvious missing cases.
2024-03-15 16:43:09 -07:00
Matthias Springer
e8e8df4c1b [mlir][sparse] Add has_runtime_library test op (#85355)
This commit adds a new test-only op:
`sparse_tensor.has_runtime_library`. The op returns "1" if the sparse
compiler runs in runtime library mode.

This op is useful for writing test cases that require different IR
depending on whether the sparse compiler runs in runtime library or
codegen mode.

This commit fixes a memory leak in `sparse_pack_d.mlir`. This test case
uses `sparse_tensor.assemble` to create a sparse tensor SSA value from
existing buffers. This runtime library reallocates+copies the existing
buffers; the codegen path does not. Therefore, the test requires
additional deallocations when running in runtime library mode.

Alternatives considered:
- Make the codegen path allocate. "Codegen" is the "default" compilation
mode and it is handling `sparse_tensor.assemble` correctly. The issue is
with the runtime library path, which should not allocate. Therefore, it
is better to put a workaround in the runtime library path than to work
around the issue with a new flag in the codegen path.
- Add a `sparse_tensor.runtime_only` attribute to
`bufferization.dealloc_tensor`. Verifying that the attribute can only be
attached to `bufferization.dealloc_tensor` may introduce an unwanted
dependency of `MLIRSparseTensorDialect` on `MLIRBufferizationDialect`.
2024-03-15 13:35:48 +09:00
Matthias Springer
5124eedd35 [mlir][sparse] Fix memory leaks (part 3) (#85184)
This commit fixes memory leaks in sparse tensor integration tests by
adding `bufferization.dealloc_tensor` ops.

Note: Buffer deallocation will be automated in the future with the
ownership-based buffer deallocation pass, making `dealloc_tensor`
obsolete (only codegen path, not when using the runtime library).
2024-03-15 13:31:47 +09:00
Yinying Li
88986d65e4 [mlir][sparse] Fix sparse_generate test (#85009)
std::uniform_int_distribution may behave differently in different
systems.
2024-03-12 21:39:37 -04:00
Yinying Li
c1ac9a09d0 [mlir][sparse] Finish migrating integration tests to use sparse_tensor.print (#84997) 2024-03-12 20:57:21 -04:00
Peiming Liu
94e27c265a [mlir][sparse] reuse tensor.insert operation to insert elements into … (#84987)
…a sparse tensor.
2024-03-12 16:59:17 -07:00
Yinying Li
83c9244ae4 [mlir][sparse] Migrate more tests to use sparse_tensor.print (#84833)
Continuous efforts following #84249.
2024-03-11 18:44:32 -04:00
Yinying Li
4cb5a96af6 [mlir][sparse] Migrate more tests to sparse_tensor.print (#84249)
Continuous efforts following #83946.
2024-03-07 14:02:20 -05:00
Yinying Li
6e692e726a [mlir][sparse] Migrate to sparse_tensor.print (#83946)
Continuous efforts following #83506.
2024-03-07 14:02:01 -05:00
Peiming Liu
fc9f1d49aa [mlir][sparse] use a consistent order between [dis]assembleOp and sto… (#84079)
…rage layout.
2024-03-06 09:57:41 -08:00
Aart Bik
b6ca602658 [mlir][sparse] migrate tests to sparse_tensor.print (#84055)
Continuing the efforts started in #83357
2024-03-05 12:17:45 -08:00
Aart Bik
662d821d44 [mlir][sparse] migrate datastructure tests to sparse_tensor.print (#83956)
Continuing the efforts started in llvm#83357
2024-03-04 21:14:32 -08:00
Aart Bik
275fe3ae2d [mlir][sparse] support complex type for sparse_tensor.print (#83934)
With an integration test example
2024-03-04 17:14:31 -08:00
Aart Bik
05390df497 [mlir][sparse] migration to sparse_tensor.print (#83926)
Continuing the efforts started in #83357
2024-03-04 15:49:09 -08:00
Aart Bik
691fc7cdcc [mlir][sparse] add dim/lvl information to sparse_tensor.print (#83913)
More information is more testing!
Also adjusts already migrated integration tests
2024-03-04 14:32:49 -08:00
Aart Bik
2e0693abbc [mlir][sparse][gpu] migration to sparse_tensor.print (#83510)
Continuous efforts #83357 for our sparse CUDA tests
2024-03-04 09:49:54 -08:00
Yinying Li
5899599b01 [mlir][sparse] Migration to sparse_tensor.print (#83506)
Continuous efforts #83357. Previously reverted #83377.
2024-02-29 19:18:35 -05:00
Mehdi Amini
71eead512e Revert "[mlir][sparse] Migration to sparse_tensor.print" (#83499)
Reverts llvm/llvm-project#83377

The test does not pass on the bot.
2024-02-29 15:04:58 -08:00
Yinying Li
1ca65dd74a [mlir][sparse] Migration to sparse_tensor.print (#83377)
Continuous efforts following #83357.
2024-02-29 14:14:31 -05:00
Benjamin Maxwell
780d55690e [mlir][ArmSVE] Fix test-setArmVLBits.mlir after #83213 2024-02-29 13:02:50 +00:00
Benjamin Maxwell
afa6b5e576 [mlir][ArmSME] Fix matmul.mlir test after #83213 2024-02-29 10:17:26 +00:00
Aart Bik
fdf44b3777 [mlir][sparse] migrate integration tests to sparse_tensor.print (#83357)
This is first step (of many) cleaning up our tests to use the new and
exciting sparse_tensor.print operation instead of lengthy extraction +
print ops.
2024-02-28 16:40:46 -08:00
Peiming Liu
6bc7c9df7f [mlir][sparse] infer returned type for sparse_tensor.to_[buffer] ops (#83343)
The sparse structure buffers might not always be memrefs with rank == 1
with the presence of batch levels.
2024-02-28 16:10:20 -08:00
Aart Bik
8394ec9ff1 [mlir][sparse] add a few more cases to sparse_tensor.print test (#83338) 2024-02-28 14:05:40 -08:00
Aart Bik
d37affb06f [mlir][sparse] add a sparse_tensor.print operation (#83321)
This operation is mainly used for testing and debugging purposes but
provides a very convenient way to quickly inspect the contents of a
sparse tensor (all components over all stored levels).

Example:

[ [ 1, 0, 2, 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0, 0, 0, 0 ],
  [ 0, 0, 0, 0, 0, 0, 0, 0 ],
  [ 0, 0, 3, 4, 0, 5, 0, 0 ]

when stored sparse as DCSC prints as

---- Sparse Tensor ----
nse = 5
pos[0] : ( 0, 4,  )
crd[0] : ( 0, 2, 3, 5,  )
pos[1] : ( 0, 1, 3, 4, 5,  )
crd[1] : ( 0, 0, 3, 3, 3,  )
values : ( 1, 2, 3, 4, 5,  )
----
2024-02-28 12:33:26 -08:00
Aart Bik
c1b8c6cf41 [mlir][vector][print] do not append newline to printing pure strings (#83213)
Since the vector.print str provides no punctuation control, it is
slightly more flexible to let the client of this operation decide
whether there should be a trailing newline. This allows for printing
like

vector.print str "nse = "
vector.print %nse : index

as

nse = 42
2024-02-28 10:18:21 -08:00
Oleksandr "Alex" Zinenko
5468f88413 [mlir] update remaining transform tests to main pass (#81279)
Use the main transform interpreter pass instead of the test pass. The
only tests that are not updated are specific to the operation of the
test pass.
2024-02-28 11:06:53 +01:00
David Spickett
575bf33a27 [mlir][ArmSME] Remove XFAIL for load-store-128-bit-tile
https://gitlab.com/qemu-project/qemu/-/issues/1833 was fixed by
4b3520fd93
which was included in v8.1.1.

The buildbot is now using v8.1.3 so the test is passing.

https://lab.llvm.org/buildbot/#/builders/179/builds/9468
2024-02-27 08:45:01 +00:00
Cullen Rhodes
b39f5660a4 [mlir][ArmSME] Add test-lower-to-arm-sme pipeline (#81732)
The ArmSME compilation pipeline has evolved significantly and is now
sufficiently complex enough that it warrants a proper lowering pipeline
that encapsulates the various passes and orderings. Currently the
pipeline is loosely defined in our integration tests, but these have
diverged and are not using the same passes or ordering everywhere.

This patch introduces a test-lower-to-arm-sme pipeline mirroring
test-lower-to-llvm that provides some sanity when running e2e examples
and can be used a reference for targeting ArmSME in MLIR.

All the integration tests are updated to use this pipeline. The
intention is to productize the pipeline once it becomes more mature.
2024-02-23 09:42:08 +00:00
Benjamin Maxwell
08eced5fcc [mlir][test] Add -march=aarch64 -mattr=+sve to test-scalable-interleave
Fix for https://lab.llvm.org/buildbot/#/builders/179/builds/9438
2024-02-22 15:30:53 +00:00
Benjamin Maxwell
f01719afaa [mlir][test] Add integration tests for vector.interleave (#80969) 2024-02-22 10:21:12 +00:00
Peiming Liu
5248a98724 [mlir][sparse] support SoA COO in codegen path. (#82439)
*NOTE*: the `SoA` property only makes a difference on codegen path, and
is ignored in libgen path at the moment (only SoA COO is supported).
2024-02-20 17:06:21 -08:00
Andrzej Warzyński
d6850be44d [mlir][linalg] Add e2e test for linalg.mmt4d (#81790)
Follow-up for #81422. My intention is to write an e2e test targetting
SVE, but more work is needed. Sending this as an intermiedate step.
2024-02-21 07:59:43 +11:00
Matthias Springer
ccc20b4e56 [mlir][sparse] Fix memory leaks (part 2) (#81979)
This commit fixes memory leaks in sparse tensor integration tests by
adding `bufferization.dealloc_tensor` ops.

Note: Buffer deallocation will be automated in the future with the
ownership-based buffer deallocation pass, making `dealloc_tensor`
obsolete (only codegen path, not when using the runtime library).
2024-02-17 11:04:17 +01:00
Matthias Springer
b6c453c13f [mlir][sparse] Fix memory leaks (part 1) (#81843)
This commit fixes memory leaks in sparse tensor integration tests by
adding `bufferization.dealloc_tensor` ops.

Note: Buffer deallocation will be automated in the future with the
ownership-based buffer deallocation pass, making `dealloc_tensor`
obsolete (only codegen path, not when using the runtime library).
2024-02-16 09:57:04 +01:00
Cullen Rhodes
97c19a46cd [mlir][ArmSME][nfc] Add integration test for i8 to i32 matmul (#81607)
Currently marked as XFAIL due to bug in QEMU. See test for details.
2024-02-15 10:32:17 +00:00