This is an archive of the discontinued LLVM Phabricator instance.

Accept symmetric sparse matrix in Matrix Market Exchange Format.
ClosedPublic

Authored by bixia on Nov 22 2021, 3:25 PM.

Diff Detail

Event Timeline

bixia created this revision.Nov 22 2021, 3:25 PM
bixia requested review of this revision.Nov 22 2021, 3:25 PM
bixia updated this revision to Diff 389057.Nov 22 2021, 3:34 PM

Removed a comment.

That was fast! Thanks Bixia.

mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
514

update comment general/symmetric

518

I found this very hard to read, because strcmp returns 0 on failure here. Do you see chance to make this more readable?

622

Add a note that for now we chose to deal with symmetric matrices by fully constructing them.
In the future we of course may want to make the symmetry implicit for storage reasons.

mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum.mlir
7

it is a bit strange to just change the input matrix of an existing test for this
(and also to change it here, but not in the "vectorized" line L21).

I assume you picked the values such that the outcome is the same?

If you don't want to add a whole new file just make sure you change both L7 and L21.
Also, I would pick a new matrix, and just fix the expected outcome in L88

aartbik added inline comments.Nov 22 2021, 4:23 PM
mlir/test/Integration/data/test_symmetric.mtx
14

it does not matter of course, but Matrix Market uses a lower triangular or upper triangular matrix consistently for symmetric matrices. This is a bit bad example in the sense that we have a_14 in the upper triangular and a_52 in the lower trianguar.

Please pick a consistent region for the values

bixia added inline comments.Nov 22 2021, 10:36 PM
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
518

Would introduce a lambda like this help?

not_equal = [](const char* src, const* expected) {return strcmp(toLower(src), expected);}
if (not_equal(header, "%%matrixmarket") || not_equal(object, "matrix") ||

not_euqal(format, "coordinate") || not_equal(field, "real") ||
(not_equal(symmetry, "general") && !(*is_symmetric))) {
bixia updated this revision to Diff 389097.Nov 22 2021, 10:57 PM

Addressed review comments.

bixia marked an inline comment as done.Nov 22 2021, 11:00 PM
bixia added inline comments.
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_sum.mlir
7

Fixed L7 and L21, used a new matrix.

mlir/test/Integration/data/test_symmetric.mtx
14

Fixed this and used a new matrix instead of modifying test.mtx.

aartbik accepted this revision.Nov 23 2021, 11:31 AM
aartbik added inline comments.
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp
518

Let's leave as is.

This revision is now accepted and ready to land.Nov 23 2021, 11:31 AM
bixia updated this revision to Diff 389373.Nov 23 2021, 7:10 PM

Modified test/CMakeLists.txt to copy the new tensor data to the test directory.