[all-commits] [llvm/llvm-project] 0f5975: [mlir][sparse] Fix crash in sparsification when un...

Mehdi Amini via All-commits all-commits at lists.llvm.org
Thu Mar 5 03:50:36 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f59753a422d6dcbe28ab07b6f01efe131375fbe
      https://github.com/llvm/llvm-project/commit/0f59753a422d6dcbe28ab07b6f01efe131375fbe
  Author: Mehdi Amini <joker.eph at gmail.com>
  Date:   2026-03-05 (Thu, 05 Mar 2026)

  Changed paths:
    M mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp
    M mlir/test/Dialect/SparseTensor/spy_sddmm.mlir

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list