We recently fixed a bug in "sparsifying" such reductions, since
it incorrectly changed this into reductions over stored elements
only , which only works for add/sub/or/xor. However, we still want
to be able to "sparsify" the reductions even in the general case,
and this is a first step by rewriting them into a custom reduction
that feeds in the implicit zeros. NOTE HOWEVER, that in the long run
we want to do this better and feed in any implicit zero only ONCE
for efficiency.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp | ||
---|---|---|
393 | Why "only useful" for min/max? Are you unfamiliar with tropical and Viterbi semirings? (https://en.wikipedia.org/wiki/Tropical_semiring, https://winterkoninkje.dreamwidth.org/80410.html) Granted the tropical semirings will want a different "zero" value |
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp | ||
---|---|---|
393 | I merely meant that PROD/AND over sparse data seems a bit less likely since it would nullify quite often (so I see more use for custom prod over just the stored elements). If you prefer, I can remove the comment. |
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp | ||
---|---|---|
421–425 | You can actually pass a list of template parameters to isa, which has the desired disjunctive semantics |
mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp | ||
---|---|---|
421–425 | Oh, that is so neat. Yeah, I have used that in other case, and here it makes a lot of sense! |
Why "only useful" for min/max? Are you unfamiliar with tropical and Viterbi semirings? (https://en.wikipedia.org/wiki/Tropical_semiring, https://winterkoninkje.dreamwidth.org/80410.html) Granted the tropical semirings will want a different "zero" value