[all-commits] [llvm/llvm-project] 34c58c: [mlir][sparse] Include sparse emit strategy in wra...
Jordan Rupprecht via All-commits
all-commits at lists.llvm.org
Wed Oct 29 13:40:26 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 34c58c8b7c3dbf831bb1d26f1624af3e6a56edc7
https://github.com/llvm/llvm-project/commit/34c58c8b7c3dbf831bb1d26f1624af3e6a56edc7
Author: Jordan Rupprecht <rupprecht at google.com>
Date: 2025-10-29 (Wed, 29 Oct 2025)
Changed paths:
M mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.cpp
M mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.h
Log Message:
-----------
[mlir][sparse] Include sparse emit strategy in wrapping iterator (#165611)
When we create a `SparseIterator`, we sometimes wrap it in a
`FilterIterator`, which delegates _some_ calls to the underlying
`SparseIterator`.
After construction, e.g. in `makeNonEmptySubSectIterator()`, we call
`setSparseEmitStrategy()`. This sets the strategy only in one of the
filters -- if we call `setSparseEmitStrategy()` immediately after
creating the `SparseIterator`, then the wrapped `SparseIterator` will
have the right strategy, and the `FilterIterator` strategy will be
unintialized; if we call `setSparseEmitStrategy()` after wrapping the
iterator in `FilterIterator`, then the opposite happens.
If we make `setSparseEmitStrategy()` a virtual method so that it's
included in the `FilterIterator` pattern, and then do all reads of
`emitStrategy` via a virtual method as well, it's pretty simple to
ensure that the value of `strategy` is being set consistently and
correctly.
Without this, the UB of strategy being uninitialized manifests as a
sporadic test failure in
mlir/test/Integration/Dialect/SparseTensor/CPU/sparse_strided_conv_2d_nhwc_hwcf.mlir,
when run downstream with the right flags (e.g. asan + assertions off).
The test sometimes fails with `ne_sub<trivial<dense[0,1]>>.begin' op
created with unregistered dialect`. It can also be directly observed w/
msan that this uninitialized read is the cause of that issue, but msan
causes other problems w/ this test.
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