Skip to content

Conversation

fabianmcg
Copy link
Contributor

Introduces a dataflow analysis for tracking offset, size, and stride ranges of operations.
Inference of the metadata is accomplished through the implementation of the interface
InferStridedMetadataOpInterface.

To keep the size of the patch small, this patch only implements the interface for the
memref.subview operation. It's future work to add more operations.

Example:

func.func @memref_subview(%arg0: memref<8x16x4xf32, strided<[64, 4, 1]>>) {
  %c0 = arith.constant 0 : index
  %c1 = arith.constant 1 : index
  %c2 = arith.constant 2 : index
  %0 = test.with_bounds {smax = 13 : index, smin = 11 : index, umax = 13 : index, umin = 11 : index} : index
  %1 = test.with_bounds {smax = 7 : index, smin = 5 : index, umax = 7 : index, umin = 5 : index} : index
  %subview = memref.subview %arg0[%c0, %c0, %c1] [%1, %0, %c2] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1]>> to memref<?x?x?xf32, strided<[?, ?, ?], offset: ?>>
  return
}

Applying mlir-opt --test-strided-metadata-range-analysis prints:

Op: %subview = memref.subview %arg0[%c0, %c0, %c1] [%1, %0, %c2] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1]>> to memref<?x?x?xf32, strided<[?, ?, ?], offset: ?>>
  result[0]: strided_metadata<offset = [{unsigned : [1, 1] signed : [1, 1]}], sizes = [{unsigned : [5, 7] signed : [5, 7]}, {unsigned : [11, 13] signed : [11, 13]}, {unsigned : [2, 2] signed : [2, 2]}], strides = [{unsigned : [64, 64] signed : [64, 64]}, {unsigned : [4, 4] signed : [4, 4]}, {unsigned : [1, 1] signed : [1, 1]}]>

@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir mlir:memref labels Sep 29, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 29, 2025

@llvm/pr-subscribers-mlir-memref
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Fabian Mora (fabianmcg)

Changes

Introduces a dataflow analysis for tracking offset, size, and stride ranges of operations.
Inference of the metadata is accomplished through the implementation of the interface
InferStridedMetadataOpInterface.

To keep the size of the patch small, this patch only implements the interface for the
memref.subview operation. It's future work to add more operations.

Example:

func.func @<!-- -->memref_subview(%arg0: memref&lt;8x16x4xf32, strided&lt;[64, 4, 1]&gt;&gt;) {
  %c0 = arith.constant 0 : index
  %c1 = arith.constant 1 : index
  %c2 = arith.constant 2 : index
  %0 = test.with_bounds {smax = 13 : index, smin = 11 : index, umax = 13 : index, umin = 11 : index} : index
  %1 = test.with_bounds {smax = 7 : index, smin = 5 : index, umax = 7 : index, umin = 5 : index} : index
  %subview = memref.subview %arg0[%c0, %c0, %c1] [%1, %0, %c2] [%c1, %c1, %c1] : memref&lt;8x16x4xf32, strided&lt;[64, 4, 1]&gt;&gt; to memref&lt;?x?x?xf32, strided&lt;[?, ?, ?], offset: ?&gt;&gt;
  return
}

Applying mlir-opt --test-strided-metadata-range-analysis prints:

Op: %subview = memref.subview %arg0[%c0, %c0, %c1] [%1, %0, %c2] [%c1, %c1, %c1] : memref&lt;8x16x4xf32, strided&lt;[64, 4, 1]&gt;&gt; to memref&lt;?x?x?xf32, strided&lt;[?, ?, ?], offset: ?&gt;&gt;
  result[0]: strided_metadata&lt;offset = [{unsigned : [1, 1] signed : [1, 1]}], sizes = [{unsigned : [5, 7] signed : [5, 7]}, {unsigned : [11, 13] signed : [11, 13]}, {unsigned : [2, 2] signed : [2, 2]}], strides = [{unsigned : [64, 64] signed : [64, 64]}, {unsigned : [4, 4] signed : [4, 4]}, {unsigned : [1, 1] signed : [1, 1]}]&gt;

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

17 Files Affected:

  • (added) mlir/include/mlir/Analysis/DataFlow/StridedMetadataRangeAnalysis.h (+54)
  • (added) mlir/include/mlir/Dialect/MemRef/IR/InferStridedMetadataInterfaceImpl.h (+25)
  • (modified) mlir/include/mlir/Interfaces/CMakeLists.txt (+1)
  • (modified) mlir/include/mlir/Interfaces/InferIntRangeInterface.h (+2-1)
  • (added) mlir/include/mlir/Interfaces/InferStridedMetadataInterface.h (+148)
  • (added) mlir/include/mlir/Interfaces/InferStridedMetadataInterface.td (+43)
  • (modified) mlir/lib/Analysis/CMakeLists.txt (+1)
  • (added) mlir/lib/Analysis/DataFlow/StridedMetadataRangeAnalysis.cpp (+127)
  • (modified) mlir/lib/Dialect/MemRef/IR/CMakeLists.txt (+3-1)
  • (added) mlir/lib/Dialect/MemRef/IR/InferStridedMetadataInterfaceImpl.cpp (+118)
  • (modified) mlir/lib/Interfaces/CMakeLists.txt (+2)
  • (added) mlir/lib/Interfaces/InferStridedMetadataInterface.cpp (+36)
  • (modified) mlir/lib/RegisterAllDialects.cpp (+2)
  • (added) mlir/test/Analysis/DataFlow/test-strided-metadata-range-analysis.mlir (+67)
  • (modified) mlir/test/lib/Analysis/CMakeLists.txt (+1)
  • (added) mlir/test/lib/Analysis/DataFlow/TestStridedMetadataRangeAnalysis.cpp (+86)
  • (modified) mlir/tools/mlir-opt/mlir-opt.cpp (+2)
diff --git a/mlir/include/mlir/Analysis/DataFlow/StridedMetadataRangeAnalysis.h b/mlir/include/mlir/Analysis/DataFlow/StridedMetadataRangeAnalysis.h
new file mode 100644
index 0000000000000..72ac2477435db
--- /dev/null
+++ b/mlir/include/mlir/Analysis/DataFlow/StridedMetadataRangeAnalysis.h
@@ -0,0 +1,54 @@
+//===- StridedMetadataRange.h - Strided metadata range analysis -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_ANALYSIS_DATAFLOW_STRIDEDMETADATARANGE_H
+#define MLIR_ANALYSIS_DATAFLOW_STRIDEDMETADATARANGE_H
+
+#include "mlir/Analysis/DataFlow/SparseAnalysis.h"
+#include "mlir/Interfaces/InferStridedMetadataInterface.h"
+
+namespace mlir {
+namespace dataflow {
+
+/// This lattice element represents the strided metadata of an SSA value.
+class StridedMetadataRangeLattice : public Lattice<StridedMetadataRange> {
+public:
+  using Lattice::Lattice;
+};
+
+/// Strided metadata range analysis determines the strided metadata ranges of
+/// SSA values using operations that define `InferStridedMetadataInterface`.
+///
+/// This analysis depends on DeadCodeAnalysis, SparseConstantPropagation, and
+/// IntegerRangeAnalysis, and will be a silent no-op if the analyses are not
+/// loaded in the same solver context.
+class StridedMetadataRangeAnalysis
+    : public SparseForwardDataFlowAnalysis<StridedMetadataRangeLattice> {
+public:
+  StridedMetadataRangeAnalysis(DataFlowSolver &solver,
+                               int32_t indexBitwidth = 64);
+
+  /// At an entry point, we cannot reason about strided metadata ranges unless
+  /// the type also encodes the data. For example, a memref with static layout.
+  void setToEntryState(StridedMetadataRangeLattice *lattice) override;
+
+  /// Visit an operation. Invoke the transfer function on each operation that
+  /// implements `InferStridedMetadataInterface`.
+  LogicalResult
+  visitOperation(Operation *op,
+                 ArrayRef<const StridedMetadataRangeLattice *> operands,
+                 ArrayRef<StridedMetadataRangeLattice *> results) override;
+
+private:
+  /// Index bitwidth to use when operating with the int-ranges.
+  int32_t indexBitwidth = 64;
+};
+} // namespace dataflow
+} // end namespace mlir
+
+#endif // MLIR_ANALYSIS_DATAFLOW_STRIDEDMETADATARANGE_H
diff --git a/mlir/include/mlir/Dialect/MemRef/IR/InferStridedMetadataInterfaceImpl.h b/mlir/include/mlir/Dialect/MemRef/IR/InferStridedMetadataInterfaceImpl.h
new file mode 100644
index 0000000000000..ca3bc78648ab2
--- /dev/null
+++ b/mlir/include/mlir/Dialect/MemRef/IR/InferStridedMetadataInterfaceImpl.h
@@ -0,0 +1,25 @@
+//===- InferStridedMetadataOpInterfaceImpl.h - Impl. of infer strided md --===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_DIALECT_MEMREF_IR_INFERSTRIDEDMETADATAOPINTERFACEIMPL_H
+#define MLIR_DIALECT_MEMREF_IR_INFERSTRIDEDMETADATAOPINTERFACEIMPL_H
+
+namespace mlir {
+class DialectRegistry;
+
+namespace memref {
+/// Register the external models for the infer strided metadata op interface,
+/// for the `memref` dialect. This implementation assumes that the strided
+/// metadata of a ranked memref consists of one offset, and zero or more sizes
+/// and strides.
+void registerInferStridedMetadataOpInterfaceExternalModels(
+    DialectRegistry &registry);
+} // namespace memref
+} // namespace mlir
+
+#endif // MLIR_DIALECT_MEMREF_IR_INFERSTRIDEDMETADATAOPINTERFACEIMPL_H
diff --git a/mlir/include/mlir/Interfaces/CMakeLists.txt b/mlir/include/mlir/Interfaces/CMakeLists.txt
index a5feb592045c0..72ed046a1ba5d 100644
--- a/mlir/include/mlir/Interfaces/CMakeLists.txt
+++ b/mlir/include/mlir/Interfaces/CMakeLists.txt
@@ -6,6 +6,7 @@ add_mlir_interface(DestinationStyleOpInterface)
 add_mlir_interface(FunctionInterfaces)
 add_mlir_interface(IndexingMapOpInterface)
 add_mlir_interface(InferIntRangeInterface)
+add_mlir_interface(InferStridedMetadataInterface)
 add_mlir_interface(InferTypeOpInterface)
 add_mlir_interface(LoopLikeInterface)
 add_mlir_interface(MemOpInterfaces)
diff --git a/mlir/include/mlir/Interfaces/InferIntRangeInterface.h b/mlir/include/mlir/Interfaces/InferIntRangeInterface.h
index 0e107e88f5232..a9e3e82acdc4f 100644
--- a/mlir/include/mlir/Interfaces/InferIntRangeInterface.h
+++ b/mlir/include/mlir/Interfaces/InferIntRangeInterface.h
@@ -117,7 +117,8 @@ class IntegerValueRange {
   IntegerValueRange(ConstantIntRanges value) : value(std::move(value)) {}
 
   /// Create an integer value range lattice value.
-  IntegerValueRange(std::optional<ConstantIntRanges> value = std::nullopt)
+  explicit IntegerValueRange(
+      std::optional<ConstantIntRanges> value = std::nullopt)
       : value(std::move(value)) {}
 
   /// Whether the range is uninitialized. This happens when the state hasn't
diff --git a/mlir/include/mlir/Interfaces/InferStridedMetadataInterface.h b/mlir/include/mlir/Interfaces/InferStridedMetadataInterface.h
new file mode 100644
index 0000000000000..8d633daba6f1b
--- /dev/null
+++ b/mlir/include/mlir/Interfaces/InferStridedMetadataInterface.h
@@ -0,0 +1,148 @@
+//===- InferStridedMetadataInterface.h - Strided Metadata Inference -C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains definitions of the strided metadata inference interface
+// defined in `InferStridedMetadataInterface.td`
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_INTERFACES_INFERSTRIDEDMETADATAINTERFACE_H
+#define MLIR_INTERFACES_INFERSTRIDEDMETADATAINTERFACE_H
+
+#include "mlir/Interfaces/InferIntRangeInterface.h"
+
+namespace mlir {
+/// A class that represents the strided metadata range information, including
+/// offsets, sizes, and strides as integer ranges.
+class StridedMetadataRange {
+public:
+  /// Default constructor creates uninitialized ranges.
+  StridedMetadataRange() = default;
+
+  /// Returns a ranked strided metadata range.
+  static StridedMetadataRange
+  getRanked(SmallVectorImpl<ConstantIntRanges> &&offsets,
+            SmallVectorImpl<ConstantIntRanges> &&sizes,
+            SmallVectorImpl<ConstantIntRanges> &&strides) {
+    return StridedMetadataRange(std::move(offsets), std::move(sizes),
+                                std::move(strides));
+  }
+
+  /// Returns a strided metadata range with maximum ranges.
+  static StridedMetadataRange getMaxRanges(int32_t indexBitwidth,
+                                           int32_t offsetsRank,
+                                           int32_t sizeRank,
+                                           int32_t stridedRank) {
+    return StridedMetadataRange(
+        SmallVector<ConstantIntRanges>(
+            offsetsRank, ConstantIntRanges::maxRange(indexBitwidth)),
+        SmallVector<ConstantIntRanges>(
+            sizeRank, ConstantIntRanges::maxRange(indexBitwidth)),
+        SmallVector<ConstantIntRanges>(
+            stridedRank, ConstantIntRanges::maxRange(indexBitwidth)));
+  }
+
+  static StridedMetadataRange getMaxRanges(int32_t indexBitwidth,
+                                           int32_t rank) {
+    return getMaxRanges(indexBitwidth, 1, rank, rank);
+  }
+
+  /// Returns whether the metadata is uninitialized.
+  bool isUninitialized() const { return !offsets.has_value(); }
+
+  /// Get the offsets range.
+  ArrayRef<ConstantIntRanges> getOffsets() const {
+    return offsets ? *offsets : ArrayRef<ConstantIntRanges>();
+  }
+  MutableArrayRef<ConstantIntRanges> getOffsets() {
+    return offsets ? *offsets : MutableArrayRef<ConstantIntRanges>();
+  }
+
+  /// Get the sizes ranges.
+  ArrayRef<ConstantIntRanges> getSizes() const { return sizes; }
+  MutableArrayRef<ConstantIntRanges> getSizes() { return sizes; }
+
+  /// Get the strides ranges.
+  ArrayRef<ConstantIntRanges> getStrides() const { return strides; }
+  MutableArrayRef<ConstantIntRanges> getStrides() { return strides; }
+
+  /// Compare two strided metadata ranges.
+  bool operator==(const StridedMetadataRange &other) const {
+    return offsets == other.offsets && sizes == other.sizes &&
+           strides == other.strides;
+  }
+
+  /// Print the strided metadata range.
+  void print(raw_ostream &os) const;
+
+  /// Join two strided metadata ranges, by taking the element-wise union of the
+  /// metadata.
+  static StridedMetadataRange join(const StridedMetadataRange &lhs,
+                                   const StridedMetadataRange &rhs) {
+    if (lhs.isUninitialized())
+      return rhs;
+    if (rhs.isUninitialized())
+      return lhs;
+
+    // Helper fuction to compute the range union of constant ranges.
+    auto rangeUnion =
+        +[](const std::tuple<ConstantIntRanges, ConstantIntRanges> &lhsRhs)
+        -> ConstantIntRanges {
+      return std::get<0>(lhsRhs).rangeUnion(std::get<1>(lhsRhs));
+    };
+
+    // Get the elementwise range union. Note, that `zip_equal` will assert if
+    // sizes are not equal.
+    SmallVector<ConstantIntRanges> offsets = llvm::map_to_vector(
+        llvm::zip_equal(*lhs.offsets, *rhs.offsets), rangeUnion);
+    SmallVector<ConstantIntRanges> sizes =
+        llvm::map_to_vector(llvm::zip_equal(lhs.sizes, rhs.sizes), rangeUnion);
+    SmallVector<ConstantIntRanges> strides = llvm::map_to_vector(
+        llvm::zip_equal(lhs.strides, rhs.strides), rangeUnion);
+
+    // Return the joined metadata.
+    return StridedMetadataRange(std::move(offsets), std::move(sizes),
+                                std::move(strides));
+  }
+
+private:
+  /// Create a strided metadata range with the given offset, sizes, and strides.
+  StridedMetadataRange(SmallVectorImpl<ConstantIntRanges> &&offsets,
+                       SmallVectorImpl<ConstantIntRanges> &&sizes,
+                       SmallVectorImpl<ConstantIntRanges> &&strides)
+      : offsets(std::move(offsets)), sizes(std::move(sizes)),
+        strides(std::move(strides)) {}
+
+  /// The offsets range.
+  std::optional<SmallVector<ConstantIntRanges>> offsets;
+
+  /// The sizes ranges.
+  SmallVector<ConstantIntRanges> sizes;
+
+  /// The strides ranges.
+  SmallVector<ConstantIntRanges> strides;
+};
+
+/// Print the strided metadata to `os`.
+inline raw_ostream &operator<<(raw_ostream &os,
+                               const StridedMetadataRange &range) {
+  range.print(os);
+  return os;
+}
+
+/// Callback function type to get the integer range of a value.
+using GetIntRangeFn = function_ref<IntegerValueRange(Value)>;
+
+/// Callback function type for setting the strided metadata of a value.
+using SetStridedMetadataRangeFn =
+    function_ref<void(Value, const StridedMetadataRange &)>;
+} // end namespace mlir
+
+#include "mlir/Interfaces/InferStridedMetadataInterface.h.inc"
+
+#endif // MLIR_INTERFACES_INFERSTRIDEDMETADATAINTERFACE_H
\ No newline at end of file
diff --git a/mlir/include/mlir/Interfaces/InferStridedMetadataInterface.td b/mlir/include/mlir/Interfaces/InferStridedMetadataInterface.td
new file mode 100644
index 0000000000000..892b44d0aaa65
--- /dev/null
+++ b/mlir/include/mlir/Interfaces/InferStridedMetadataInterface.td
@@ -0,0 +1,43 @@
+//===- InferStridedMetadataInterface.td - Strided MD Inference ----------*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Defines the interface for strided metadata range analysis
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef MLIR_INTERFACES_INFERSTRIDEDMETADATAINTERFACE
+#define MLIR_INTERFACES_INFERSTRIDEDMETADATAINTERFACE
+
+include "mlir/IR/OpBase.td"
+
+def InferStridedMetadataOpInterface :
+    OpInterface<"InferStridedMetadataOpInterface"> {
+  let description = [{
+    Allows operations to participate in strided metadata analysis by providing
+    methods that allow them to specify bounds on offsets, sizes, and strides
+    of their result(s) given bounds on their input(s) if known.
+  }];
+  let cppNamespace = "::mlir";
+
+  let methods = [
+    InterfaceMethod<[{
+      Infer the strided metadata bounds on the results of this op given
+      the bounds on its operands.
+      For each result value or block argument, the method should call
+      `setMetadata` with that `Value` as an argument.
+      The `getIntRange` callback is provided for obtaining the int-range
+      analysis result for a given value.
+    }],
+    "void", "inferStridedMetadataRanges",
+    (ins "::llvm::ArrayRef<::mlir::StridedMetadataRange>":$operands,
+         "::mlir::GetIntRangeFn":$getIntRange,
+         "::mlir::SetStridedMetadataRangeFn":$setMetadata,
+         "int32_t":$indexBitwidth)>
+  ];
+}
+#endif // MLIR_INTERFACES_INFERSTRIDEDMETADATAINTERFACE
\ No newline at end of file
diff --git a/mlir/lib/Analysis/CMakeLists.txt b/mlir/lib/Analysis/CMakeLists.txt
index 609cb34309829..bef189600d8e7 100644
--- a/mlir/lib/Analysis/CMakeLists.txt
+++ b/mlir/lib/Analysis/CMakeLists.txt
@@ -40,6 +40,7 @@ add_mlir_library(MLIRAnalysis
   DataFlow/IntegerRangeAnalysis.cpp
   DataFlow/LivenessAnalysis.cpp
   DataFlow/SparseAnalysis.cpp
+  DataFlow/StridedMetadataRangeAnalysis.cpp
 
   ADDITIONAL_HEADER_DIRS
   ${MLIR_MAIN_INCLUDE_DIR}/mlir/Analysis
diff --git a/mlir/lib/Analysis/DataFlow/StridedMetadataRangeAnalysis.cpp b/mlir/lib/Analysis/DataFlow/StridedMetadataRangeAnalysis.cpp
new file mode 100644
index 0000000000000..01c9dafaddf10
--- /dev/null
+++ b/mlir/lib/Analysis/DataFlow/StridedMetadataRangeAnalysis.cpp
@@ -0,0 +1,127 @@
+//===- StridedMetadataRangeAnalysis.cpp - Integer range analysis --------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the dataflow analysis class for integer range inference
+// which is used in transformations over the `arith` dialect such as
+// branch elimination or signed->unsigned rewriting
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Analysis/DataFlow/StridedMetadataRangeAnalysis.h"
+#include "mlir/Analysis/DataFlow/IntegerRangeAnalysis.h"
+#include "mlir/Dialect/Utils/IndexingUtils.h"
+#include "mlir/IR/Operation.h"
+#include "mlir/IR/Value.h"
+#include "mlir/Support/DebugStringHelper.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/DebugLog.h"
+
+#define DEBUG_TYPE "strided-metadata-range-analysis"
+
+using namespace mlir;
+using namespace mlir::dataflow;
+
+/// Get the entry state for a value. For any value that is not a ranked memref,
+/// this function sets the metadata to a top state with no offsets, sizes, or
+/// strides. For `memref` types, this function will use the metadata in the type
+/// to try to deduce as much informaiton as possible.
+static StridedMetadataRange getEntryStateImpl(Value v, int32_t indexBitwidth) {
+  // TODO: generalize this method with a type interface.
+  auto mTy = dyn_cast<BaseMemRefType>(v.getType());
+
+  // If not a memref or it's un-ranked, don't infer any metadata.
+  if (!mTy || !mTy.hasRank())
+    return StridedMetadataRange::getMaxRanges(indexBitwidth, 0, 0, 0);
+
+  // Get the top state.
+  auto metadata =
+      StridedMetadataRange::getMaxRanges(indexBitwidth, mTy.getRank());
+
+  // Compute the offset and strides.
+  int64_t offset;
+  SmallVector<int64_t> strides;
+  if (failed(cast<MemRefType>(mTy).getStridesAndOffset(strides, offset)))
+    return metadata;
+
+  // Refine the metadata if we know it from the type.
+  if (!ShapedType::isDynamic(offset)) {
+    metadata.getOffsets()[0] =
+        ConstantIntRanges::constant(APInt(indexBitwidth, offset));
+  }
+  for (auto &&[size, range] :
+       llvm::zip_equal(mTy.getShape(), metadata.getSizes())) {
+    if (ShapedType::isDynamic(size))
+      continue;
+    range = ConstantIntRanges::constant(APInt(indexBitwidth, size));
+  }
+  for (auto &&[stride, range] :
+       llvm::zip_equal(strides, metadata.getStrides())) {
+    if (ShapedType::isDynamic(stride))
+      continue;
+    range = ConstantIntRanges::constant(APInt(indexBitwidth, stride));
+  }
+
+  return metadata;
+}
+
+StridedMetadataRangeAnalysis::StridedMetadataRangeAnalysis(
+    DataFlowSolver &solver, int32_t indexBitwidth)
+    : SparseForwardDataFlowAnalysis(solver), indexBitwidth(indexBitwidth) {
+  assert(indexBitwidth > 0 && "invalid bitwidth");
+}
+
+void StridedMetadataRangeAnalysis::setToEntryState(
+    StridedMetadataRangeLattice *lattice) {
+  propagateIfChanged(lattice, lattice->join(getEntryStateImpl(
+                                  lattice->getAnchor(), indexBitwidth)));
+}
+
+LogicalResult StridedMetadataRangeAnalysis::visitOperation(
+    Operation *op, ArrayRef<const StridedMetadataRangeLattice *> operands,
+    ArrayRef<StridedMetadataRangeLattice *> results) {
+  auto inferrable = dyn_cast<InferStridedMetadataOpInterface>(op);
+
+  // Bail if we cannot reason about the op.
+  if (!inferrable) {
+    setAllToEntryStates(results);
+    return success();
+  }
+
+  LDBG() << "Inferring metadata for: "
+         << OpWithFlags(op, OpPrintingFlags().skipRegions());
+
+  // Helper function to retrieve int range values.
+  auto getIntRange = [&](Value value) -> IntegerValueRange {
+    auto lattice = getOrCreateFor<IntegerValueRangeLattice>(
+        getProgramPointAfter(op), value);
+    return lattice ? lattice->getValue() : IntegerValueRange();
+  };
+
+  // Convert the arguments lattices to a vector.
+  SmallVector<StridedMetadataRange> argRanges = llvm::map_to_vector(
+      operands, [](const StridedMetadataRangeLattice *lattice) {
+        return lattice->getValue();
+      });
+
+  // Callback to set metadata on a result.
+  auto joinCallback = [&](Value v, const StridedMetadataRange &md) {
+    auto result = cast<OpResult>(v);
+    assert(llvm::is_contained(op->getResults(), result));
+    LDBG() << "- Inferred metadata: " << md;
+    StridedMetadataRangeLattice *lattice = results[result.getResultNumber()];
+    ChangeResult changed = lattice->join(md);
+    LDBG() << "- Joined metadata: " << lattice->getValue();
+    propagateIfChanged(lattice, changed);
+  };
+
+  // Infer the metadata.
+  inferrable.inferStridedMetadataRanges(argRanges, getIntRange, joinCallback,
+                                        indexBitwidth);
+  return success();
+}
diff --git a/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt b/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
index e25a0121a3359..9707dc0cc64e9 100644
--- a/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
+++ b/mlir/lib/Dialect/MemRef/IR/CMakeLists.txt
@@ -2,10 +2,11 @@ add_mlir_dialect_library(MLIRMemRefDialect
   MemRefDialect.cpp
   MemRefMemorySlot.cpp
   MemRefOps.cpp
+  InferStridedMetadataInterfaceImpl.cpp
   ValueBoundsOpInterfaceImpl.cpp
 
   ADDITIONAL_HEADER_DIRS
-  ${PROJECT_SOURCE_DIR}/inlude/mlir/Dialect/MemRefDialect
+  ${PROJECT_SOURCE_DIR}/inlude/mlir/Dialect/MemRef/IR
 
   DEPENDS
   MLIRMemRefOpsIncGen
@@ -18,6 +19,7 @@ add_mlir_dialect_library(MLIRMemRefDialect
   MLIRDialectUtils
   MLIRInferIntRangeCommon
   MLIRInferIntRangeInterface
+  MLIRInferStridedMetadataInterface
   MLIRInferTypeOpInterface
   MLIRIR
   MLIRMemOpInterfaces
diff --git a/mlir/lib/Dialect/MemRef/IR/InferStridedMetadataInterfaceImpl.cpp b/mlir/lib/Dialect/MemRef/IR/InferStridedMetadataInterfaceImpl.cpp
new file mode 100644
index 0000000000000..4bc4edc0357e8
--- /dev/null
+++ b/mlir/lib/Dialect/MemRef/IR/InferStridedMetadataIn...
[truncated]

@fabianmcg fabianmcg force-pushed the users/fabianmcg/strided-metadata branch from a3dfb47 to 37ec2ca Compare September 29, 2025 21:28
@fabianmcg fabianmcg requested a review from Copilot September 29, 2025 21:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new dataflow analysis for tracking strided metadata (offset, size, stride) ranges in MLIR operations. The analysis uses the integer range analysis to infer bounds on memref metadata parameters. Currently implements the interface only for memref.subview operations as a starting point, with future work planned for additional operations.

Key changes:

  • New InferStridedMetadataOpInterface interface for operations to participate in strided metadata analysis
  • StridedMetadataRangeAnalysis dataflow analysis that tracks offset, size, and stride ranges
  • Implementation of the interface for memref.subview operation in the MemRef dialect

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
mlir/include/mlir/Interfaces/InferStridedMetadataInterface.td Interface definition for strided metadata inference
mlir/include/mlir/Interfaces/InferStridedMetadataInterface.h Header with StridedMetadataRange class and interface declarations
mlir/lib/Interfaces/InferStridedMetadataInterface.cpp Implementation of StridedMetadataRange print method
mlir/include/mlir/Analysis/DataFlow/StridedMetadataRangeAnalysis.h Header for the dataflow analysis class
mlir/lib/Analysis/DataFlow/StridedMetadataRangeAnalysis.cpp Main analysis implementation
mlir/lib/Dialect/MemRef/IR/InferStridedMetadataInterfaceImpl.cpp Implementation of interface for memref.subview operation
mlir/test/lib/Analysis/DataFlow/TestStridedMetadataRangeAnalysis.cpp Test pass for the analysis
mlir/test/Analysis/DataFlow/test-strided-metadata-range-analysis.mlir Test cases demonstrating the analysis
Comments suppressed due to low confidence (1)

mlir/include/mlir/Interfaces/InferStridedMetadataInterface.h:1

  • There's a typo in the word 'informaiton' which should be 'information'.
//===- InferStridedMetadataInterface.h - Strided Metadata Inference -C++-*-===//

Copy link
Contributor

@nicolasvasilache nicolasvasilache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! I haven't checked the actual numbers in the test but this looks good to me!

@fabianmcg fabianmcg force-pushed the users/fabianmcg/strided-metadata branch from d5443d9 to 6957fc5 Compare October 9, 2025 11:29
Copy link
Contributor

@krzysz00 krzysz00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are ExpandShape and CollapseShape in a followup PR?

Overall, this looks fine to me

@fabianmcg
Copy link
Contributor Author

Are ExpandShape and CollapseShape in a followup PR?

Yes, see the comment in the PR description where I mention only subview was implemented to keep the patch small.

@fabianmcg fabianmcg requested a review from krzysz00 October 9, 2025 15:59
@krzysz00
Copy link
Contributor

krzysz00 commented Oct 9, 2025

LGTM aside from maybe we can rely on non-negativity

We can also probably make all those muls and adds be nsw by definition of memref.

@fabianmcg
Copy link
Contributor Author

Ping for review

@fabianmcg fabianmcg merged commit aa84998 into llvm:main Oct 14, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 14, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-ubuntu-22-cmake-build-only running on rocm-docker-ubu-22 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/26161

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[4192/8131] Creating library symlink lib/libMLIRCallInterfaces.so
[4193/8131] Creating library symlink lib/libMLIRMaskingOpInterface.so
[4194/8131] Linking CXX shared library lib/libMLIRDerivedAttributeOpInterface.so.22.0git
[4195/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCUDA.cpp.o
[4196/8131] Creating library symlink lib/libMLIRDerivedAttributeOpInterface.so
[4197/8131] Building AMDGPUGenDisassemblerTables.inc...
[4198/8131] Linking CXX shared library lib/libMLIRDataLayoutInterfaces.so.22.0git
[4199/8131] Linking CXX shared library lib/libMLIRDestinationStyleOpInterface.so.22.0git
[4200/8131] Linking CXX shared library lib/libMLIRIndexingMapOpInterface.so.22.0git
[4201/8131] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o: in function `mlir::StridedMetadataRange::print(llvm::raw_ostream&) const':
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0xba): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x132): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x1be): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x229): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x392): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x409): more undefined references to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)' follow
collect2: error: ld returned 1 exit status
[4202/8131] Creating library symlink lib/libMLIRDataLayoutInterfaces.so
[4203/8131] Creating library symlink lib/libMLIRDestinationStyleOpInterface.so
[4204/8131] Creating library symlink lib/libMLIRIndexingMapOpInterface.so
[4205/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDecl.cpp.o
[4206/8131] Linking CXX shared library lib/libMLIRInferIntRangeInterface.so.22.0git
[4207/8131] Linking CXX shared library lib/libMLIRMemorySlotInterfaces.so.22.0git
[4208/8131] Linking CXX shared library lib/libMLIRInferTypeOpInterface.so.22.0git
[4209/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o
[4210/8131] Linking CXX shared library lib/libMLIRFunctionInterfaces.so.22.0git
[4211/8131] Linking CXX shared library lib/libMLIRMemOpInterfaces.so.22.0git
[4212/8131] Linking CXX shared library lib/libMLIRParallelCombiningOpInterface.so.22.0git
[4213/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaConcept.cpp.o
[4214/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclCXX.cpp.o
[4215/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExceptionSpec.cpp.o
[4216/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprMember.cpp.o
[4217/8131] Building AMDGPUGenRegBankGICombiner.inc...
[4218/8131] Building AMDGPUGenPostLegalizeGICombiner.inc...
[4219/8131] Linking CXX shared library lib/libLLVMAnalysis.so.22.0git
[4220/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprCXX.cpp.o
[4221/8131] Building AMDGPUGenMCCodeEmitter.inc...
[4222/8131] Building AMDGPUGenSubtargetInfo.inc...
[4223/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o
[4224/8131] Building AMDGPUGenSearchableTables.inc...
[4225/8131] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[4226/8131] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[4227/8131] Building AMDGPUGenCallingConv.inc...
[4228/8131] Building AMDGPUGenAsmWriter.inc...
[4229/8131] Building AMDGPUGenDAGISel.inc...
[4230/8131] Building AMDGPUGenGlobalISel.inc...
Step 7 (build cmake config) failure: build cmake config (failure)
...
[4192/8131] Creating library symlink lib/libMLIRCallInterfaces.so
[4193/8131] Creating library symlink lib/libMLIRMaskingOpInterface.so
[4194/8131] Linking CXX shared library lib/libMLIRDerivedAttributeOpInterface.so.22.0git
[4195/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaCUDA.cpp.o
[4196/8131] Creating library symlink lib/libMLIRDerivedAttributeOpInterface.so
[4197/8131] Building AMDGPUGenDisassemblerTables.inc...
[4198/8131] Linking CXX shared library lib/libMLIRDataLayoutInterfaces.so.22.0git
[4199/8131] Linking CXX shared library lib/libMLIRDestinationStyleOpInterface.so.22.0git
[4200/8131] Linking CXX shared library lib/libMLIRIndexingMapOpInterface.so.22.0git
[4201/8131] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o: in function `mlir::StridedMetadataRange::print(llvm::raw_ostream&) const':
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0xba): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x132): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x1be): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x229): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x392): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x409): more undefined references to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)' follow
collect2: error: ld returned 1 exit status
[4202/8131] Creating library symlink lib/libMLIRDataLayoutInterfaces.so
[4203/8131] Creating library symlink lib/libMLIRDestinationStyleOpInterface.so
[4204/8131] Creating library symlink lib/libMLIRIndexingMapOpInterface.so
[4205/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDecl.cpp.o
[4206/8131] Linking CXX shared library lib/libMLIRInferIntRangeInterface.so.22.0git
[4207/8131] Linking CXX shared library lib/libMLIRMemorySlotInterfaces.so.22.0git
[4208/8131] Linking CXX shared library lib/libMLIRInferTypeOpInterface.so.22.0git
[4209/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o
[4210/8131] Linking CXX shared library lib/libMLIRFunctionInterfaces.so.22.0git
[4211/8131] Linking CXX shared library lib/libMLIRMemOpInterfaces.so.22.0git
[4212/8131] Linking CXX shared library lib/libMLIRParallelCombiningOpInterface.so.22.0git
[4213/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaConcept.cpp.o
[4214/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclCXX.cpp.o
[4215/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExceptionSpec.cpp.o
[4216/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprMember.cpp.o
[4217/8131] Building AMDGPUGenRegBankGICombiner.inc...
[4218/8131] Building AMDGPUGenPostLegalizeGICombiner.inc...
[4219/8131] Linking CXX shared library lib/libLLVMAnalysis.so.22.0git
[4220/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprCXX.cpp.o
[4221/8131] Building AMDGPUGenMCCodeEmitter.inc...
[4222/8131] Building AMDGPUGenSubtargetInfo.inc...
[4223/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o
[4224/8131] Building AMDGPUGenSearchableTables.inc...
[4225/8131] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[4226/8131] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[4227/8131] Building AMDGPUGenCallingConv.inc...
[4228/8131] Building AMDGPUGenAsmWriter.inc...
[4229/8131] Building AMDGPUGenDAGISel.inc...
[4230/8131] Building AMDGPUGenGlobalISel.inc...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 14, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-9-cmake-build-only running on rocm-docker-rhel-9 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/24950

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[4234/8131] Linking CXX shared library lib/libMLIRShapedOpInterfaces.so.22.0git
[4235/8131] Creating library symlink lib/libMLIRDestinationStyleOpInterface.so
[4236/8131] Creating library symlink lib/libMLIRIndexingMapOpInterface.so
[4237/8131] Creating library symlink lib/libMLIRInferIntRangeInterface.so
[4238/8131] Creating library symlink lib/libMLIRInferTypeOpInterface.so
[4239/8131] Creating library symlink lib/libMLIRMemOpInterfaces.so
[4240/8131] Creating library symlink lib/libMLIRMemorySlotInterfaces.so
[4241/8131] Creating library symlink lib/libMLIRParallelCombiningOpInterface.so
[4242/8131] Creating library symlink lib/libMLIRRuntimeVerifiableOpInterface.so
[4243/8131] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o: in function `mlir::StridedMetadataRange::print(llvm::raw_ostream&) const':
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0xb2): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x132): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x1be): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x229): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x392): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x409): more undefined references to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)' follow
collect2: error: ld returned 1 exit status
[4244/8131] Creating library symlink lib/libMLIRShapedOpInterfaces.so
[4245/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprObjC.cpp.o
[4246/8131] Linking CXX shared library lib/libLLVMAggressiveInstCombine.so.22.0git
[4247/8131] Linking CXX shared library lib/libLLVMHipStdPar.so.22.0git
[4248/8131] Linking CXX shared library lib/libLLVMLinker.so.22.0git
[4249/8131] Linking CXX shared library lib/libLLVMSPIRVAnalysis.so.22.0git
[4250/8131] Linking CXX shared library lib/libLLVMObjCARCOpts.so.22.0git
[4251/8131] Linking CXX shared library lib/libLLVMFrontendOffloading.so.22.0git
[4252/8131] Linking CXX shared library lib/libLLVMMCJIT.so.22.0git
[4253/8131] Linking CXX shared library lib/libMLIRFunctionInterfaces.so.22.0git
[4254/8131] Linking CXX shared library lib/libMLIRVectorInterfaces.so.22.0git
[4255/8131] Linking CXX shared library lib/libMLIRSideEffectInterfaces.so.22.0git
[4256/8131] Linking CXX shared library lib/libMLIRCAPIInterfaces.so.22.0git
[4257/8131] Linking CXX shared library lib/libMLIRViewLikeInterface.so.22.0git
[4258/8131] Linking CXX shared library lib/libMLIRParser.so.22.0git
[4259/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprCXX.cpp.o
[4260/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaConcept.cpp.o
[4261/8131] Linking CXX shared library lib/libLLVMInstCombine.so.22.0git
[4262/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o
[4263/8131] Linking CXX shared library lib/libLLVMInstrumentation.so.22.0git
[4264/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaFixItUtils.cpp.o
[4265/8131] Linking CXX shared library lib/libLLVMVectorize.so.22.0git
[4266/8131] Building AMDGPUGenSearchableTables.inc...
[4267/8131] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[4268/8131] Building AMDGPUGenCallingConv.inc...
[4269/8131] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[4270/8131] Building AMDGPUGenAsmWriter.inc...
[4271/8131] Building AMDGPUGenDAGISel.inc...
[4272/8131] Building AMDGPUGenInstrInfo.inc...
Step 7 (build cmake config) failure: build cmake config (failure)
...
[4234/8131] Linking CXX shared library lib/libMLIRShapedOpInterfaces.so.22.0git
[4235/8131] Creating library symlink lib/libMLIRDestinationStyleOpInterface.so
[4236/8131] Creating library symlink lib/libMLIRIndexingMapOpInterface.so
[4237/8131] Creating library symlink lib/libMLIRInferIntRangeInterface.so
[4238/8131] Creating library symlink lib/libMLIRInferTypeOpInterface.so
[4239/8131] Creating library symlink lib/libMLIRMemOpInterfaces.so
[4240/8131] Creating library symlink lib/libMLIRMemorySlotInterfaces.so
[4241/8131] Creating library symlink lib/libMLIRParallelCombiningOpInterface.so
[4242/8131] Creating library symlink lib/libMLIRRuntimeVerifiableOpInterface.so
[4243/8131] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o: in function `mlir::StridedMetadataRange::print(llvm::raw_ostream&) const':
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0xb2): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x132): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x1be): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x229): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x392): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x409): more undefined references to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)' follow
collect2: error: ld returned 1 exit status
[4244/8131] Creating library symlink lib/libMLIRShapedOpInterfaces.so
[4245/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprObjC.cpp.o
[4246/8131] Linking CXX shared library lib/libLLVMAggressiveInstCombine.so.22.0git
[4247/8131] Linking CXX shared library lib/libLLVMHipStdPar.so.22.0git
[4248/8131] Linking CXX shared library lib/libLLVMLinker.so.22.0git
[4249/8131] Linking CXX shared library lib/libLLVMSPIRVAnalysis.so.22.0git
[4250/8131] Linking CXX shared library lib/libLLVMObjCARCOpts.so.22.0git
[4251/8131] Linking CXX shared library lib/libLLVMFrontendOffloading.so.22.0git
[4252/8131] Linking CXX shared library lib/libLLVMMCJIT.so.22.0git
[4253/8131] Linking CXX shared library lib/libMLIRFunctionInterfaces.so.22.0git
[4254/8131] Linking CXX shared library lib/libMLIRVectorInterfaces.so.22.0git
[4255/8131] Linking CXX shared library lib/libMLIRSideEffectInterfaces.so.22.0git
[4256/8131] Linking CXX shared library lib/libMLIRCAPIInterfaces.so.22.0git
[4257/8131] Linking CXX shared library lib/libMLIRViewLikeInterface.so.22.0git
[4258/8131] Linking CXX shared library lib/libMLIRParser.so.22.0git
[4259/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExprCXX.cpp.o
[4260/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaConcept.cpp.o
[4261/8131] Linking CXX shared library lib/libLLVMInstCombine.so.22.0git
[4262/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaExpr.cpp.o
[4263/8131] Linking CXX shared library lib/libLLVMInstrumentation.so.22.0git
[4264/8131] Building CXX object tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaFixItUtils.cpp.o
[4265/8131] Linking CXX shared library lib/libLLVMVectorize.so.22.0git
[4266/8131] Building AMDGPUGenSearchableTables.inc...
[4267/8131] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[4268/8131] Building AMDGPUGenCallingConv.inc...
[4269/8131] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[4270/8131] Building AMDGPUGenAsmWriter.inc...
[4271/8131] Building AMDGPUGenDAGISel.inc...
[4272/8131] Building AMDGPUGenInstrInfo.inc...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 14, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-8-cmake-build-only running on rocm-docker-rhel-8 while building mlir at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/24973

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
     assert(!Success || !Trap.hasErrorOccurred() &&
                        ~~~~~~~~~~~~~~~~~~~~~~~~~^~
                            "Substitution failures must be handled "
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            "by CheckConstraintSatisfaction.");
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[4290/8131] Linking CXX shared library lib/libMLIRDebug.so.22.0git
[4291/8131] Linking CXX shared library lib/libMLIRInferIntRangeInterface.so.22.0git
[4292/8131] Creating library symlink lib/libMLIRCallInterfaces.so
[4293/8131] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-array-bounds -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -lpthread  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o: In function `mlir::StridedMetadataRange::print(llvm::raw_ostream&) const':
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x98): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0xfb): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x1fd): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x25b): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x363): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x3cb): more undefined references to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)' follow
collect2: error: ld returned 1 exit status
[4294/8131] Linking CXX shared library lib/libMLIRInferTypeOpInterface.so.22.0git
[4295/8131] Creating library symlink lib/libMLIRBytecodeWriter.so
[4296/8131] Linking CXX shared library lib/libMLIRMemOpInterfaces.so.22.0git
[4297/8131] Creating library symlink lib/libMLIRDebug.so
[4298/8131] Linking CXX shared library lib/libMLIRMemorySlotInterfaces.so.22.0git
[4299/8131] Creating library symlink lib/libMLIRInferIntRangeInterface.so
[4300/8131] Linking CXX shared library lib/libMLIRBytecodeReader.so.22.0git
[4301/8131] Linking CXX shared library lib/libMLIRParallelCombiningOpInterface.so.22.0git
[4302/8131] Linking CXX shared library lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git
[4303/8131] Linking CXX shared library lib/libMLIRShapedOpInterfaces.so.22.0git
[4304/8131] Linking CXX shared library lib/libMLIRVectorInterfaces.so.22.0git
[4305/8131] Linking CXX shared library lib/libMLIRSideEffectInterfaces.so.22.0git
[4306/8131] Linking CXX shared library lib/libMLIRFunctionInterfaces.so.22.0git
[4307/8131] Linking CXX shared library lib/libLLVMFuzzMutate.so.22.0git
[4308/8131] Linking CXX shared library lib/libLLVMFrontendOpenMP.so.22.0git
[4309/8131] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/LinkInModulesPass.cpp.o
[4310/8131] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/MacroPPCallbacks.cpp.o
[4311/8131] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CoverageMappingGen.cpp.o
In file included from /usr/include/c++/8/cassert:44,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:40,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/DataAccessProf.h:25,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProfReader.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/lib/CodeGen/CodeGenPGO.h:20,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/lib/CodeGen/CoverageMappingGen.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘llvm::ArrayRef<llvm::InstrProfValueSiteRecord> llvm::InstrProfRecord::getValueSitesForKind(uint32_t) const’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:1028:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘std::vector<llvm::InstrProfValueSiteRecord>& llvm::InstrProfRecord::getOrCreateValueSitesForKind(uint32_t)’:
Step 7 (build cmake config) failure: build cmake config (failure)
...
     assert(!Success || !Trap.hasErrorOccurred() &&
                        ~~~~~~~~~~~~~~~~~~~~~~~~~^~
                            "Substitution failures must be handled "
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            "by CheckConstraintSatisfaction.");
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[4290/8131] Linking CXX shared library lib/libMLIRDebug.so.22.0git
[4291/8131] Linking CXX shared library lib/libMLIRInferIntRangeInterface.so.22.0git
[4292/8131] Creating library symlink lib/libMLIRCallInterfaces.so
[4293/8131] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-array-bounds -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -lpthread  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o: In function `mlir::StridedMetadataRange::print(llvm::raw_ostream&) const':
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x98): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0xfb): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x1fd): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x25b): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x363): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x3cb): more undefined references to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)' follow
collect2: error: ld returned 1 exit status
[4294/8131] Linking CXX shared library lib/libMLIRInferTypeOpInterface.so.22.0git
[4295/8131] Creating library symlink lib/libMLIRBytecodeWriter.so
[4296/8131] Linking CXX shared library lib/libMLIRMemOpInterfaces.so.22.0git
[4297/8131] Creating library symlink lib/libMLIRDebug.so
[4298/8131] Linking CXX shared library lib/libMLIRMemorySlotInterfaces.so.22.0git
[4299/8131] Creating library symlink lib/libMLIRInferIntRangeInterface.so
[4300/8131] Linking CXX shared library lib/libMLIRBytecodeReader.so.22.0git
[4301/8131] Linking CXX shared library lib/libMLIRParallelCombiningOpInterface.so.22.0git
[4302/8131] Linking CXX shared library lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git
[4303/8131] Linking CXX shared library lib/libMLIRShapedOpInterfaces.so.22.0git
[4304/8131] Linking CXX shared library lib/libMLIRVectorInterfaces.so.22.0git
[4305/8131] Linking CXX shared library lib/libMLIRSideEffectInterfaces.so.22.0git
[4306/8131] Linking CXX shared library lib/libMLIRFunctionInterfaces.so.22.0git
[4307/8131] Linking CXX shared library lib/libLLVMFuzzMutate.so.22.0git
[4308/8131] Linking CXX shared library lib/libLLVMFrontendOpenMP.so.22.0git
[4309/8131] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/LinkInModulesPass.cpp.o
[4310/8131] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/MacroPPCallbacks.cpp.o
[4311/8131] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CoverageMappingGen.cpp.o
In file included from /usr/include/c++/8/cassert:44,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:40,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/DataAccessProf.h:25,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProfReader.h:21,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/lib/CodeGen/CodeGenPGO.h:20,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/clang/lib/CodeGen/CoverageMappingGen.cpp:15:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘llvm::ArrayRef<llvm::InstrProfValueSiteRecord> llvm::InstrProfRecord::getValueSitesForKind(uint32_t) const’:
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:1028:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘std::vector<llvm::InstrProfValueSiteRecord>& llvm::InstrProfRecord::getOrCreateValueSitesForKind(uint32_t)’:

fabianmcg added a commit that referenced this pull request Oct 14, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 14, 2025

LLVM Buildbot has detected a new failure on builder mlir-nvidia running on mlir-nvidia while building mlir at step 6 "build-check-mlir-build-only".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/138/builds/20411

Here is the relevant piece of the build log for the reference
Step 6 (build-check-mlir-build-only) failure: build (failure)
...
27.519 [2000/16/3468] Linking CXX shared library lib/libMLIRControlFlowInterfaces.so.22.0git
27.520 [1999/16/3469] Linking CXX shared library lib/libMLIRAsmParser.so.22.0git
27.528 [1998/16/3470] Creating library symlink lib/libMLIRControlFlowInterfaces.so
27.530 [1997/16/3471] Creating library symlink lib/libMLIRAsmParser.so
27.614 [1996/16/3472] Linking CXX shared library lib/libMLIRInferIntRangeInterface.so.22.0git
27.617 [1995/16/3473] Linking CXX shared library lib/libMLIRInferTypeOpInterface.so.22.0git
27.618 [1994/16/3474] Linking CXX shared library lib/libMLIRParallelCombiningOpInterface.so.22.0git
27.619 [1993/16/3475] Linking CXX shared library lib/libMLIRMemorySlotInterfaces.so.22.0git
27.621 [1992/16/3476] Linking CXX shared library lib/libMLIRFunctionInterfaces.so.22.0git
27.622 [1991/16/3477] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/bin/clang++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Werror=mismatched-tags -Werror=global-constructors -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=lld -Wl,--color-diagnostics   -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/lib && :
ld.lld: error: undefined symbol: mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)
>>> referenced by InferStridedMetadataInterface.cpp
>>>               tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:(mlir::StridedMetadataRange::print(llvm::raw_ostream&) const)
>>> referenced by InferStridedMetadataInterface.cpp
>>>               tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:(mlir::StridedMetadataRange::print(llvm::raw_ostream&) const)
>>> referenced by InferStridedMetadataInterface.cpp
>>>               tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:(mlir::StridedMetadataRange::print(llvm::raw_ostream&) const)
>>> referenced 3 more times
clang: error: linker command failed with exit code 1 (use -v to see invocation)
27.622 [1991/15/3478] Linking CXX shared library lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git
27.626 [1991/14/3479] Creating library symlink lib/libMLIRInferIntRangeInterface.so
27.627 [1991/13/3480] Creating library symlink lib/libMLIRParallelCombiningOpInterface.so
27.628 [1991/12/3481] Linking CXX shared library lib/libMLIRMemOpInterfaces.so.22.0git
27.630 [1991/11/3482] Creating library symlink lib/libMLIRMemorySlotInterfaces.so
27.632 [1991/10/3483] Creating library symlink lib/libMLIRFunctionInterfaces.so
27.633 [1991/9/3484] Linking CXX shared library lib/libMLIRDebug.so.22.0git
27.633 [1991/8/3485] Linking CXX shared library lib/libMLIRSideEffectInterfaces.so.22.0git
27.634 [1991/7/3486] Creating library symlink lib/libMLIRInferTypeOpInterface.so
27.634 [1991/6/3487] Linking CXX shared library lib/libMLIRVectorInterfaces.so.22.0git
27.636 [1991/5/3488] Linking CXX shared library lib/libMLIRBytecodeWriter.so.22.0git
27.637 [1991/4/3489] Linking CXX shared library lib/libMLIRShapedOpInterfaces.so.22.0git
27.645 [1991/3/3490] Linking CXX shared library lib/libMLIRViewLikeInterface.so.22.0git
27.646 [1991/2/3491] Linking CXX shared library lib/libMLIRBytecodeReader.so.22.0git
32.840 [1991/1/3492] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
ninja: build stopped: subcommand failed.

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Oct 14, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 14, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-sharedlibs running on linaro-flang-aarch64-sharedlibs while building mlir at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/80/builds/16716

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
34.290 [2876/116/4939] Building Opts.inc...
34.290 [2876/115/4940] Building SYCLLinkOpts.inc...
34.290 [2876/114/4941] Building InstallAPIOpts.inc...
34.291 [2876/113/4942] Building C object tools/clang/tools/c-index-test/CMakeFiles/c-index-test.dir/c-index-test.c.o
34.292 [2876/112/4943] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/STLAlgorithmModeling.cpp.o
34.294 [2876/111/4944] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/TrustReturnsNonnullChecker.cpp.o
34.295 [2876/110/4945] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/UninitializedObject/UninitializedObjectChecker.cpp.o
34.297 [2876/109/4946] Building CXX object tools/clang/lib/StaticAnalyzer/Checkers/CMakeFiles/obj.clangStaticAnalyzerCheckers.dir/VirtualCallChecker.cpp.o
34.298 [2876/108/4947] Building CXX object tools/clang/lib/StaticAnalyzer/Frontend/CMakeFiles/obj.clangStaticAnalyzerFrontend.dir/AnalysisConsumer.cpp.o
34.299 [2876/107/4948] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/local/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Werror=mismatched-tags -Werror=global-constructors -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-sharedlibs/build/lib && :
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o: in function `mlir::StridedMetadataRange::print(llvm::raw_ostream&) const':
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0xd0): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x13c): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x1f8): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x238): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x2ec): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x334): more undefined references to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)' follow
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
34.299 [2876/106/4949] Linking CXX shared library lib/libMLIRMemorySlotInterfaces.so.22.0git
34.299 [2876/105/4950] Linking CXX shared library lib/libMLIRViewLikeInterface.so.22.0git
34.299 [2876/104/4951] Linking CXX shared library lib/libmlir_c_runner_utils.so.22.0git
34.300 [2876/103/4952] Building CXX object tools/clang/tools/clang-refactor/CMakeFiles/clang-refactor.dir/TestSupport.cpp.o
34.301 [2876/102/4953] Building CXX object tools/clang/tools/clang-shlib/CMakeFiles/clang-cpp.dir/clang-shlib.cpp.o
34.302 [2876/101/4954] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/BuildSystem.cpp.o
34.302 [2876/100/4955] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CIndexCXX.cpp.o
34.303 [2876/99/4956] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXCompilationDatabase.cpp.o
34.303 [2876/98/4957] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/CXLoadedDiagnostic.cpp.o
34.307 [2876/97/4958] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/FatalErrorHandler.cpp.o
34.308 [2876/96/4959] Building CXX object tools/clang/tools/libclang/CMakeFiles/libclang.dir/Obsolete.cpp.o
34.308 [2876/95/4960] Building CXX object tools/clang/tools/offload-arch/CMakeFiles/offload-arch.dir/OffloadArch.cpp.o
34.310 [2876/94/4961] Building CXX object tools/clang/tools/offload-arch/CMakeFiles/offload-arch.dir/NVPTXArch.cpp.o
34.311 [2876/93/4962] Building CXX object tools/clang/tools/offload-arch/CMakeFiles/offload-arch.dir/AMDGPUArchByKFD.cpp.o
34.312 [2876/92/4963] Building CXX object tools/clang/tools/offload-arch/CMakeFiles/offload-arch.dir/AMDGPUArchByHIP.cpp.o
34.312 [2876/91/4964] Building CXX object tools/clang/tools/offload-arch/CMakeFiles/offload-arch.dir/LevelZeroArch.cpp.o
34.312 [2876/90/4965] Building FirAliasTagOpInterface.cpp.inc...
34.312 [2876/89/4966] Building FirAliasTagOpInterface.h.inc...
34.313 [2876/88/4967] Building FortranVariableInterface.cpp.inc...
34.313 [2876/87/4968] Building FortranVariableInterface.h.inc...
34.313 [2876/86/4969] Building SafeTempArrayCopyAttrInterface.cpp.inc...
34.313 [2876/85/4970] Building SafeTempArrayCopyAttrInterface.h.inc...
34.313 [2876/84/4971] Creating library symlink lib/libMLIRSPIRVImageInterfaces.so
34.314 [2876/83/4972] Creating library symlink lib/libMLIRMaskableOpInterface.so
34.314 [2876/82/4973] Creating library symlink lib/libMLIRMaskingOpInterface.so
34.314 [2876/81/4974] Creating library symlink lib/libMLIRCallInterfaces.so
34.315 [2876/80/4975] Creating library symlink lib/libMLIRCastInterfaces.so
34.316 [2876/79/4976] Building CXX object tools/bugpoint/CMakeFiles/bugpoint.dir/CrashDebugger.cpp.o
34.316 [2876/78/4977] Creating library symlink lib/libMLIRControlFlowInterfaces.so

@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 14, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-latest-gcc running on linaro-flang-aarch64-latest-gcc while building mlir at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/15708

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
614.847 [4447/18/3269] Linking CXX shared library lib/libMLIRMemorySlotInterfaces.so.22.0git
614.853 [4446/18/3270] Creating library symlink lib/libMLIRCastInterfaces.so
614.856 [4445/18/3271] Creating library symlink lib/libMLIRControlFlowInterfaces.so
614.865 [4444/18/3272] Creating library symlink lib/libMLIRDialect.so
614.867 [4443/18/3273] Creating library symlink lib/libMLIRObservers.so
614.879 [4443/17/3274] Creating library symlink lib/libMLIRDerivedAttributeOpInterface.so
614.887 [4443/16/3275] Creating library symlink lib/libMLIRDataLayoutInterfaces.so
614.906 [4443/15/3276] Creating library symlink lib/libMLIRMemorySlotInterfaces.so
614.919 [4443/14/3277] Linking CXX shared library lib/libMLIRMemOpInterfaces.so.22.0git
614.923 [4443/13/3278] Linking CXX shared library lib/libMLIRInferStridedMetadataInterface.so.22.0git
FAILED: lib/libMLIRInferStridedMetadataInterface.so.22.0git 
: && /usr/local/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRInferStridedMetadataInterface.so.22.0git -o lib/libMLIRInferStridedMetadataInterface.so.22.0git tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/lib:"  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/tcwg-buildbot/worker/flang-aarch64-latest-gcc/build/lib && :
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o: in function `mlir::StridedMetadataRange::print(llvm::raw_ostream&) const':
InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0xa4): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x10c): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x180): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x224): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x28c): undefined reference to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)'
/usr/bin/ld: tools/mlir/lib/Interfaces/CMakeFiles/obj.MLIRInferStridedMetadataInterface.dir/InferStridedMetadataInterface.cpp.o:InferStridedMetadataInterface.cpp:(.text._ZNK4mlir20StridedMetadataRange5printERN4llvm11raw_ostreamE+0x300): more undefined references to `mlir::operator<<(llvm::raw_ostream&, mlir::ConstantIntRanges const&)' follow
collect2: error: ld returned 1 exit status
614.923 [4443/12/3279] Linking CXX shared library lib/libMLIRInferTypeOpInterface.so.22.0git
614.935 [4443/11/3280] Linking CXX shared library lib/libMLIRIndexingMapOpInterface.so.22.0git
614.943 [4443/10/3281] Linking CXX shared library lib/libMLIRDestinationStyleOpInterface.so.22.0git
614.948 [4443/9/3282] Linking CXX shared library lib/libMLIRInferIntRangeInterface.so.22.0git
614.968 [4443/8/3283] Linking CXX shared library lib/libMLIRBytecodeWriter.so.22.0git
614.989 [4443/7/3284] Linking CXX shared library lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git
615.008 [4443/6/3285] Linking CXX shared library lib/libMLIRVectorInterfaces.so.22.0git
615.068 [4443/5/3286] Linking CXX shared library lib/libMLIRParallelCombiningOpInterface.so.22.0git
615.069 [4443/4/3287] Linking CXX shared library lib/libMLIRFunctionInterfaces.so.22.0git
615.090 [4443/3/3288] Linking CXX shared library lib/libMLIRBytecodeReader.so.22.0git
615.090 [4443/2/3289] Linking CXX shared library lib/libMLIRShapedOpInterfaces.so.22.0git
615.091 [4443/1/3290] Linking CXX shared library lib/libMLIRSideEffectInterfaces.so.22.0git
ninja: build stopped: subcommand failed.

akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
Introduces a dataflow analysis for tracking offset, size, and stride
ranges of operations.
Inference of the metadata is accomplished through the implementation of
the interface
`InferStridedMetadataOpInterface`.

To keep the size of the patch small, this patch only implements the
interface for the
`memref.subview` operation. It's future work to add more operations.

Example:
```mlir
func.func @memref_subview(%arg0: memref<8x16x4xf32, strided<[64, 4, 1]>>) {
  %c0 = arith.constant 0 : index
  %c1 = arith.constant 1 : index
  %c2 = arith.constant 2 : index
  %0 = test.with_bounds {smax = 13 : index, smin = 11 : index, umax = 13 : index, umin = 11 : index} : index
  %1 = test.with_bounds {smax = 7 : index, smin = 5 : index, umax = 7 : index, umin = 5 : index} : index
  %subview = memref.subview %arg0[%c0, %c0, %c1] [%1, %0, %c2] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1]>> to memref<?x?x?xf32, strided<[?, ?, ?], offset: ?>>
  return
}
```

Applying `mlir-opt --test-strided-metadata-range-analysis` prints:
```
Op: %subview = memref.subview %arg0[%c0, %c0, %c1] [%1, %0, %c2] [%c1, %c1, %c1] : memref<8x16x4xf32, strided<[64, 4, 1]>> to memref<?x?x?xf32, strided<[?, ?, ?], offset: ?>>
  result[0]: strided_metadata<offset = [{unsigned : [1, 1] signed : [1, 1]}], sizes = [{unsigned : [5, 7] signed : [5, 7]}, {unsigned : [11, 13] signed : [11, 13]}, {unsigned : [2, 2] signed : [2, 2]}], strides = [{unsigned : [64, 64] signed : [64, 64]}, {unsigned : [4, 4] signed : [4, 4]}, {unsigned : [1, 1] signed : [1, 1]}]>
```

---------

Signed-off-by: Fabian Mora <[email protected]>
akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mlir:core MLIR Core Infrastructure mlir:memref mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants