[Mlir-commits] [mlir] b272709 - [mlir][math] Add VectorDialect dependency to MathToAPFloatConversion (#206212)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Jun 27 01:13:40 PDT 2026
Author: Longsheng Mou
Date: 2026-06-27T16:13:35+08:00
New Revision: b2727090b2de181c00568c0324f04c3821ee996f
URL: https://github.com/llvm/llvm-project/commit/b2727090b2de181c00568c0324f04c3821ee996f
DIFF: https://github.com/llvm/llvm-project/commit/b2727090b2de181c00568c0324f04c3821ee996f.diff
LOG: [mlir][math] Add VectorDialect dependency to MathToAPFloatConversion (#206212)
Explicitly load VectorDialect as a dependent dialect in
MathToAPFloatConversionPass to avoid unregistered dialect errors when
generating vector ops. Fixes #206093.
Added:
Modified:
mlir/include/mlir/Conversion/Passes.td
mlir/test/Conversion/ArithAndMathToAPFloat/math-to-apfloat.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Conversion/Passes.td b/mlir/include/mlir/Conversion/Passes.td
index 340ff8fdf2a8a..b92bc1cd31723 100644
--- a/mlir/include/mlir/Conversion/Passes.td
+++ b/mlir/include/mlir/Conversion/Passes.td
@@ -828,7 +828,11 @@ def MathToAPFloatConversionPass
calls (APFloatWrappers.cpp). APFloat is a software implementation of
floating-point mathmetic operations.
}];
- let dependentDialects = ["math::MathDialect", "func::FuncDialect"];
+ let dependentDialects = [
+ "math::MathDialect",
+ "func::FuncDialect",
+ "vector::VectorDialect"
+ ];
}
//===----------------------------------------------------------------------===//
diff --git a/mlir/test/Conversion/ArithAndMathToAPFloat/math-to-apfloat.mlir b/mlir/test/Conversion/ArithAndMathToAPFloat/math-to-apfloat.mlir
index e52eb5866093c..2fe1d0cda1e38 100644
--- a/mlir/test/Conversion/ArithAndMathToAPFloat/math-to-apfloat.mlir
+++ b/mlir/test/Conversion/ArithAndMathToAPFloat/math-to-apfloat.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt %s --convert-math-to-apfloat | FileCheck %s
+// RUN: mlir-opt %s --convert-math-to-apfloat -split-input-file | FileCheck %s
func.func @full_example() {
%neg14fp8 = arith.constant -1.4 : f8E4M3FN
@@ -64,3 +64,17 @@ func.func @full_example() {
// CHECK: %[[VAL_5:.*]] = call @_mlir_apfloat_isfinite(%[[CONSTANT_9]], %[[EXTUI_7]]) : (i32, i64) -> i1
// CHECK: return
// CHECK: }
+
+// -----
+
+// Ensure the Vector dialect is registered.
+
+// CHECK-LABEL: func @test_vector(
+// CHECK: vector.to_elements
+func.func @test_vector() {
+ %a1_vec = arith.constant dense<[2.0, 2.0, 2.0, 2.0]> : vector<4xf8E4M3FN>
+ %b1_vec = arith.constant dense<[4.0, 4.0, 4.0, 4.0]> : vector<4xf8E4M3FN>
+ %c1_vec = arith.constant dense<[8.0, 8.0, 8.0, 8.0]> : vector<4xf8E4M3FN>
+ %d1_vec = math.fma %a1_vec, %b1_vec, %c1_vec : vector<4xf8E4M3FN>
+ return
+}
More information about the Mlir-commits
mailing list