[Mlir-commits] [mlir] [mlir][sparse] Fix output entry count for loose-compressed tensors (PR #224167)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Oct 5 20:06:28 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
index 35a11b8b1..7541d4973 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
@@ -1544,14 +1544,14 @@ struct OutRewriter : public OpRewritePattern<OutOp> {
// that sparse iteration will emit before creating the writer.
Value zero = constantIndex(rewriter, loc, 0);
Value one = constantIndex(rewriter, loc, 1);
- auto count = ForeachOp::create(
- rewriter, loc, src, ValueRange{zero},
- [one](OpBuilder &builder, Location loc, ValueRange, Value,
- ValueRange iterArgs) {
- Value next = arith::AddIOp::create(builder, loc, iterArgs.front(),
- one);
- sparse_tensor::YieldOp::create(builder, loc, next);
- });
+ auto count =
+ ForeachOp::create(rewriter, loc, src, ValueRange{zero},
+ [one](OpBuilder &builder, Location loc, ValueRange,
+ Value, ValueRange iterArgs) {
+ Value next = arith::AddIOp::create(
+ builder, loc, iterArgs.front(), one);
+ sparse_tensor::YieldOp::create(builder, loc, next);
+ });
Value numEntries = count.getResult(0);
// Allocate a temporary buffer for storing dimension-sizes/coordinates.
``````````
</details>
https://github.com/llvm/llvm-project/pull/224167
More information about the Mlir-commits
mailing list