Skip to content

Conversation

@makslevental
Copy link
Contributor

@makslevental makslevental commented Dec 17, 2025

This PR adds vector type support to math-to-apfloat. It also adds supported-types (matching the convention/semantics for the pass arg established by -arith-emulate-unsupported-floats) pass arguments to both arith-to-apfloat and math-to-apfloat to filter down which types will be converted. Note, by default (i.e., empty supported-types) all fp types will be converted (i.e., empty -> convert all).

@makslevental makslevental force-pushed the users/makslevental/vectormathapfloat branch from b3c8b87 to ddbcffa Compare January 9, 2026 17:36
@makslevental makslevental force-pushed the users/makslevental/vectormathapfloat branch 2 times, most recently from cd6093b to 102d672 Compare January 9, 2026 21:29
@llvm llvm deleted a comment from github-actions bot Jan 9, 2026
@llvm llvm deleted a comment from github-actions bot Jan 9, 2026
@makslevental makslevental marked this pull request as ready for review January 9, 2026 21:43
@makslevental makslevental marked this pull request as draft January 9, 2026 21:43
@llvmbot llvmbot added the mlir label Jan 9, 2026
@llvmbot
Copy link
Member

llvmbot commented Jan 9, 2026

@llvm/pr-subscribers-mlir-math
@llvm/pr-subscribers-mlir-arith

@llvm/pr-subscribers-mlir

Author: Maksim Levental (makslevental)

Changes

This PR adds vector type support to math-to-apfloat. It also adds supported-types (matching the convention/semantics for the pass arg established by -arith-emulate-unsupported-floats) pass arguments to both arith-to-apfloat and math-to-apfloat to filter down which types will be converted. Note, by default (i.e., empty supported-types) all fp types will be converted (i.e., empty -> convert all).

TODO: add lit tests


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

7 Files Affected:

  • (modified) mlir/include/mlir/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.h (+1)
  • (modified) mlir/include/mlir/Conversion/ArithAndMathToAPFloat/MathToAPFloat.h (+1)
  • (modified) mlir/include/mlir/Conversion/Passes.td (+8)
  • (modified) mlir/lib/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.cpp (+54-97)
  • (modified) mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp (+123-82)
  • (modified) mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.cpp (+45-2)
  • (modified) mlir/lib/Conversion/ArithAndMathToAPFloat/Utils.h (+61)
diff --git a/mlir/include/mlir/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.h b/mlir/include/mlir/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.h
index 6702aca045ba4..2dacc2e11b049 100644
--- a/mlir/include/mlir/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.h
+++ b/mlir/include/mlir/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.h
@@ -9,6 +9,7 @@
 #ifndef MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_ARITHTOAPFLOAT_H
 #define MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_ARITHTOAPFLOAT_H
 
+#include "llvm/ADT/SmallVector.h"
 #include <memory>
 
 namespace mlir {
diff --git a/mlir/include/mlir/Conversion/ArithAndMathToAPFloat/MathToAPFloat.h b/mlir/include/mlir/Conversion/ArithAndMathToAPFloat/MathToAPFloat.h
index 6cb44c89ecebb..06548c250a27b 100644
--- a/mlir/include/mlir/Conversion/ArithAndMathToAPFloat/MathToAPFloat.h
+++ b/mlir/include/mlir/Conversion/ArithAndMathToAPFloat/MathToAPFloat.h
@@ -9,6 +9,7 @@
 #ifndef MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_MATHTOAPFLOAT_H
 #define MLIR_CONVERSION_ARITHANDMATHTOAPFLOAT_MATHTOAPFLOAT_H
 
+#include "llvm/ADT/SmallVector.h"
 #include <memory>
 
 namespace mlir {
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index 7f24e58671aab..fb2860bee6d43 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -198,6 +198,10 @@ def ArithToAPFloatConversionPass
     calls (APFloatWrappers.cpp). APFloat is a software implementation of
     floating-point arithmetic operations.
   }];
+  let options = [
+    ListOption<"sourceTypeStrs", "source-types", "std::string",
+      "MLIR types without arithmetic support on a given target">,
+  ];
   let dependentDialects = ["arith::ArithDialect", "func::FuncDialect",
                            "vector::VectorDialect"];
 }
@@ -787,6 +791,10 @@ def MathToAPFloatConversionPass
     calls (APFloatWrappers.cpp). APFloat is a software implementation of
     floating-point mathmetic operations.
   }];
+  let options = [
+    ListOption<"sourceTypeStrs", "source-types", "std::string",
+      "MLIR types without arithmetic support on a given target">,
+  ];
   let dependentDialects = ["math::MathDialect", "func::FuncDialect"];
 }
 
diff --git a/mlir/lib/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.cpp b/mlir/lib/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.cpp
index 813a854f2fc97..52eb32de6586b 100644
--- a/mlir/lib/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.cpp
+++ b/mlir/lib/Conversion/ArithAndMathToAPFloat/ArithToAPFloat.cpp
@@ -46,86 +46,20 @@ lookupOrCreateBinaryFn(OpBuilder &b, SymbolOpInterface symTable, StringRef name,
                               {i32Type, i64Type, i64Type}, symbolTables);
 }
 
-/// Given two operands of vector type and vector result type (with the same
-/// shape), call the given function for each pair of scalar operands and
-/// package the result into a vector. If the given operands and result type are
-/// not vectors, call the function directly. The second operand is optional.
-template <typename Fn, typename... Values>
-static Value forEachScalarValue(RewriterBase &rewriter, Location loc,
-                                Value operand1, Value operand2, Type resultType,
-                                Fn fn) {
-  auto vecTy1 = dyn_cast<VectorType>(operand1.getType());
-  if (operand2) {
-    // Sanity check: Operand types must match.
-    assert(vecTy1 == dyn_cast<VectorType>(operand2.getType()) &&
-           "expected same vector types");
-  }
-  if (!vecTy1) {
-    // Not a vector. Call the function directly.
-    return fn(operand1, operand2, resultType);
-  }
-
-  // Prepare scalar operands.
-  ResultRange sclars1 =
-      vector::ToElementsOp::create(rewriter, loc, operand1)->getResults();
-  SmallVector<Value> scalars2;
-  if (!operand2) {
-    // No second operand. Create a vector of empty values.
-    scalars2.assign(vecTy1.getNumElements(), Value());
-  } else {
-    llvm::append_range(
-        scalars2,
-        vector::ToElementsOp::create(rewriter, loc, operand2)->getResults());
-  }
-
-  // Call the function for each pair of scalar operands.
-  auto resultVecType = cast<VectorType>(resultType);
-  SmallVector<Value> results;
-  for (auto [scalar1, scalar2] : llvm::zip_equal(sclars1, scalars2)) {
-    Value result = fn(scalar1, scalar2, resultVecType.getElementType());
-    results.push_back(result);
-  }
-
-  // Package the results into a vector.
-  return vector::FromElementsOp::create(
-      rewriter, loc,
-      vecTy1.cloneWith(/*shape=*/std::nullopt, results.front().getType()),
-      results);
-}
-
-/// Check preconditions for the conversion:
-/// 1. All operands / results must be integers or floats (or vectors thereof).
-/// 2. The bitwidth of the operands / results must be <= 64.
-static LogicalResult checkPreconditions(RewriterBase &rewriter, Operation *op) {
-  for (Value value : llvm::concat<Value>(op->getOperands(), op->getResults())) {
-    Type type = value.getType();
-    if (auto vecTy = dyn_cast<VectorType>(type)) {
-      type = vecTy.getElementType();
-    }
-    if (!type.isIntOrFloat()) {
-      return rewriter.notifyMatchFailure(
-          op, "only integers and floats (or vectors thereof) are supported");
-    }
-    if (type.getIntOrFloatBitWidth() > 64)
-      return rewriter.notifyMatchFailure(op,
-                                         "bitwidth > 64 bits is not supported");
-  }
-  return success();
-}
-
 /// Rewrite a binary arithmetic operation to an APFloat function call.
 template <typename OpTy>
 struct BinaryArithOpToAPFloatConversion final : OpRewritePattern<OpTy> {
   BinaryArithOpToAPFloatConversion(MLIRContext *context,
                                    const char *APFloatName,
                                    SymbolOpInterface symTable,
+                                   ArrayRef<Type> sourceTypes,
                                    PatternBenefit benefit = 1)
       : OpRewritePattern<OpTy>(context, benefit), symTable(symTable),
-        APFloatName(APFloatName) {};
+        APFloatName(APFloatName), sourceTypes(sourceTypes) {};
 
   LogicalResult matchAndRewrite(OpTy op,
                                 PatternRewriter &rewriter) const override {
-    if (failed(checkPreconditions(rewriter, op)))
+    if (failed(checkPreconditions(rewriter, op, sourceTypes)))
       return failure();
 
     // Get APFloat function from runtime library.
@@ -170,17 +104,19 @@ struct BinaryArithOpToAPFloatConversion final : OpRewritePattern<OpTy> {
 
   SymbolOpInterface symTable;
   const char *APFloatName;
+  ArrayRef<Type> sourceTypes;
 };
 
 template <typename OpTy>
 struct FpToFpConversion final : OpRewritePattern<OpTy> {
   FpToFpConversion(MLIRContext *context, SymbolOpInterface symTable,
-                   PatternBenefit benefit = 1)
-      : OpRewritePattern<OpTy>(context, benefit), symTable(symTable) {}
+                   ArrayRef<Type> sourceTypes, PatternBenefit benefit = 1)
+      : OpRewritePattern<OpTy>(context, benefit), symTable(symTable),
+        sourceTypes(sourceTypes) {}
 
   LogicalResult matchAndRewrite(OpTy op,
                                 PatternRewriter &rewriter) const override {
-    if (failed(checkPreconditions(rewriter, op)))
+    if (failed(checkPreconditions(rewriter, op, sourceTypes)))
       return failure();
 
     // Get APFloat function from runtime library.
@@ -227,18 +163,20 @@ struct FpToFpConversion final : OpRewritePattern<OpTy> {
   }
 
   SymbolOpInterface symTable;
+  ArrayRef<Type> sourceTypes;
 };
 
 template <typename OpTy>
 struct FpToIntConversion final : OpRewritePattern<OpTy> {
   FpToIntConversion(MLIRContext *context, SymbolOpInterface symTable,
-                    bool isUnsigned, PatternBenefit benefit = 1)
+                    bool isUnsigned, ArrayRef<Type> sourceTypes,
+                    PatternBenefit benefit = 1)
       : OpRewritePattern<OpTy>(context, benefit), symTable(symTable),
-        isUnsigned(isUnsigned) {}
+        isUnsigned(isUnsigned), sourceTypes(sourceTypes) {}
 
   LogicalResult matchAndRewrite(OpTy op,
                                 PatternRewriter &rewriter) const override {
-    if (failed(checkPreconditions(rewriter, op)))
+    if (failed(checkPreconditions(rewriter, op, sourceTypes)))
       return failure();
 
     // Get APFloat function from runtime library.
@@ -289,18 +227,20 @@ struct FpToIntConversion final : OpRewritePattern<OpTy> {
 
   SymbolOpInterface symTable;
   bool isUnsigned;
+  ArrayRef<Type> sourceTypes;
 };
 
 template <typename OpTy>
 struct IntToFpConversion final : OpRewritePattern<OpTy> {
   IntToFpConversion(MLIRContext *context, SymbolOpInterface symTable,
-                    bool isUnsigned, PatternBenefit benefit = 1)
+                    bool isUnsigned, ArrayRef<Type> sourceTypes,
+                    PatternBenefit benefit = 1)
       : OpRewritePattern<OpTy>(context, benefit), symTable(symTable),
-        isUnsigned(isUnsigned) {}
+        isUnsigned(isUnsigned), sourceTypes(sourceTypes) {}
 
   LogicalResult matchAndRewrite(OpTy op,
                                 PatternRewriter &rewriter) const override {
-    if (failed(checkPreconditions(rewriter, op)))
+    if (failed(checkPreconditions(rewriter, op, sourceTypes)))
       return failure();
 
     // Get APFloat function from runtime library.
@@ -361,16 +301,19 @@ struct IntToFpConversion final : OpRewritePattern<OpTy> {
 
   SymbolOpInterface symTable;
   bool isUnsigned;
+  ArrayRef<Type> sourceTypes;
 };
 
 struct CmpFOpToAPFloatConversion final : OpRewritePattern<arith::CmpFOp> {
   CmpFOpToAPFloatConversion(MLIRContext *context, SymbolOpInterface symTable,
+                            ArrayRef<Type> sourceTypes,
                             PatternBenefit benefit = 1)
-      : OpRewritePattern<arith::CmpFOp>(context, benefit), symTable(symTable) {}
+      : OpRewritePattern<arith::CmpFOp>(context, benefit), symTable(symTable),
+        sourceTypes(sourceTypes) {}
 
   LogicalResult matchAndRewrite(arith::CmpFOp op,
                                 PatternRewriter &rewriter) const override {
-    if (failed(checkPreconditions(rewriter, op)))
+    if (failed(checkPreconditions(rewriter, op, sourceTypes)))
       return failure();
 
     // Get APFloat function from runtime library.
@@ -512,16 +455,19 @@ struct CmpFOpToAPFloatConversion final : OpRewritePattern<arith::CmpFOp> {
   }
 
   SymbolOpInterface symTable;
+  ArrayRef<Type> sourceTypes;
 };
 
 struct NegFOpToAPFloatConversion final : OpRewritePattern<arith::NegFOp> {
   NegFOpToAPFloatConversion(MLIRContext *context, SymbolOpInterface symTable,
+                            ArrayRef<Type> sourceTypes,
                             PatternBenefit benefit = 1)
-      : OpRewritePattern<arith::NegFOp>(context, benefit), symTable(symTable) {}
+      : OpRewritePattern<arith::NegFOp>(context, benefit), symTable(symTable),
+        sourceTypes(sourceTypes) {}
 
   LogicalResult matchAndRewrite(arith::NegFOp op,
                                 PatternRewriter &rewriter) const override {
-    if (failed(checkPreconditions(rewriter, op)))
+    if (failed(checkPreconditions(rewriter, op, sourceTypes)))
       return failure();
 
     // Get APFloat function from runtime library.
@@ -564,6 +510,7 @@ struct NegFOpToAPFloatConversion final : OpRewritePattern<arith::NegFOp> {
   }
 
   SymbolOpInterface symTable;
+  ArrayRef<Type> sourceTypes;
 };
 
 namespace {
@@ -577,36 +524,46 @@ struct ArithToAPFloatConversionPass final
 void ArithToAPFloatConversionPass::runOnOperation() {
   MLIRContext *context = &getContext();
   RewritePatternSet patterns(context);
-  patterns.add<BinaryArithOpToAPFloatConversion<arith::AddFOp>>(context, "add",
-                                                                getOperation());
+
+  FailureOr<SmallVector<Type>> sourceTypes =
+      parseSourceTypes(llvm::to_vector(sourceTypeStrs), context);
+  if (failed(sourceTypes))
+    return signalPassFailure();
+
+  patterns.add<BinaryArithOpToAPFloatConversion<arith::AddFOp>>(
+      context, "add", getOperation(), *sourceTypes);
   patterns.add<BinaryArithOpToAPFloatConversion<arith::SubFOp>>(
-      context, "subtract", getOperation());
+      context, "subtract", getOperation(), *sourceTypes);
   patterns.add<BinaryArithOpToAPFloatConversion<arith::MulFOp>>(
-      context, "multiply", getOperation());
+      context, "multiply", getOperation(), *sourceTypes);
   patterns.add<BinaryArithOpToAPFloatConversion<arith::DivFOp>>(
-      context, "divide", getOperation());
+      context, "divide", getOperation(), *sourceTypes);
   patterns.add<BinaryArithOpToAPFloatConversion<arith::RemFOp>>(
-      context, "remainder", getOperation());
+      context, "remainder", getOperation(), *sourceTypes);
   patterns.add<BinaryArithOpToAPFloatConversion<arith::MinNumFOp>>(
-      context, "minnum", getOperation());
+      context, "minnum", getOperation(), *sourceTypes);
   patterns.add<BinaryArithOpToAPFloatConversion<arith::MaxNumFOp>>(
-      context, "maxnum", getOperation());
+      context, "maxnum", getOperation(), *sourceTypes);
   patterns.add<BinaryArithOpToAPFloatConversion<arith::MinimumFOp>>(
-      context, "minimum", getOperation());
+      context, "minimum", getOperation(), *sourceTypes);
   patterns.add<BinaryArithOpToAPFloatConversion<arith::MaximumFOp>>(
-      context, "maximum", getOperation());
+      context, "maximum", getOperation(), *sourceTypes);
   patterns
       .add<FpToFpConversion<arith::ExtFOp>, FpToFpConversion<arith::TruncFOp>,
            CmpFOpToAPFloatConversion, NegFOpToAPFloatConversion>(
-          context, getOperation());
+          context, getOperation(), *sourceTypes);
   patterns.add<FpToIntConversion<arith::FPToSIOp>>(context, getOperation(),
-                                                   /*isUnsigned=*/false);
+                                                   /*isUnsigned=*/false,
+                                                   *sourceTypes);
   patterns.add<FpToIntConversion<arith::FPToUIOp>>(context, getOperation(),
-                                                   /*isUnsigned=*/true);
+                                                   /*isUnsigned=*/true,
+                                                   *sourceTypes);
   patterns.add<IntToFpConversion<arith::SIToFPOp>>(context, getOperation(),
-                                                   /*isUnsigned=*/false);
+                                                   /*isUnsigned=*/false,
+                                                   *sourceTypes);
   patterns.add<IntToFpConversion<arith::UIToFPOp>>(context, getOperation(),
-                                                   /*isUnsigned=*/true);
+                                                   /*isUnsigned=*/true,
+                                                   *sourceTypes);
   LogicalResult result = success();
   ScopedDiagnosticHandler scopedHandler(context, [&result](Diagnostic &diag) {
     if (diag.getSeverity() == DiagnosticSeverity::Error) {
diff --git a/mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp b/mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp
index 784028f5cf2eb..b5e15e5c42bed 100644
--- a/mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp
+++ b/mlir/lib/Conversion/ArithAndMathToAPFloat/MathToAPFloat.cpp
@@ -28,21 +28,15 @@ using namespace mlir::func;
 
 struct AbsFOpToAPFloatConversion final : OpRewritePattern<math::AbsFOp> {
   AbsFOpToAPFloatConversion(MLIRContext *context, SymbolOpInterface symTable,
+                            ArrayRef<Type> sourceTypes,
                             PatternBenefit benefit = 1)
-      : OpRewritePattern<math::AbsFOp>(context, benefit), symTable(symTable) {}
+      : OpRewritePattern<math::AbsFOp>(context, benefit), symTable(symTable),
+        sourceTypes(sourceTypes) {}
 
   LogicalResult matchAndRewrite(math::AbsFOp op,
                                 PatternRewriter &rewriter) const override {
-    // Cast operands to 64-bit integers.
-    auto operand = op.getOperand();
-    auto floatTy = dyn_cast<FloatType>(operand.getType());
-    if (!floatTy)
-      return rewriter.notifyMatchFailure(op,
-                                         "only scalar FloatTypes supported");
-    if (floatTy.getIntOrFloatBitWidth() > 64) {
-      return rewriter.notifyMatchFailure(op,
-                                         "bitwidth > 64 bits is not supported");
-    }
+    if (failed(checkPreconditions(rewriter, op, sourceTypes)))
+      return failure();
     // Get APFloat function from runtime library.
     auto i32Type = IntegerType::get(symTable->getContext(), 32);
     auto i64Type = IntegerType::get(symTable->getContext(), 64);
@@ -52,49 +46,50 @@ struct AbsFOpToAPFloatConversion final : OpRewritePattern<math::AbsFOp> {
       return fn;
     Location loc = op.getLoc();
     rewriter.setInsertionPoint(op);
-    auto intWType = rewriter.getIntegerType(floatTy.getWidth());
-    Value operandBits = arith::ExtUIOp::create(
-        rewriter, loc, i64Type,
-        arith::BitcastOp::create(rewriter, loc, intWType, operand));
-
-    // Call APFloat function.
-    Value semValue = getAPFloatSemanticsValue(rewriter, loc, floatTy);
-    SmallVector<Value> params = {semValue, operandBits};
-    Value negatedBits = func::CallOp::create(rewriter, loc, TypeRange(i64Type),
-                                             SymbolRefAttr::get(*fn), params)
-                            ->getResult(0);
-
-    // Truncate result to the original width.
-    Value truncatedBits =
-        arith::TruncIOp::create(rewriter, loc, intWType, negatedBits);
-    rewriter.replaceOp(
-        op, arith::BitcastOp::create(rewriter, loc, floatTy, truncatedBits));
+    // Scalarize and convert to APFloat runtime calls.
+    Value repl = forEachScalarValue(
+        rewriter, loc, op.getOperand(), /*operand2=*/Value(), op.getType(),
+        [&](Value operand, Value, Type resultType) {
+          auto floatTy = cast<FloatType>(operand.getType());
+          auto intWType = rewriter.getIntegerType(floatTy.getWidth());
+          Value operandBits = arith::ExtUIOp::create(
+              rewriter, loc, i64Type,
+              arith::BitcastOp::create(rewriter, loc, intWType, operand));
+          // Call APFloat function.
+          Value semValue = getAPFloatSemanticsValue(rewriter, loc, floatTy);
+          SmallVector<Value> params = {semValue, operandBits};
+          Value negatedBits =
+              func::CallOp::create(rewriter, loc, TypeRange(i64Type),
+                                   SymbolRefAttr::get(*fn), params)
+                  ->getResult(0);
+          // Truncate result to the original width.
+          auto truncatedBits =
+              arith::TruncIOp::create(rewriter, loc, intWType, negatedBits);
+          return arith::BitcastOp::create(rewriter, loc, floatTy,
+                                          truncatedBits);
+        });
+
+    rewriter.replaceOp(op, repl);
     return success();
   }
 
   SymbolOpInterface symTable;
+  ArrayRef<Type> sourceTypes;
 };
 
 template <typename OpTy>
 struct IsOpToAPFloatConversion final : OpRewritePattern<OpTy> {
   IsOpToAPFloatConversion(MLIRContext *context, const char *APFloatName,
                           SymbolOpInterface symTable,
+                          ArrayRef<Type> sourceTypes,
                           PatternBenefit benefit = 1)
       : OpRewritePattern<OpTy>(context, benefit), symTable(symTable),
-        APFloatName(APFloatName) {};
+        APFloatName(APFloatName), sourceTypes(sourceTypes) {};
 
   LogicalResult matchAndRewrite(OpTy op,
                                 PatternRewriter &rewriter) const override {
-    // Cast operands to 64-bit integers.
-    auto operand = op.getOperand();
-    auto floatTy = dyn_cast<FloatType>(operand.getType());
-    if (!floatTy)
-      return rewriter.notifyMatchFailure(op,
-                                         "only scalar FloatTypes supported");
-    if (floatTy.getIntOrFloatBitWidth() > 64) {
-      return rewriter.notifyMatchFailure(op,
-                                         "bitwidth > 64 bits is not supported");
-    }
+    if (failed(checkPreconditions(rewriter, op, sourceTypes)))
+      return failure();
     // Get APFloat function from runtime library.
     auto i1 = IntegerType::get(symTable->getContext(), 1);
     auto i32Type = IntegerType::get(symTable->getContext(), 32);
@@ -...
[truncated]

@makslevental makslevental force-pushed the users/makslevental/vectormathapfloat branch from 102d672 to acf7738 Compare January 9, 2026 22:18
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.

My one concern is that you're storing ArrayRef, which will have lifetime issues - I'd copy those into a SmallVector instead

Overall, seems like a good extension.

Copy link
Member

@matthias-springer matthias-springer left a comment

Choose a reason for hiding this comment

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

Looks good overall!

/// shape), call the given function for each pair of scalar operands and
/// package the result into a vector. If the given operands and result type are
/// not vectors, call the function directly. The second operand is optional.
template <typename Fn, typename... Values>
Copy link
Member

Choose a reason for hiding this comment

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

typename... Values is unused? (This seems already redundant in the original code.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

template <typename Fn, typename... Values>
Value forEachScalarValue(mlir::RewriterBase &rewriter, Location loc,
Value operand1, Value operand2, Type resultType,
Fn fn) {
Copy link
Member

Choose a reason for hiding this comment

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

Now that this is in a header file, maybe it makes sense to pass a function pointer instead of templatizing the function? Then the implementation could be in the .cpp file. Not sure if it's really better, just an idea...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i opted for not extending forEachScalarValue and therefore being able to use llvm::function_ref and being able to move the impl into Util.cpp

return arith::BitcastOp::create(rewriter, loc, floatTy, trunc);
};

if (VectorType vecTy1 = dyn_cast<VectorType>(op.getA().getType())) {
Copy link
Member

Choose a reason for hiding this comment

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

Can forEachScalarValue be used here? It is unused at the moment, but I wrote typename... Values to support an arbitrary number of operands. Seems like I abandoned that implementation for some reason...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

easier to just one-off here (not many 3+ operand ops to handle...)

floating-point arithmetic operations.
}];
let options = [
ListOption<"sourceTypeStrs", "source-types", "std::string",
Copy link
Member

Choose a reason for hiding this comment

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

I would split this PR into two: one that adds source-types and one that adds vector support.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay moved to #176270

@matthias-springer
Copy link
Member

matthias-springer commented Jan 10, 2026

My one concern is that you're storing ArrayRef, which will have lifetime issues - I'd copy those into a SmallVector instead

Either that or document somewhere (pattern constructor?) that the lifetime of data must last at least until the last pattern application. (As long as we don't expose these patterns through public populate... functions, I think the current implementation is safe.)

@makslevental makslevental force-pushed the users/makslevental/vectormathapfloat branch from d947dcd to 982454b Compare January 15, 2026 23:38
@makslevental
Copy link
Contributor Author

My one concern is that you're storing ArrayRef, which will have lifetime issues - I'd copy those into a SmallVector instead

I don't think this is a big deal - the backing for the ArrayRef outlives all the Patterns because the patterns are added to a PatternSet "owned" by the pass (ie created in runOnOperation). If we expose the patterns via "populators" it'll still be the same thing (whichever pass adds the patterns will have its backing which outlives its own PatternSet).

@makslevental makslevental marked this pull request as ready for review January 16, 2026 00:45
@makslevental
Copy link
Contributor Author

@matthias-springer @krzysz00 this is now done/actually ready to review

Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

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

.

@llvmbot llvmbot added the mlir:python MLIR Python bindings label Jan 16, 2026
@makslevental makslevental removed the request for review from rolfmorel January 16, 2026 15:49
@makslevental makslevental merged commit 47f9e0a into main Jan 16, 2026
11 checks passed
@makslevental makslevental deleted the users/makslevental/vectormathapfloat branch January 16, 2026 18:14
makslevental added a commit that referenced this pull request Jan 16, 2026
makslevental added a commit that referenced this pull request Jan 16, 2026
makslevental added a commit that referenced this pull request Jan 16, 2026
@jplehr
Copy link
Contributor

jplehr commented Jan 16, 2026

I think this commit broke one of our bots. The bot does not listen to MLIR changes (apologies, I'll make it listen) so it did only break after this patch found its way into main.

Seems like a missing link dependency.

Bot: https://lab.llvm.org/buildbot/#/builders/206/builds/12012/steps/7/logs/stdio

Error

[6397/8429] Linking CXX shared library lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git
FAILED: lib/libMLIRArithAndMathToAPFloatUtils.so.23.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/hip-third-party-libs-test/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRArithAndMathToAPFloatUtils.so.23.0git -o lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/hip-third-party-libs-test/build/lib:"  lib/libMLIRArithDialect.so.23.0git  lib/libMLIRCastInterfaces.so.23.0git  lib/libMLIRDialect.so.23.0git  lib/libMLIRInferIntRangeCommon.so.23.0git  lib/libMLIRShapedOpInterfaces.so.23.0git  lib/libMLIRInferIntRangeInterface.so.23.0git  lib/libMLIRInferTypeOpInterface.so.23.0git  lib/libMLIRUBDialect.so.23.0git  lib/libMLIRIR.so.23.0git  lib/libMLIRSupport.so.23.0git  lib/libLLVMSupport.so.23.0git  -Wl,-rpath-link,/home/botworker/bbot/hip-third-party-libs-test/build/lib && :
/usr/bin/ld: tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o: in function `mlir::forEachScalarValue(mlir::RewriterBase&, mlir::Location, mlir::Value, mlir::Value, mlir::Type, llvm::function_ref<mlir::Value (mlir::Value, mlir::Value, mlir::Type)>)':
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0xe7): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x136): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x249): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x486): undefined reference to `mlir::vector::FromElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::ValueRange)'
collect2: error: ld returned 1 exit status

@llvm-ci
Copy link

llvm-ci commented Jan 16, 2026

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/34447

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)
...
[5159/8429] Linking CXX shared library lib/libMLIRArithToEmitC.so.23.0git
[5160/8429] Linking CXX shared library lib/libLLVMMCJIT.so.23.0git
[5161/8429] Linking CXX shared library lib/libMLIRROCDLDialect.so.23.0git
[5162/8429] Linking CXX shared library lib/libMLIRBufferizationDialect.so.23.0git
[5163/8429] Linking CXX shared library lib/libMLIRSCFDialect.so.23.0git
[5164/8429] Linking CXX shared library lib/libMLIRCAPIIRDL.so.23.0git
[5165/8429] Linking CXX shared library lib/libMLIRCAPIComplex.so.23.0git
[5166/8429] Linking CXX shared library lib/libMLIRCAPIUB.so.23.0git
[5167/8429] Creating library symlink lib/libLLVMMCJIT.so
[5168/8429] Linking CXX shared library lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git
FAILED: lib/libMLIRArithAndMathToAPFloatUtils.so.23.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,libMLIRArithAndMathToAPFloatUtils.so.23.0git -o lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRArithDialect.so.23.0git  lib/libMLIRCastInterfaces.so.23.0git  lib/libMLIRDialect.so.23.0git  lib/libMLIRInferIntRangeCommon.so.23.0git  lib/libMLIRShapedOpInterfaces.so.23.0git  lib/libMLIRInferIntRangeInterface.so.23.0git  lib/libMLIRInferTypeOpInterface.so.23.0git  lib/libMLIRUBDialect.so.23.0git  lib/libMLIRIR.so.23.0git  lib/libMLIRSupport.so.23.0git  lib/libLLVMSupport.so.23.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o: in function `mlir::forEachScalarValue(mlir::RewriterBase&, mlir::Location, mlir::Value, mlir::Value, mlir::Type, llvm::function_ref<mlir::Value (mlir::Value, mlir::Value, mlir::Type)>)':
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0xe7): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x136): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x249): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x486): undefined reference to `mlir::vector::FromElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::ValueRange)'
collect2: error: ld returned 1 exit status
[5169/8429] Linking CXX shared library lib/libMLIRTensorUtils.so.23.0git
[5170/8429] Linking CXX shared library lib/libMLIRCAPIDLTI.so.23.0git
[5171/8429] Creating library symlink lib/libMLIRArithToEmitC.so
[5172/8429] Creating library symlink lib/libMLIRTensorInferTypeOpInterfaceImpl.so
[5173/8429] Linking CXX shared library lib/libLLVMFrontendOffloading.so.23.0git
[5174/8429] Linking CXX shared library lib/libLLVMAggressiveInstCombine.so.23.0git
[5175/8429] Linking CXX shared library lib/libMLIRShapeDialect.so.23.0git
[5176/8429] Linking CXX shared library lib/libLLVMHipStdPar.so.23.0git
[5177/8429] Linking CXX shared library lib/libLLVMLinker.so.23.0git
[5178/8429] Linking CXX shared library lib/libLLVMSPIRVAnalysis.so.23.0git
[5179/8429] Linking CXX shared library lib/libLLVMObjCARCOpts.so.23.0git
[5180/8429] Linking CXX shared library lib/libLLVMInstCombine.so.23.0git
[5181/8429] Linking CXX shared library lib/libLLVMInstrumentation.so.23.0git
[5182/8429] Linking CXX shared library lib/libMLIRTransformDialect.so.23.0git
[5183/8429] Linking CXX shared library lib/libMLIROpenACCDialect.so.23.0git
[5184/8429] Linking CXX shared library lib/libMLIRVectorDialect.so.23.0git
[5185/8429] Linking CXX shared library lib/libLLVMVectorize.so.23.0git
[5186/8429] Linking CXX shared library lib/libMLIRTosaDialect.so.23.0git
[5187/8429] Linking CXX shared library lib/libMLIRNVVMDialect.so.23.0git
[5188/8429] Building AMDGPUGenSearchableTables.inc...
[5189/8429] Linking CXX shared library lib/libMLIRSPIRVDialect.so.23.0git
[5190/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithToAPFloat.dir/ArithToAPFloat.cpp.o
[5191/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRMathToAPFloat.dir/MathToAPFloat.cpp.o
[5192/8429] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[5193/8429] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5194/8429] Building AMDGPUGenCallingConv.inc...
[5195/8429] Building AMDGPUGenAsmWriter.inc...
[5196/8429] Building AMDGPUGenDAGISel.inc...
[5197/8429] Building AMDGPUGenInstrInfo.inc...
[5198/8429] Building AMDGPUGenGlobalISel.inc...
[5199/8429] Building AMDGPUGenRegisterInfo.inc...
Step 7 (build cmake config) failure: build cmake config (failure)
...
[5159/8429] Linking CXX shared library lib/libMLIRArithToEmitC.so.23.0git
[5160/8429] Linking CXX shared library lib/libLLVMMCJIT.so.23.0git
[5161/8429] Linking CXX shared library lib/libMLIRROCDLDialect.so.23.0git
[5162/8429] Linking CXX shared library lib/libMLIRBufferizationDialect.so.23.0git
[5163/8429] Linking CXX shared library lib/libMLIRSCFDialect.so.23.0git
[5164/8429] Linking CXX shared library lib/libMLIRCAPIIRDL.so.23.0git
[5165/8429] Linking CXX shared library lib/libMLIRCAPIComplex.so.23.0git
[5166/8429] Linking CXX shared library lib/libMLIRCAPIUB.so.23.0git
[5167/8429] Creating library symlink lib/libLLVMMCJIT.so
[5168/8429] Linking CXX shared library lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git
FAILED: lib/libMLIRArithAndMathToAPFloatUtils.so.23.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,libMLIRArithAndMathToAPFloatUtils.so.23.0git -o lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRArithDialect.so.23.0git  lib/libMLIRCastInterfaces.so.23.0git  lib/libMLIRDialect.so.23.0git  lib/libMLIRInferIntRangeCommon.so.23.0git  lib/libMLIRShapedOpInterfaces.so.23.0git  lib/libMLIRInferIntRangeInterface.so.23.0git  lib/libMLIRInferTypeOpInterface.so.23.0git  lib/libMLIRUBDialect.so.23.0git  lib/libMLIRIR.so.23.0git  lib/libMLIRSupport.so.23.0git  lib/libLLVMSupport.so.23.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o: in function `mlir::forEachScalarValue(mlir::RewriterBase&, mlir::Location, mlir::Value, mlir::Value, mlir::Type, llvm::function_ref<mlir::Value (mlir::Value, mlir::Value, mlir::Type)>)':
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0xe7): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x136): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x249): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x486): undefined reference to `mlir::vector::FromElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::ValueRange)'
collect2: error: ld returned 1 exit status
[5169/8429] Linking CXX shared library lib/libMLIRTensorUtils.so.23.0git
[5170/8429] Linking CXX shared library lib/libMLIRCAPIDLTI.so.23.0git
[5171/8429] Creating library symlink lib/libMLIRArithToEmitC.so
[5172/8429] Creating library symlink lib/libMLIRTensorInferTypeOpInterfaceImpl.so
[5173/8429] Linking CXX shared library lib/libLLVMFrontendOffloading.so.23.0git
[5174/8429] Linking CXX shared library lib/libLLVMAggressiveInstCombine.so.23.0git
[5175/8429] Linking CXX shared library lib/libMLIRShapeDialect.so.23.0git
[5176/8429] Linking CXX shared library lib/libLLVMHipStdPar.so.23.0git
[5177/8429] Linking CXX shared library lib/libLLVMLinker.so.23.0git
[5178/8429] Linking CXX shared library lib/libLLVMSPIRVAnalysis.so.23.0git
[5179/8429] Linking CXX shared library lib/libLLVMObjCARCOpts.so.23.0git
[5180/8429] Linking CXX shared library lib/libLLVMInstCombine.so.23.0git
[5181/8429] Linking CXX shared library lib/libLLVMInstrumentation.so.23.0git
[5182/8429] Linking CXX shared library lib/libMLIRTransformDialect.so.23.0git
[5183/8429] Linking CXX shared library lib/libMLIROpenACCDialect.so.23.0git
[5184/8429] Linking CXX shared library lib/libMLIRVectorDialect.so.23.0git
[5185/8429] Linking CXX shared library lib/libLLVMVectorize.so.23.0git
[5186/8429] Linking CXX shared library lib/libMLIRTosaDialect.so.23.0git
[5187/8429] Linking CXX shared library lib/libMLIRNVVMDialect.so.23.0git
[5188/8429] Building AMDGPUGenSearchableTables.inc...
[5189/8429] Linking CXX shared library lib/libMLIRSPIRVDialect.so.23.0git
[5190/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithToAPFloat.dir/ArithToAPFloat.cpp.o
[5191/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRMathToAPFloat.dir/MathToAPFloat.cpp.o
[5192/8429] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[5193/8429] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5194/8429] Building AMDGPUGenCallingConv.inc...
[5195/8429] Building AMDGPUGenAsmWriter.inc...
[5196/8429] Building AMDGPUGenDAGISel.inc...
[5197/8429] Building AMDGPUGenInstrInfo.inc...
[5198/8429] Building AMDGPUGenGlobalISel.inc...
[5199/8429] Building AMDGPUGenRegisterInfo.inc...

@makslevental
Copy link
Contributor Author

Fixed already here #176462

@llvm-ci
Copy link

llvm-ci commented Jan 16, 2026

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/33232

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)
...
[5360/8429] Creating library symlink lib/libMLIROpenACCToSCF.so
[5361/8429] Linking CXX shared library lib/libMLIRVectorDialect.so.23.0git
[5362/8429] Creating library symlink lib/libMLIRAffineAnalysis.so
[5363/8429] Linking CXX shared library lib/libMLIRBufferizationTransforms.so.23.0git
[5364/8429] Creating library symlink lib/libMLIRSCFToOpenMP.so
[5365/8429] Creating library symlink lib/libMLIRBufferizationTransforms.so
[5366/8429] Linking CXX shared library lib/libMLIRExecutionEngineUtils.so.23.0git
[5367/8429] Linking CXX shared library lib/libMLIRShapeToStandard.so.23.0git
[5368/8429] Creating library symlink lib/libMLIRShapeToStandard.so
[5369/8429] Linking CXX shared library lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git
FAILED: lib/libMLIRArithAndMathToAPFloatUtils.so.23.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,libMLIRArithAndMathToAPFloatUtils.so.23.0git -o lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRArithDialect.so.23.0git  lib/libMLIRCastInterfaces.so.23.0git  lib/libMLIRDialect.so.23.0git  lib/libMLIRInferIntRangeCommon.so.23.0git  lib/libMLIRShapedOpInterfaces.so.23.0git  lib/libMLIRInferIntRangeInterface.so.23.0git  lib/libMLIRInferTypeOpInterface.so.23.0git  lib/libMLIRUBDialect.so.23.0git  lib/libMLIRIR.so.23.0git  lib/libMLIRSupport.so.23.0git  lib/libLLVMSupport.so.23.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o: in function `mlir::forEachScalarValue(mlir::RewriterBase&, mlir::Location, mlir::Value, mlir::Value, mlir::Type, llvm::function_ref<mlir::Value (mlir::Value, mlir::Value, mlir::Type)>)':
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0xd2): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x121): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x229): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x466): undefined reference to `mlir::vector::FromElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::ValueRange)'
collect2: error: ld returned 1 exit status
[5370/8429] Creating library symlink lib/libMLIRNVVMDialect.so
[5371/8429] Linking CXX shared library lib/libMLIRTransformDialectIRDLExtension.so.23.0git
[5372/8429] Linking CXX shared library lib/libMLIRTransformLoopExtension.so.23.0git
[5373/8429] Linking CXX shared library lib/libMLIRConvertToEmitC.so.23.0git
[5374/8429] Linking CXX shared library lib/libMLIRTransformSMTExtension.so.23.0git
[5375/8429] Linking CXX shared library lib/libMLIRTosaDialect.so.23.0git
[5376/8429] Linking CXX shared library lib/libMLIRTransformDebugExtension.so.23.0git
[5377/8429] Linking CXX shared library lib/libMLIRTransformPDLExtension.so.23.0git
[5378/8429] Linking CXX shared library lib/libMLIRBufferizationToMemRef.so.23.0git
[5379/8429] Linking CXX shared library lib/libLLVMOrcDebugging.so.23.0git
[5380/8429] Linking CXX shared library lib/libMLIRControlFlowTransforms.so.23.0git
[5381/8429] Linking CXX shared library lib/libMLIRAffineUtils.so.23.0git
[5382/8429] Linking CXX shared library lib/libMLIRDLTITransformOps.so.23.0git
[5383/8429] Linking CXX shared library lib/libMLIRLinalgDialect.so.23.0git
[5384/8429] Linking CXX shared library lib/libMLIRSPIRVDialect.so.23.0git
[5385/8429] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/integer.test.dir/integer.cpp.o
[5386/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithToAPFloat.dir/ArithToAPFloat.cpp.o
[5387/8429] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5388/8429] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/Attributes/CMakeFiles/CUFAttrs.dir/CUFAttr.cpp.o
[5389/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRMathToAPFloat.dir/MathToAPFloat.cpp.o
[5390/8429] Building AMDGPUGenCallingConv.inc...
[5391/8429] Building AMDGPUGenAsmWriter.inc...
[5392/8429] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[5393/8429] Building AMDGPUGenDAGISel.inc...
[5394/8429] Building AMDGPUGenInstrInfo.inc...
[5395/8429] Building AMDGPUGenGlobalISel.inc...
[5396/8429] Building AMDGPUGenAsmMatcher.inc...
[5397/8429] Building AMDGPUGenRegisterInfo.inc...
[5398/8429] Building AMDGPUGenRegisterBank.inc...
[5399/8429] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[5400/8429] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
Step 7 (build cmake config) failure: build cmake config (failure)
...
[5360/8429] Creating library symlink lib/libMLIROpenACCToSCF.so
[5361/8429] Linking CXX shared library lib/libMLIRVectorDialect.so.23.0git
[5362/8429] Creating library symlink lib/libMLIRAffineAnalysis.so
[5363/8429] Linking CXX shared library lib/libMLIRBufferizationTransforms.so.23.0git
[5364/8429] Creating library symlink lib/libMLIRSCFToOpenMP.so
[5365/8429] Creating library symlink lib/libMLIRBufferizationTransforms.so
[5366/8429] Linking CXX shared library lib/libMLIRExecutionEngineUtils.so.23.0git
[5367/8429] Linking CXX shared library lib/libMLIRShapeToStandard.so.23.0git
[5368/8429] Creating library symlink lib/libMLIRShapeToStandard.so
[5369/8429] Linking CXX shared library lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git
FAILED: lib/libMLIRArithAndMathToAPFloatUtils.so.23.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,libMLIRArithAndMathToAPFloatUtils.so.23.0git -o lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRArithDialect.so.23.0git  lib/libMLIRCastInterfaces.so.23.0git  lib/libMLIRDialect.so.23.0git  lib/libMLIRInferIntRangeCommon.so.23.0git  lib/libMLIRShapedOpInterfaces.so.23.0git  lib/libMLIRInferIntRangeInterface.so.23.0git  lib/libMLIRInferTypeOpInterface.so.23.0git  lib/libMLIRUBDialect.so.23.0git  lib/libMLIRIR.so.23.0git  lib/libMLIRSupport.so.23.0git  lib/libLLVMSupport.so.23.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o: in function `mlir::forEachScalarValue(mlir::RewriterBase&, mlir::Location, mlir::Value, mlir::Value, mlir::Type, llvm::function_ref<mlir::Value (mlir::Value, mlir::Value, mlir::Type)>)':
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0xd2): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x121): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x229): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
/usr/bin/ld: Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x466): undefined reference to `mlir::vector::FromElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::ValueRange)'
collect2: error: ld returned 1 exit status
[5370/8429] Creating library symlink lib/libMLIRNVVMDialect.so
[5371/8429] Linking CXX shared library lib/libMLIRTransformDialectIRDLExtension.so.23.0git
[5372/8429] Linking CXX shared library lib/libMLIRTransformLoopExtension.so.23.0git
[5373/8429] Linking CXX shared library lib/libMLIRConvertToEmitC.so.23.0git
[5374/8429] Linking CXX shared library lib/libMLIRTransformSMTExtension.so.23.0git
[5375/8429] Linking CXX shared library lib/libMLIRTosaDialect.so.23.0git
[5376/8429] Linking CXX shared library lib/libMLIRTransformDebugExtension.so.23.0git
[5377/8429] Linking CXX shared library lib/libMLIRTransformPDLExtension.so.23.0git
[5378/8429] Linking CXX shared library lib/libMLIRBufferizationToMemRef.so.23.0git
[5379/8429] Linking CXX shared library lib/libLLVMOrcDebugging.so.23.0git
[5380/8429] Linking CXX shared library lib/libMLIRControlFlowTransforms.so.23.0git
[5381/8429] Linking CXX shared library lib/libMLIRAffineUtils.so.23.0git
[5382/8429] Linking CXX shared library lib/libMLIRDLTITransformOps.so.23.0git
[5383/8429] Linking CXX shared library lib/libMLIRLinalgDialect.so.23.0git
[5384/8429] Linking CXX shared library lib/libMLIRSPIRVDialect.so.23.0git
[5385/8429] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/integer.test.dir/integer.cpp.o
[5386/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithToAPFloat.dir/ArithToAPFloat.cpp.o
[5387/8429] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5388/8429] Building CXX object tools/flang/lib/Optimizer/Dialect/CUF/Attributes/CMakeFiles/CUFAttrs.dir/CUFAttr.cpp.o
[5389/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRMathToAPFloat.dir/MathToAPFloat.cpp.o
[5390/8429] Building AMDGPUGenCallingConv.inc...
[5391/8429] Building AMDGPUGenAsmWriter.inc...
[5392/8429] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
[5393/8429] Building AMDGPUGenDAGISel.inc...
[5394/8429] Building AMDGPUGenInstrInfo.inc...
[5395/8429] Building AMDGPUGenGlobalISel.inc...
[5396/8429] Building AMDGPUGenAsmMatcher.inc...
[5397/8429] Building AMDGPUGenRegisterInfo.inc...
[5398/8429] Building AMDGPUGenRegisterBank.inc...
[5399/8429] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[5400/8429] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o

@llvm-ci
Copy link

llvm-ci commented Jan 16, 2026

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/33253

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)
...
[5294/8429] Linking CXX shared library lib/libMLIRTransformSMTExtension.so.23.0git
[5295/8429] Linking CXX shared library lib/libMLIRSCFUtils.so.23.0git
[5296/8429] Linking CXX shared library lib/libMLIRAffineUtils.so.23.0git
[5297/8429] Linking CXX shared library lib/libMLIRTransformDialectTransforms.so.23.0git
[5298/8429] Linking CXX shared library lib/libMLIRConvertToEmitC.so.23.0git
[5299/8429] Creating library symlink lib/libMLIRAffineUtils.so
[5300/8429] Creating library symlink lib/libMLIRConvertToEmitC.so
[5301/8429] Linking CXX shared library lib/libMLIRTransformTuneExtension.so.23.0git
[5302/8429] Generating VCSVersion.inc
[5303/8429] Linking CXX shared library lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git
FAILED: lib/libMLIRArithAndMathToAPFloatUtils.so.23.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,libMLIRArithAndMathToAPFloatUtils.so.23.0git -o lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRArithDialect.so.23.0git  lib/libMLIRCastInterfaces.so.23.0git  lib/libMLIRDialect.so.23.0git  lib/libMLIRInferIntRangeCommon.so.23.0git  lib/libMLIRShapedOpInterfaces.so.23.0git  lib/libMLIRInferIntRangeInterface.so.23.0git  lib/libMLIRInferTypeOpInterface.so.23.0git  lib/libMLIRUBDialect.so.23.0git  lib/libMLIRIR.so.23.0git  lib/libMLIRSupport.so.23.0git  lib/libLLVMSupport.so.23.0git  -lpthread  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o: In function `mlir::forEachScalarValue(mlir::RewriterBase&, mlir::Location, mlir::Value, mlir::Value, mlir::Type, llvm::function_ref<mlir::Value (mlir::Value, mlir::Value, mlir::Type)>)':
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0xca): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x121): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x20e): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x61f): undefined reference to `mlir::vector::FromElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::ValueRange)'
collect2: error: ld returned 1 exit status
[5304/8429] Linking CXX shared library lib/libMLIRArmNeon2dToIntr.so.23.0git
[5305/8429] Linking CXX shared library lib/libMLIRBufferizationToMemRef.so.23.0git
[5306/8429] Creating library symlink lib/libMLIRSCFUtils.so
[5307/8429] Building CXX object tools/lld/Common/CMakeFiles/lldCommon.dir/Args.cpp.o
[5308/8429] Linking CXX shared library lib/libMLIRControlFlowTransforms.so.23.0git
[5309/8429] Linking CXX shared library lib/libMLIROpenACCToSCF.so.23.0git
[5310/8429] Linking CXX shared library lib/libLLVMDWARFLinker.so.23.0git
[5311/8429] Linking CXX shared library lib/libLLVMMIRParser.so.23.0git
[5312/8429] Linking CXX shared library lib/libLLVMInterpreter.so.23.0git
[5313/8429] Linking CXX shared library lib/libMLIRArmNeonTransforms.so.23.0git
[5314/8429] Linking CXX shared library lib/libMLIRMathTransforms.so.23.0git
[5315/8429] Linking CXX shared library lib/libMLIRNVVMDialect.so.23.0git
[5316/8429] Linking CXX shared library lib/libMLIRMLProgramTransforms.so.23.0git
[5317/8429] Linking CXX shared library lib/libMLIRArithTransforms.so.23.0git
[5318/8429] Linking CXX shared library lib/libMLIRArmSVEDialect.so.23.0git
[5319/8429] Linking CXX shared library lib/libMLIRShapeOpsTransforms.so.23.0git
[5320/8429] Linking CXX shared library lib/libMLIRAMDGPUDialect.so.23.0git
[5321/8429] Linking CXX shared library lib/libMLIRArmSMEDialect.so.23.0git
[5322/8429] Linking CXX shared library lib/libLLVMSelectionDAG.so.23.0git
[5323/8429] Linking CXX shared library lib/libMLIRLinalgDialect.so.23.0git
[5324/8429] Linking CXX shared library lib/libMLIRSPIRVDialect.so.23.0git
[5325/8429] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5326/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRMathToAPFloat.dir/MathToAPFloat.cpp.o
[5327/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithToAPFloat.dir/ArithToAPFloat.cpp.o
[5328/8429] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.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/Analysis/IndirectCallPromotionAnalysis.h:16,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Transforms/IPO/MemProfContextDisambiguation.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/lib/LTO/LTO.cpp:60:
/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’:
Step 7 (build cmake config) failure: build cmake config (failure)
...
[5294/8429] Linking CXX shared library lib/libMLIRTransformSMTExtension.so.23.0git
[5295/8429] Linking CXX shared library lib/libMLIRSCFUtils.so.23.0git
[5296/8429] Linking CXX shared library lib/libMLIRAffineUtils.so.23.0git
[5297/8429] Linking CXX shared library lib/libMLIRTransformDialectTransforms.so.23.0git
[5298/8429] Linking CXX shared library lib/libMLIRConvertToEmitC.so.23.0git
[5299/8429] Creating library symlink lib/libMLIRAffineUtils.so
[5300/8429] Creating library symlink lib/libMLIRConvertToEmitC.so
[5301/8429] Linking CXX shared library lib/libMLIRTransformTuneExtension.so.23.0git
[5302/8429] Generating VCSVersion.inc
[5303/8429] Linking CXX shared library lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git
FAILED: lib/libMLIRArithAndMathToAPFloatUtils.so.23.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,libMLIRArithAndMathToAPFloatUtils.so.23.0git -o lib/libMLIRArithAndMathToAPFloatUtils.so.23.0git tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRArithDialect.so.23.0git  lib/libMLIRCastInterfaces.so.23.0git  lib/libMLIRDialect.so.23.0git  lib/libMLIRInferIntRangeCommon.so.23.0git  lib/libMLIRShapedOpInterfaces.so.23.0git  lib/libMLIRInferIntRangeInterface.so.23.0git  lib/libMLIRInferTypeOpInterface.so.23.0git  lib/libMLIRUBDialect.so.23.0git  lib/libMLIRIR.so.23.0git  lib/libMLIRSupport.so.23.0git  lib/libLLVMSupport.so.23.0git  -lpthread  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithAndMathToAPFloatUtils.dir/Utils.cpp.o: In function `mlir::forEachScalarValue(mlir::RewriterBase&, mlir::Location, mlir::Value, mlir::Value, mlir::Type, llvm::function_ref<mlir::Value (mlir::Value, mlir::Value, mlir::Type)>)':
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0xca): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x121): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x20e): undefined reference to `mlir::vector::ToElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Value)'
Utils.cpp:(.text._ZN4mlir18forEachScalarValueERNS_12RewriterBaseENS_8LocationENS_5ValueES3_NS_4TypeEN4llvm12function_refIFS3_S3_S3_S4_EEE+0x61f): undefined reference to `mlir::vector::FromElementsOp::create(mlir::OpBuilder&, mlir::Location, mlir::Type, mlir::ValueRange)'
collect2: error: ld returned 1 exit status
[5304/8429] Linking CXX shared library lib/libMLIRArmNeon2dToIntr.so.23.0git
[5305/8429] Linking CXX shared library lib/libMLIRBufferizationToMemRef.so.23.0git
[5306/8429] Creating library symlink lib/libMLIRSCFUtils.so
[5307/8429] Building CXX object tools/lld/Common/CMakeFiles/lldCommon.dir/Args.cpp.o
[5308/8429] Linking CXX shared library lib/libMLIRControlFlowTransforms.so.23.0git
[5309/8429] Linking CXX shared library lib/libMLIROpenACCToSCF.so.23.0git
[5310/8429] Linking CXX shared library lib/libLLVMDWARFLinker.so.23.0git
[5311/8429] Linking CXX shared library lib/libLLVMMIRParser.so.23.0git
[5312/8429] Linking CXX shared library lib/libLLVMInterpreter.so.23.0git
[5313/8429] Linking CXX shared library lib/libMLIRArmNeonTransforms.so.23.0git
[5314/8429] Linking CXX shared library lib/libMLIRMathTransforms.so.23.0git
[5315/8429] Linking CXX shared library lib/libMLIRNVVMDialect.so.23.0git
[5316/8429] Linking CXX shared library lib/libMLIRMLProgramTransforms.so.23.0git
[5317/8429] Linking CXX shared library lib/libMLIRArithTransforms.so.23.0git
[5318/8429] Linking CXX shared library lib/libMLIRArmSVEDialect.so.23.0git
[5319/8429] Linking CXX shared library lib/libMLIRShapeOpsTransforms.so.23.0git
[5320/8429] Linking CXX shared library lib/libMLIRAMDGPUDialect.so.23.0git
[5321/8429] Linking CXX shared library lib/libMLIRArmSMEDialect.so.23.0git
[5322/8429] Linking CXX shared library lib/libLLVMSelectionDAG.so.23.0git
[5323/8429] Linking CXX shared library lib/libMLIRLinalgDialect.so.23.0git
[5324/8429] Linking CXX shared library lib/libMLIRSPIRVDialect.so.23.0git
[5325/8429] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
[5326/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRMathToAPFloat.dir/MathToAPFloat.cpp.o
[5327/8429] Building CXX object tools/mlir/lib/Conversion/ArithAndMathToAPFloat/CMakeFiles/obj.MLIRArithToAPFloat.dir/ArithToAPFloat.cpp.o
[5328/8429] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.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/Analysis/IndirectCallPromotionAnalysis.h:16,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/Transforms/IPO/MemProfContextDisambiguation.h:18,
                 from /home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/lib/LTO/LTO.cpp:60:
/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’:

Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Jan 18, 2026
This PR adds vector type support to `math-to-apfloat`.
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Jan 18, 2026
BStott6 pushed a commit to BStott6/llvm-project that referenced this pull request Jan 22, 2026
This PR adds vector type support to `math-to-apfloat`.
BStott6 pushed a commit to BStott6/llvm-project that referenced this pull request Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants