[Mlir-commits] [mlir] NFC: MLIR Indexing Utils comment fix (PR #183438)

Ryan Thomas Lynch llvmlistbot at llvm.org
Wed Feb 25 18:53:16 PST 2026


https://github.com/emosy created https://github.com/llvm/llvm-project/pull/183438

the comment for delinearize was incorrect and swapped modulus and division, updated comment to match code

>From 5d099b4e10aeb2d7b67693322a52bd99a875b2f0 Mon Sep 17 00:00:00 2001
From: Ryan Thomas Lynch <rlynch34 at gatech.edu>
Date: Wed, 25 Feb 2026 18:51:25 -0800
Subject: [PATCH] NFC: MLIR Indexing Utils comment fix

the comment for delinearize was incorrect and swapped modulus and division, updated comment to match code
---
 mlir/include/mlir/Dialect/Utils/IndexingUtils.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mlir/include/mlir/Dialect/Utils/IndexingUtils.h b/mlir/include/mlir/Dialect/Utils/IndexingUtils.h
index 8524072929793..daf9b0df41916 100644
--- a/mlir/include/mlir/Dialect/Utils/IndexingUtils.h
+++ b/mlir/include/mlir/Dialect/Utils/IndexingUtils.h
@@ -81,7 +81,7 @@ int64_t linearize(ArrayRef<int64_t> offsets, ArrayRef<int64_t> basis);
 ///
 /// Let `li = linearIndex`, assuming `strides` are `[s0, .. sn]`, return the
 /// vector of int64_t
-///   `[li % s0, (li / s0) % s1, ..., (li / s0 / .. / sn-1) % sn]`
+///   `[li / s0, (li % s0) / s1, ..., (li % s0 % .. % sn-1) / sn]`
 SmallVector<int64_t> delinearize(int64_t linearIndex,
                                  ArrayRef<int64_t> strides);
 
@@ -181,7 +181,7 @@ AffineExpr linearize(MLIRContext *ctx, ArrayRef<AffineExpr> offsets,
 ///
 /// Let `li = linearIndex`, assuming `strides` are `[s0, .. sn]`, return the
 /// vector of AffineExpr
-///   `[li % s0, (li / s0) % s1, ..., (li / s0 / .. / sn-1) % sn]`
+///   `[li / s0, (li % s0) / s1, ..., (li % s0 % .. % sn-1) / sn]`
 ///
 /// It is the caller's responsibility to pass proper AffineExpr kind that result
 /// in valid AffineExpr (i.e. cannot multiply 2 AffineDimExpr or divide by an



More information about the Mlir-commits mailing list