To address https://github.com/llvm/llvm-project/issues/59394.
Reduction on negation of the output tensor is a non-sparsifiable kernel, it creates cyclic dependency.
This patch reject those cases instead of crashing.
Paths
| Differential D139659
[mlir][sparse] reject kernels with non-sparsfiable reduction expression. ClosedPublic Authored by Peiming on Dec 8 2022, 12:03 PM.
Details Summary To address https://github.com/llvm/llvm-project/issues/59394. Reduction on negation of the output tensor is a non-sparsifiable kernel, it creates cyclic dependency. This patch reject those cases instead of crashing.
Diff Detail
Event Timeline
Comment Actions Thanks for the quick fix! Comment Actions
The patch simply does not crash, your test file will still not be compiled ;-(
This revision is now accepted and ready to land.Dec 8 2022, 2:42 PM Comment Actions
You could still check that the IR is left untouched. Comment Actions
And you could also do that on more complicated expressions to test hasNegateOnOut more thoroughly (like out = add in, (mul out, -1)). This revision was landed with ongoing or failed builds.Dec 8 2022, 3:36 PM Closed by commit rGfaa75f94f113: [mlir][sparse] reject kernels with non-sparsfiable reduction expression. (authored by Peiming). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 481466 mlir/include/mlir/Dialect/SparseTensor/Utils/Merger.h
mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp
mlir/test/Dialect/SparseTensor/rejected.mlir
|
last nit: Returns