This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse][python] migrate more code from boilerplate into proper numpy land
ClosedPublic

Authored by aartbik on Aug 18 2021, 3:12 PM.

Details

Summary

The boilerplate was setting up some arrays for testing. To fully illustrate
python - MLIR potential, however, this data should also come from numpy land.

Diff Detail

Event Timeline

aartbik created this revision.Aug 18 2021, 3:12 PM
aartbik requested review of this revision.Aug 18 2021, 3:12 PM
bixia added inline comments.Aug 19 2021, 3:36 PM
mlir/test/python/dialects/sparse_tensor/test_SpMM.py
58–59

Can we document that the first argument of main is first converted to sparse tensor with the given attr before calling the generated kernel?

86–91

go/pystyle#naming
The local variable naming convention is local_variable_name.
So, maybe we can use np_a, np_b, np_c, np_out here?

93–99

Similar to the above, maybe we want to use c_a_memref_ptr etc?

110

Now that we can see the input tensors here, can we use numpy to compute the expected result instead?

aartbik marked 4 inline comments as done.Aug 19 2021, 3:38 PM
aartbik added inline comments.
mlir/test/python/dialects/sparse_tensor/test_SpMM.py
110

Ah yes, good idea!

aartbik updated this revision to Diff 367649.Aug 19 2021, 4:14 PM
aartbik marked an inline comment as done.

good suggestions!

bixia accepted this revision.Aug 19 2021, 9:54 PM
This revision is now accepted and ready to land.Aug 19 2021, 9:54 PM