This change gives sparse compiler clients more control over selecting
individual types for the pointers and indices in the sparse storage schemes.
Narrower width obviously results in smaller memory footprints, but the
range should always suffice for the maximum number of entries or index value.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thank you, Aart!
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h | ||
---|---|---|
831 | This is great. :) | |
837 | I like that the pointers and indices types are decoupled. | |
mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp | ||
590–595 | This is loop-invariant. Why it is moved into the loop? Just for my information. | |
mlir/test/Dialect/Linalg/sparse_storage.mlir | ||
27 | Wow. I'm loving the new, more meaningful RegEx labels! | |
30 | Just curious, are these casts free in practice? |
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h | ||
---|---|---|
831 | yes, sounds like a good extension (starter project?!) | |
837 | I indeed had them combined first, and then decided we needed even finer-grain control ;-) | |
mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp | ||
590–595 | Note that codegeneration relies on CSE and DCE to cleanup duplicates and remove unused code (like even when I generate the same constant, like zero or one many times, we end up with just one at the end of this pass). I moved it in so that we don't generate it when it is not needed (vis. no sparse code), but we might as well keep it out. Let me know if you prefer one strongly over the other. | |
mlir/test/Dialect/Linalg/sparse_storage.mlir | ||
27 | Yes, advantage of hand-written over auto generated ;-) | |
30 | If indexType == xxType, it is a nop. But even if the widths are different, it comes typically for free with a truncating or extending move, on x86 at least. |
mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp | ||
---|---|---|
590–595 | I have no preferences. Was just curious. Thank you for the explanation! :) |
mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h | ||
---|---|---|
831 | Sounds good! Will try this when I'm done setting up. |
This is great. :)
I think there could be use cases for even kI16 or kI8 in the future, e.g., edge devices. (Some might store offset from the last nonzero instead of the absolute position.)