diff --git a/mlir/include/mlir/IR/BuiltinAttributes.td b/mlir/include/mlir/IR/BuiltinAttributes.td index 433c33521a7a..45214535b1f8 100644 --- a/mlir/include/mlir/IR/BuiltinAttributes.td +++ b/mlir/include/mlir/IR/BuiltinAttributes.td @@ -406,7 +406,7 @@ def Builtin_FloatAttr : Builtin_Attr<"Float"> { return $_get(type.getContext(), type, value); }]>, AttrBuilderWithInferredContext<(ins "Type":$type, "double":$value), [{ - if (type.isF64()) + if (type.isF64() || !type.isa()) return $_get(type.getContext(), type, APFloat(value)); // This handles, e.g., F16 because there is no APFloat constructor for it.