This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] Add 3-dimensional sparse tensor multiplication integration test
ClosedPublic

Authored by vmrajas on Jul 13 2022, 6:42 AM.

Details

Summary

This diff adds an integration test which does element wise multiplication for two sparse 3-d tensors of size 3x3x5

Diff Detail

Event Timeline

vmrajas created this revision.Jul 13 2022, 6:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 13 2022, 6:42 AM
vmrajas requested review of this revision.Jul 13 2022, 6:42 AM

Thanks for your first test!

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
26

line up arga/argb?

43

no double empty line

105

since you use dump only once, why not inline the code
(becomes shorter too, due to sharing some of the constants)?

vmrajas updated this revision to Diff 444380.Jul 13 2022, 12:18 PM
vmrajas marked 3 inline comments as done.

Address comments

Thanks for the quick review. I have addressed your comments.

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
105

Aah. I was planning on adding another test related to tensor ops (maybe addition).
I will add dump as a function while writing that test then.

vmrajas added inline comments.Jul 13 2022, 12:27 PM
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
100

I am not completely sure if we have to do this (as we were doing in dump) and whether we should dealloc m1 as well.

aartbik added inline comments.Jul 13 2022, 12:42 PM
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
100

Always run with sanitizer on before submitting.
Config:

...
 -DLLVM_USE_SANITIZER=Address \
 -DMLIR_INCLUDE_INTEGRATION_TESTS=ON \
...
aartbik added inline comments.Jul 13 2022, 12:44 PM
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
100

and the answer is, yes, at the moment, but there is a pending change by Matthias which will have to change this (since we are migrating to the much better OneShot bufferization)

vmrajas marked 2 inline comments as done.Jul 13 2022, 8:23 PM
vmrajas added inline comments.
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
100

Got it. I ran with the sanitizer and it showed no errors.

aartbik accepted this revision.Jul 14 2022, 2:37 PM
aartbik added inline comments.
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_tensor_mul.mlir
96

why not use default_value here too, and get rid of the %d0
the -1 also jumps out a bit more than the 0 value

100

Make sure to rebase with main and retest sanitizer test run, since the OneShot bufferization just went in. After that, ship it!

This revision is now accepted and ready to land.Jul 14 2022, 2:37 PM
vmrajas updated this revision to Diff 444942.Jul 15 2022, 4:53 AM

Rebase and address comments

vmrajas marked 2 inline comments as done.Jul 15 2022, 4:54 AM