[mlir][sparse] hoist loop invariant tensor loads in sparse compiler
authorAart Bik <ajcbik@google.com>
Mon, 7 Dec 2020 19:54:58 +0000 (11:54 -0800)
committerAart Bik <ajcbik@google.com>
Mon, 7 Dec 2020 19:59:48 +0000 (11:59 -0800)
commit74cd9e587d80063381242006d0690231d756aa7a
tree466c1ef881a4f1648342c90deaae0818f1b9aa02
parent1c98f984105e552daa83ed8e92c61fba0e401410
[mlir][sparse] hoist loop invariant tensor loads in sparse compiler

After bufferization, the backend has much more trouble hoisting loop invariant
loads from the loops generated by the sparse compiler. Therefore, this is done
during sparse code generation. Note that we don't bother hoisting derived
invariant expressions on SSA values, since the backend does that very well.

Still TBD: scalarize reductions to avoid load-add-store cycles

Reviewed By: penpornk

Differential Revision: https://reviews.llvm.org/D92534
mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
mlir/test/Dialect/Linalg/sparse_2d.mlir
mlir/test/Dialect/Linalg/sparse_3d.mlir