diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp @@ -456,9 +456,7 @@ ValueRange reduc) { SmallVector indices; for (int64_t i = 0; i < rank; i++) { - uint64_t dim = - toStoredDim(getSparseTensorEncoding(input.getType()), i); - Value idx = args[dim]; + Value idx = args[i]; if (i == static_cast(conDim)) // transform coordinates on matching dim idx = builder.create(loc, idx, offset);