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

Luke Hutton llvmlistbot at llvm.org
Fri Sep 4 02:57:10 PDT 2026


================
@@ -689,9 +761,15 @@ LogicalResult runTosaNarrowing(Operation *op, bool aggressiveRewrite,
 
   ConversionTarget target(*context);
   target.addDynamicallyLegalDialect<tosa::TosaDialect>(
-      [&typeConverter](Operation *op) {
-        return typeConverter.isLegal(op->getResultTypes()) &&
-               typeConverter.isLegal(op->getOperandTypes());
+      [&typeConverter, convertAccumulatorType](Operation *op) {
+        if (!typeConverter.isLegal(op->getResultTypes()) ||
----------------
lhutton1 wrote:

When writing the original implementation of this pass I was unsure what the expected behaviour should be. IIRC I opted for `applyFullConversion` as it came with the least amount of surprise. AFAIK, there aren't many users of the `aggressiveRewrite=false` option right now, but I can see why a partial conversion may make sense for some use-cases. Overall, I suspect it would be valuable to let the user decide by exposing an option such as `requireFullConversion`.

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


More information about the Mlir-commits mailing list