This is an archive of the discontinued LLVM Phabricator instance.

[mlir][sparse] export sparse tensor runtime support through header file
ClosedPublic

Authored by aartbik on Nov 11 2020, 6:50 PM.

Details

Summary

Exposing the C versions of the methods of the sparse runtime support lib
through header files will enable using the same methods in an MLIR program
as well as a C++ program, which will simplify future benchmarking comparisons
(e.g. comparing MLIR generated code with eigen for Matrix Market sparse matrices).

Diff Detail

Event Timeline

aartbik created this revision.Nov 11 2020, 6:50 PM
aartbik requested review of this revision.Nov 11 2020, 6:50 PM
aartbik added inline comments.Nov 11 2020, 6:57 PM
mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
220

Note, this layout looks funny, but no matter what I tried, the auto formatter changes this back to this.....

mlir/lib/ExecutionEngine/SparseUtils.cpp
19

note that this ifdef mimics the logic of the c runner utils lib

penpornk accepted this revision.Nov 11 2020, 8:21 PM
penpornk added inline comments.
mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
213

Nit: Are we missing a for? s/support/support for/ ?

mlir/lib/ExecutionEngine/SparseUtils.cpp
151

Just curious, when we create a memref in MLIR, are the base pointer and offset always initialized at the creation time?

This revision is now accepted and ready to land.Nov 11 2020, 8:21 PM

Do you have tests for all this?

aartbik marked an inline comment as done.Nov 11 2020, 8:32 PM
aartbik added inline comments.
mlir/include/mlir/ExecutionEngine/CRunnerUtils.h
213

Yes, we are. Thanks!

mlir/lib/ExecutionEngine/SparseUtils.cpp
151

Yes, and for scalars only the data pointer will work. Note that if we want to support more complex memrefs (like assigning directly into compound buffers), we may want to refine this a bit, but that is for now not the intended behavior.

aartbik updated this revision to Diff 304706.Nov 11 2020, 8:34 PM
aartbik marked an inline comment as done.

addressed missing "for"

Do you have tests for all this?

integration_test/Sparse/CPU/matrix-market-example.mlir

(note that the lib was already added, I am just adding a header so that cpp programs can use the same code by linking to the lib)