[mlir][sparse] avoid reserving dense storage for ptr/idx
authorAart Bik <ajcbik@google.com>
Tue, 5 Apr 2022 23:56:07 +0000 (16:56 -0700)
committerAart Bik <ajcbik@google.com>
Wed, 6 Apr 2022 00:40:01 +0000 (17:40 -0700)
commit175b9af484f483c3423ab2f78db5de7e25b64c31
tree3312c9ecbd9eec5a6368edadd7b75dd139019aad
parent9a62d9db2e1f6064e6c20344870f5e9d43a8de43
[mlir][sparse] avoid reserving dense storage for ptr/idx

This avoids a rather big bug where we were reserving
dense space for the ptx/idx in the first sparse dimension.
For example, using CSR for a 140874 x 140874 matrix with
3977139 nonzero would reserve the full 19845483876 space.
This revision fixes this for now, but we need to revisit
the reservation heuristic to make this better.

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D123166
mlir/lib/ExecutionEngine/SparseTensorUtils.cpp