[Mlir-commits] [mlir] [mlir][tosa] Add F32 to F16 type narrowing pass (PR #218900)

Luke Hutton llvmlistbot at llvm.org
Thu Sep 3 06:50:08 PDT 2026


================
@@ -458,11 +500,39 @@ class ConvertGenericOp : public ConversionPattern {
           "Support for operations other than TOSA has not been implemented.");
 
     return convertGenericOp<Kind>(op, operands, rewriter, typeConverter,
-                                  allowLossyConversion);
+                                  allowLossyConversion, convertAccumulatorType);
   }
 
 private:
   const bool allowLossyConversion;
+  const bool convertAccumulatorType;
+};
+
+template <TosaNarrowKind Kind>
+class ConvertAccumulatorTypeOp : public ConversionPattern {
----------------
lhutton1 wrote:

This appears to be used when `aggressiveRewrite=false` and therefore the `ConvertGenericOp` pattern is not present. When `aggressiveRewrite=false` I think we'd need to do some additional bounds checking to make sure that narrowing the accumulator type is safe. For now, I think it's better to leave this functionality out of the pass and not try to narrow the accumulator type when `aggressiveRewrite=false`

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


More information about the Mlir-commits mailing list