llvm-project
0f59753a - [mlir][sparse] Fix crash in sparsification when unary/binary present block captures sparse tensor argument (#184597)

Commit
22 days ago
[mlir][sparse] Fix crash in sparsification when unary/binary present block captures sparse tensor argument (#184597) `relinkBranch` in Sparsification.cpp assumed that any block argument from the outer `linalg.generic` op encountered inside an inlined semi-ring branch must be a dense tensor, and asserted accordingly. However, the `present` block of a `sparse_tensor.unary` (or similar semi-ring ops) is permitted to capture sparse tensor operands directly via `isAdmissibleBranchExp`, which accepts any `BlockArgument` as admissible. The fix removes the incorrect assertion and extends the load generation to handle sparse tensors using `genSubscript`, which already knows how to return the value buffer and current value position via the loop emitter. The `kSparseIterator` strategy (where `genSubscript` returns a `TensorType`) is also handled by emitting a `sparse_tensor.extract_value` op. Fixes #91183
Author
Parents
Loading