[Mlir-commits] [mlir] [MLIR][Affine] Add vector support to affine.linearize_index and affine.delinearize_index (PR #188369)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Mar 25 08:57:55 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Keshav Vinayak Jha (keshavvinayak01)

<details>
<summary>Changes</summary>

Allow `affine.delinearize_index` and `affine.linearize_index` to operate on `vector<...x index>` types in addition to scalar index.

---

Patch is 25.81 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/188369.diff


6 Files Affected:

- (modified) mlir/include/mlir/Dialect/Affine/IR/AffineOps.td (+18-6) 
- (modified) mlir/lib/Dialect/Affine/IR/AffineOps.cpp (+53-9) 
- (modified) mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp (+128-13) 
- (modified) mlir/test/Dialect/Affine/affine-expand-index-ops-as-affine.mlir (+67) 
- (modified) mlir/test/Dialect/Affine/canonicalize.mlir (+53) 
- (modified) mlir/test/Dialect/Affine/ops.mlir (+42) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
index 9cb0f3242db17..3f59e008b2a7d 100644
--- a/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
+++ b/mlir/include/mlir/Dialect/Affine/IR/AffineOps.td
@@ -32,6 +32,12 @@ def Affine_Dialect : Dialect {
 class Affine_Op<string mnemonic, list<Trait> traits = []> :
     Op<Affine_Dialect, mnemonic, traits>;
 
+// Type constraint for index-like types: index or vector of index.
+def Affine_IndexOrVectorOfIndex :
+    Type<Or<[Index.predicate,
+             VectorOfAnyRankOf<[Index]>.predicate]>,
+         "index or vector of index">;
+
 // Require regions to have affine.yield.
 def ImplicitAffineTerminator
     : SingleBlockImplicitTerminator<"AffineYieldOp">;
@@ -1063,7 +1069,10 @@ def AffineVectorStoreOp : AffineStoreOpBase<"vector_store"> {
 // AffineDelinearizeIndexOp
 //===----------------------------------------------------------------------===//
 
-def AffineDelinearizeIndexOp : Affine_Op<"delinearize_index", [Pure]> {
+def AffineDelinearizeIndexOp : Affine_Op<"delinearize_index",
+    [Pure, TypesMatchWith<"linear_index type must match result types",
+                          "multi_index", "linear_index",
+                          "$_self[0]">]> {
   let summary = "delinearize an index";
   let description = [{
     The `affine.delinearize_index` operation takes a single index value and
@@ -1118,10 +1127,10 @@ def AffineDelinearizeIndexOp : Affine_Op<"delinearize_index", [Pure]> {
     - that is, the product of all basis elements is positive as an `index` as well.
   }];
 
-  let arguments = (ins Index:$linear_index,
+  let arguments = (ins Affine_IndexOrVectorOfIndex:$linear_index,
     Variadic<Index>:$dynamic_basis,
     DenseI64ArrayAttr:$static_basis);
-  let results = (outs Variadic<Index>:$multi_index);
+  let results = (outs Variadic<Affine_IndexOrVectorOfIndex>:$multi_index);
 
   let assemblyFormat = [{
     $linear_index `into`
@@ -1167,7 +1176,10 @@ def AffineDelinearizeIndexOp : Affine_Op<"delinearize_index", [Pure]> {
 // AffineLinearizeIndexOp
 //===----------------------------------------------------------------------===//
 def AffineLinearizeIndexOp : Affine_Op<"linearize_index",
-    [Pure, AttrSizedOperandSegments]> {
+    [Pure, AttrSizedOperandSegments,
+     TypesMatchWith<"multi_index types must match result type",
+                    "linear_index", "multi_index", "$_self",
+                    "[](::mlir::Type a, ::mlir::TypeRange b) { return llvm::all_of(b, [a](::mlir::Type t) { return t == a; }); }">]> {
   let summary = "linearize an index";
   let description = [{
     The `affine.linearize_index` operation takes a sequence of index values and a
@@ -1221,11 +1233,11 @@ def AffineLinearizeIndexOp : Affine_Op<"linearize_index",
     ```
   }];
 
-  let arguments = (ins Variadic<Index>:$multi_index,
+  let arguments = (ins Variadic<Affine_IndexOrVectorOfIndex>:$multi_index,
     Variadic<Index>:$dynamic_basis,
     DenseI64ArrayAttr:$static_basis,
     UnitProp:$disjoint);
-  let results = (outs Index:$linear_index);
+  let results = (outs Affine_IndexOrVectorOfIndex:$linear_index);
 
   let assemblyFormat = [{
     (`disjoint` $disjoint^)? ` `
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 839d34b41cbd4..eacf5a3bb74fb 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -4925,6 +4925,14 @@ LogicalResult AffineDelinearizeIndexOp::verify() {
       }))
     return emitOpError("no basis element may be statically non-positive");
 
+  // All result types must match the input type.
+  Type inputType = getLinearIndex().getType();
+  for (Type resultType : getResultTypes()) {
+    if (resultType != inputType)
+      return emitOpError("result types must match the linear index type, got ")
+             << resultType << " vs " << inputType;
+  }
+
   return success();
 }
 
@@ -5036,9 +5044,17 @@ struct DropUnitExtentBasis
     SmallVector<Value> replacements(delinearizeOp->getNumResults(), nullptr);
     std::optional<Value> zero = std::nullopt;
     Location loc = delinearizeOp->getLoc();
+    Type indexType = delinearizeOp.getLinearIndex().getType();
     auto getZero = [&]() -> Value {
-      if (!zero)
-        zero = arith::ConstantIndexOp::create(rewriter, loc, 0);
+      if (!zero) {
+        Value scalarZero = arith::ConstantIndexOp::create(rewriter, loc, 0);
+        if (auto vecTy = dyn_cast<VectorType>(indexType))
+          zero = arith::ConstantOp::create(
+              rewriter, loc,
+              DenseElementsAttr::get(vecTy, rewriter.getIndexAttr(0)));
+        else
+          zero = scalarZero;
+      }
       return zero.value();
     };
 
@@ -5204,9 +5220,9 @@ struct SplitDelinearizeSpanningLastLinearizeArg final
           "need at least two elements to form the basis product");
 
     Value linearizeWithoutBack = affine::AffineLinearizeIndexOp::create(
-        rewriter, linearizeOp.getLoc(), linearizeOp.getMultiIndex().drop_back(),
-        linearizeOp.getDynamicBasis(), linearizeOp.getStaticBasis().drop_back(),
-        linearizeOp.getDisjoint());
+        rewriter, linearizeOp.getLoc(), linearizeOp.getLinearIndex().getType(),
+        linearizeOp.getMultiIndex().drop_back(), linearizeOp.getDynamicBasis(),
+        linearizeOp.getStaticBasis().drop_back(), linearizeOp.getDisjoint());
     auto delinearizeWithoutSplitPart = affine::AffineDelinearizeIndexOp::create(
         rewriter, delinearizeOp.getLoc(), linearizeWithoutBack,
         delinearizeOp.getDynamicBasis(), basis.drop_back(elemsToSplit),
@@ -5236,6 +5252,14 @@ void affine::AffineDelinearizeIndexOp::getCanonicalizationPatterns(
 // LinearizeIndexOp
 //===----------------------------------------------------------------------===//
 
+/// Infer the index type from a set of multi-index values. Returns the common
+/// type (index or vector<...xindex>), or IndexType if the set is empty.
+static Type inferIndexType(MLIRContext *ctx, ValueRange multiIndex) {
+  if (multiIndex.empty())
+    return IndexType::get(ctx);
+  return multiIndex.front().getType();
+}
+
 void AffineLinearizeIndexOp::build(OpBuilder &odsBuilder,
                                    OperationState &odsState,
                                    ValueRange multiIndex, ValueRange basis,
@@ -5246,7 +5270,9 @@ void AffineLinearizeIndexOp::build(OpBuilder &odsBuilder,
   SmallVector<int64_t> staticBasis;
   dispatchIndexOpFoldResults(getAsOpFoldResult(basis), dynamicBasis,
                              staticBasis);
-  build(odsBuilder, odsState, multiIndex, dynamicBasis, staticBasis, disjoint);
+  Type resultType = inferIndexType(odsBuilder.getContext(), multiIndex);
+  build(odsBuilder, odsState, resultType, multiIndex, dynamicBasis, staticBasis,
+        disjoint);
 }
 
 void AffineLinearizeIndexOp::build(OpBuilder &odsBuilder,
@@ -5259,14 +5285,18 @@ void AffineLinearizeIndexOp::build(OpBuilder &odsBuilder,
   SmallVector<Value> dynamicBasis;
   SmallVector<int64_t> staticBasis;
   dispatchIndexOpFoldResults(basis, dynamicBasis, staticBasis);
-  build(odsBuilder, odsState, multiIndex, dynamicBasis, staticBasis, disjoint);
+  Type resultType = inferIndexType(odsBuilder.getContext(), multiIndex);
+  build(odsBuilder, odsState, resultType, multiIndex, dynamicBasis, staticBasis,
+        disjoint);
 }
 
 void AffineLinearizeIndexOp::build(OpBuilder &odsBuilder,
                                    OperationState &odsState,
                                    ValueRange multiIndex,
                                    ArrayRef<int64_t> basis, bool disjoint) {
-  build(odsBuilder, odsState, multiIndex, ValueRange{}, basis, disjoint);
+  Type resultType = inferIndexType(odsBuilder.getContext(), multiIndex);
+  build(odsBuilder, odsState, resultType, multiIndex, ValueRange{}, basis,
+        disjoint);
 }
 
 LogicalResult AffineLinearizeIndexOp::verify() {
@@ -5284,6 +5314,14 @@ LogicalResult AffineLinearizeIndexOp::verify() {
         "corresponding dynamic basis entry) -- this can only happen due to an "
         "incorrect fold/rewrite");
 
+  // All multi_index types must match the result type.
+  Type resultType = getLinearIndex().getType();
+  for (Value idx : getMultiIndex()) {
+    if (idx.getType() != resultType)
+      return emitOpError("multi_index types must match the result type, got ")
+             << idx.getType() << " vs " << resultType;
+  }
+
   return success();
 }
 
@@ -5402,7 +5440,13 @@ struct DropLinearizeUnitComponentsIfDisjointOrZero final
                                          "no unit basis entries to replace");
 
     if (newIndices.empty()) {
-      rewriter.replaceOpWithNewOp<arith::ConstantIndexOp>(op, 0);
+      Type resultType = op.getLinearIndex().getType();
+      if (auto vecTy = dyn_cast<VectorType>(resultType)) {
+        rewriter.replaceOpWithNewOp<arith::ConstantOp>(
+            op, DenseElementsAttr::get(vecTy, rewriter.getIndexAttr(0)));
+      } else {
+        rewriter.replaceOpWithNewOp<arith::ConstantIndexOp>(op, 0);
+      }
       return success();
     }
     rewriter.replaceOpWithNewOp<affine::AffineLinearizeIndexOp>(
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp
index e919bc6d36265..0178c5159df53 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp
@@ -15,7 +15,9 @@
 #include "mlir/Dialect/Affine/IR/AffineOps.h"
 #include "mlir/Dialect/Affine/Transforms/Transforms.h"
 #include "mlir/Dialect/Affine/Utils.h"
+#include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/Arith/Utils/Utils.h"
+#include "mlir/Dialect/Utils/StaticValueUtils.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
 namespace mlir {
@@ -29,6 +31,33 @@ using namespace mlir;
 using namespace mlir::affine;
 
 namespace {
+
+/// Create a constant splat of the given type with the given integer value.
+static Value createTypedConstant(OpBuilder &b, Location loc, Type type,
+                                 int64_t value) {
+  if (auto vecTy = dyn_cast<VectorType>(type))
+    return arith::ConstantOp::create(
+        b, loc, DenseElementsAttr::get(vecTy, b.getIndexAttr(value)));
+  return arith::ConstantIndexOp::create(b, loc, value);
+}
+
+/// Materialize an OpFoldResult (which represents a scalar index or constant)
+/// as a Value matching the given target type. For vector target types, scalar
+/// constants are splatted. Returns failure for dynamic basis with vector types
+/// since that requires vector.broadcast which is not available here.
+static FailureOr<Value> materializeBasis(OpBuilder &b, Location loc,
+                                         OpFoldResult ofr, Type targetType) {
+  std::optional<int64_t> cst = getConstantIntValue(ofr);
+  if (cst)
+    return createTypedConstant(b, loc, targetType, *cst);
+  // Dynamic scalar basis value. For scalar target types, return as-is.
+  if (isa<IndexType>(targetType))
+    return getValueOrCreateConstantIndexOp(b, loc, ofr);
+  // Dynamic scalar basis with vector target type -- would need
+  // vector.broadcast, bail out.
+  return failure();
+}
+
 /// Lowers `affine.delinearize_index` into a sequence of division and remainder
 /// operations.
 struct LowerDelinearizeIndexOps
@@ -36,12 +65,51 @@ struct LowerDelinearizeIndexOps
   using OpRewritePattern<AffineDelinearizeIndexOp>::OpRewritePattern;
   LogicalResult matchAndRewrite(AffineDelinearizeIndexOp op,
                                 PatternRewriter &rewriter) const override {
-    FailureOr<SmallVector<Value>> multiIndex =
-        delinearizeIndex(rewriter, op->getLoc(), op.getLinearIndex(),
-                         op.getEffectiveBasis(), /*hasOuterBound=*/false);
-    if (failed(multiIndex))
-      return failure();
-    rewriter.replaceOp(op, *multiIndex);
+    // For scalar types, use the existing affine lowering path.
+    if (isa<IndexType>(op.getLinearIndex().getType())) {
+      FailureOr<SmallVector<Value>> multiIndex =
+          delinearizeIndex(rewriter, op->getLoc(), op.getLinearIndex(),
+                           op.getEffectiveBasis(), /*hasOuterBound=*/false);
+      if (failed(multiIndex))
+        return failure();
+      rewriter.replaceOp(op, *multiIndex);
+      return success();
+    }
+
+    // Vector lowering: emit arith div/rem ops (which work element-wise on
+    // vectors).
+    Location loc = op.getLoc();
+    Value linearIndex = op.getLinearIndex();
+    Type type = linearIndex.getType();
+    SmallVector<OpFoldResult> basis = op.getEffectiveBasis();
+
+    // Compute cumulative products of basis from the right. These serve as
+    // divisors: for basis (B0, B1, B2), the divisors are (B1*B2, B2).
+    SmallVector<Value> divisors;
+    Value cumulativeProd = createTypedConstant(rewriter, loc, type, 1);
+    for (OpFoldResult basisElem : llvm::reverse(basis)) {
+      FailureOr<Value> basisVal =
+          materializeBasis(rewriter, loc, basisElem, type);
+      if (failed(basisVal))
+        return failure();
+      cumulativeProd =
+          arith::MulIOp::create(rewriter, loc, cumulativeProd, *basisVal);
+      divisors.push_back(cumulativeProd);
+    }
+
+    // Emit div/mod pairs from the most-significant dimension to the least.
+    SmallVector<Value> results;
+    results.reserve(divisors.size() + 1);
+    Value residual = linearIndex;
+    for (Value divisor : llvm::reverse(divisors)) {
+      Value quotient = arith::DivSIOp::create(rewriter, loc, residual, divisor);
+      Value product = arith::MulIOp::create(rewriter, loc, quotient, divisor);
+      Value remainder = arith::SubIOp::create(rewriter, loc, residual, product);
+      results.push_back(quotient);
+      residual = remainder;
+    }
+    results.push_back(residual);
+    rewriter.replaceOp(op, results);
     return success();
   }
 };
@@ -58,13 +126,60 @@ struct LowerLinearizeIndexOps final : OpRewritePattern<AffineLinearizeIndexOp> {
       return success();
     }
 
-    SmallVector<OpFoldResult> multiIndex =
-        getAsOpFoldResult(op.getMultiIndex());
-    OpFoldResult linearIndex =
-        linearizeIndex(rewriter, op.getLoc(), multiIndex, op.getMixedBasis());
-    Value linearIndexValue =
-        getValueOrCreateConstantIntOp(rewriter, op.getLoc(), linearIndex);
-    rewriter.replaceOp(op, linearIndexValue);
+    // For scalar types, use the existing affine lowering path.
+    if (isa<IndexType>(op.getLinearIndex().getType())) {
+      SmallVector<OpFoldResult> multiIndex =
+          getAsOpFoldResult(op.getMultiIndex());
+      OpFoldResult linearIndex =
+          linearizeIndex(rewriter, op.getLoc(), multiIndex, op.getMixedBasis());
+      Value linearIndexValue =
+          getValueOrCreateConstantIntOp(rewriter, op.getLoc(), linearIndex);
+      rewriter.replaceOp(op, linearIndexValue);
+      return success();
+    }
+
+    // Vector lowering: emit arith ops (which work element-wise on vectors).
+    //
+    // linearize_index [i0, i1, ..., iN-1] by (B0, B1, ..., BN-1)
+    // = i0 * stride_0 + i1 * stride_1 + ... + iN-1
+    // where stride_k = B_{k+1} * B_{k+2} * ... * B_{N-1}
+    //
+    // We compute from the back: result = iN-1, stride = 1, then:
+    //   stride *= B_{k}, result += i_k * stride
+    Location loc = op.getLoc();
+    Type type = op.getLinearIndex().getType();
+    SmallVector<OpFoldResult> effectiveBasis = op.getEffectiveBasis();
+    ValueRange indices = op.getMultiIndex();
+
+    // effectiveBasis drops the outer bound. For indices [i0, i1, ..., iN-1]:
+    //   no outer bound:  effectiveBasis = [B1, B2, ..., BN-1] (N-1 elems)
+    //   has outer bound: effectiveBasis = [B0, B1, ..., BN-1] (N elems,
+    //                    but B0 is advisory, dropped by getEffectiveBasis)
+    //
+    // Computation: result = iN-1 + BN-1 * (iN-2 + BN-2 * (... + B1 * i0))
+    // Or equivalently, accumulate from back:
+    //   result = iN-1
+    //   stride = 1
+    //   for k = numBasis-1 downto 0:
+    //     stride *= effectiveBasis[k]
+    //     result += indices[k] * stride
+    //
+    // This works because effectiveBasis[k] is the "size" of dimension k+1,
+    // and indices[k] is paired with the product of all sizes after it.
+    Value result = indices.back();
+    Value stride = createTypedConstant(rewriter, loc, type, 1);
+
+    for (int i = static_cast<int>(effectiveBasis.size()) - 1; i >= 0; --i) {
+      FailureOr<Value> basisVal =
+          materializeBasis(rewriter, loc, effectiveBasis[i], type);
+      if (failed(basisVal))
+        return failure();
+      stride = arith::MulIOp::create(rewriter, loc, stride, *basisVal);
+      Value term = arith::MulIOp::create(rewriter, loc, indices[i], stride);
+      result = arith::AddIOp::create(rewriter, loc, term, result);
+    }
+
+    rewriter.replaceOp(op, result);
     return success();
   }
 };
diff --git a/mlir/test/Dialect/Affine/affine-expand-index-ops-as-affine.mlir b/mlir/test/Dialect/Affine/affine-expand-index-ops-as-affine.mlir
index bf9f00da5793a..21595356936fa 100644
--- a/mlir/test/Dialect/Affine/affine-expand-index-ops-as-affine.mlir
+++ b/mlir/test/Dialect/Affine/affine-expand-index-ops-as-affine.mlir
@@ -68,3 +68,70 @@ func.func @linearize_dynamic(%arg0: index, %arg1: index, %arg2: index, %arg3: in
   %0 = affine.linearize_index [%arg0, %arg1, %arg2] by (%arg3, %arg4) : index
   func.return %0 : index
 }
+
+// -----
+
+// CHECK-LABEL: @expand_delinearize_vector
+// CHECK-SAME:    (%[[VEC:.+]]: vector<16xindex>)
+// CHECK-DAG:     %[[C8:.+]] = arith.constant dense<8> : vector<16xindex>
+// CHECK:         %[[DIV:.+]] = arith.divsi %[[VEC]], %[[C8]]
+// CHECK:         %[[MUL:.+]] = arith.muli %[[DIV]], %[[C8]]
+// CHECK:         %[[REM:.+]] = arith.subi %[[VEC]], %[[MUL]]
+// CHECK:         return %[[DIV]], %[[REM]]
+func.func @expand_delinearize_vector(%vec: vector<16xindex>) -> (vector<16xindex>, vector<16xindex>) {
+  %0:2 = affine.delinearize_index %vec into (4, 8) : vector<16xindex>, vector<16xindex>
+  return %0#0, %0#1 : vector<16xindex>, vector<16xindex>
+}
+
+// -----
+
+// CHECK-LABEL: @expand_linearize_vector
+// CHECK-SAME:    (%[[V0:.+]]: vector<16xindex>, %[[V1:.+]]: vector<16xindex>)
+// CHECK-DAG:     %[[C8:.+]] = arith.constant dense<8> : vector<16xindex>
+// CHECK:         %[[MUL:.+]] = arith.muli %[[V0]], %[[C8]]
+// CHECK:         %[[ADD:.+]] = arith.addi %[[MUL]], %[[V1]]
+// CHECK:         return %[[ADD]]
+func.func @expand_linearize_vector(%v0: vector<16xindex>, %v1: vector<16xindex>) -> vector<16xindex> {
+  %0 = affine.linearize_index [%v0, %v1] by (4, 8) : vector<16xindex>
+  return %0 : vector<16xindex>
+}
+
+// -----
+
+// CHECK-LABEL: @expand_delinearize_vector_3d
+// CHECK-SAME:    (%[[VEC:.+]]: vector<16xindex>)
+// CHECK-DAG:     %[[C4:.+]] = arith.constant dense<4> : vector<16xindex>
+// CHECK-DAG:     %[[C12:.+]] = arith.constant dense<12> : vector<16xindex>
+// CHECK:         %[[D0:.+]] = arith.divsi %[[VEC]], %[[C12]]
+// CHECK:         %[[M0:.+]] = arith.muli %[[D0]], %[[C12]]
+// CHECK:         %[[R0:.+]] = arith.subi %[[VEC]], %[[M0]]
+// CHECK:         %[[D1:.+]] = arith.divsi %[[R0]], %[[C4]]
+// CHECK:         %[[M1:.+]] = arith.muli %[[D1]], %[[C4]]
+// CHECK:         %[[R1:.+]] = arith.subi %[[R0]], %[[M1]]
+// CHECK:         return %[[D0]], %[[D1]], %[[R1]]
+func.func @expand_delinearize_vector_3d(%vec: vector<16xindex>) -> (vector<16xindex>, vector<16xindex>, vector<16xindex>) {
+  %0:3 = affine.delinearize_index %vec into (2, 3, 4) : vector<16xindex>, vector<16xindex>, vector<16xindex>
+  return %0#0, %0#1, %0#2 : vector<16xindex>, vector<16xindex>, vector<16xindex>
+}
+
+// -----
+
+// Vector linearize -> offset -> delinearize pattern
+// (as would be used in vector.gather lowering).
+
+// CHECK-LABEL: @vector_linearize_offset_delinearize
+// CHECK-SAME:    (%[[V0:.+]]: vector<4xindex>, %[[V1:.+]]: vector<4xindex>, %[[OFF:.+]]: vector<4xindex>)
+// CHECK-DAG:     %[[C8:.+]] = arith.constant dense<8> : vector<4xindex>
+// CHECK:         %[[LIN:.+]] = arith.muli %[[V0]], %[[C8]]
+// CHECK:         %[[LIN2:.+]] = arith.addi %[[LIN]], %[[V1]]
+// CHECK:         %[[FLAT:.+]] = arith.addi %[[LIN2]], %[[OFF]]
+// CHECK:         %[[DIV:.+]] = arith.divsi %[[FLAT]], %[[C8]]
+// CHECK:         %[[MUL:.+]] = arith.m...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/188369


More information about the Mlir-commits mailing list