The sparse compiler used to stored the dimension sizes with a MemRef<rank x index>. This patch change the memory scheme by storing the dimension size using llvm.struct<array<rank x int>>.
There are multiple reasons behind the change
- MemRef, in addition to pointers, stores extra information for strides and offsets, which are redundant for our case.
- MemRef requires deallocation to avoid memory leak, which brings us extra challenges to implement sparse tensor slice in the future as sparse tensor slices will likely to hold a different MemRef for dimension sizes, which is required to be freed after the slices is no longer needed.
Note that this scheme is also closer to how MemRef stores its dimension sizes.
Future work:
Move the memSizes MemRef into the same llvm.struct together with dimSizes, it is currently blocked by sparse_tensor.push_back operation, which only takes a MemRef memSizes as inputs.
The name of the file should be left-aligned, and the end of the comment line should include -*- C++ -*- (as per the style guide).