[Mlir-commits] [mlir] Add arith expansion of f8E8M0 type for extf/trunc ops (PR #140332)
Krzysztof Drewniak
llvmlistbot at llvm.org
Wed May 21 14:54:32 PDT 2025
================
@@ -353,20 +448,34 @@ struct ArithExpandOpsPass
if (includeBf16) {
arith::populateExpandBFloat16Patterns(patterns);
- target.addDynamicallyLegalOp<arith::ExtFOp>(
- [](arith::ExtFOp op) {
- Type inETy = getElementTypeOrSelf(op.getOperand().getType());
- Type outETy = getElementTypeOrSelf(op.getType());
- return !(inETy.isBF16() && outETy.isF32());
- });
-
- target.addDynamicallyLegalOp<arith::TruncFOp>(
- [](arith::TruncFOp op) {
- Type inETy = getElementTypeOrSelf(op.getOperand().getType());
- Type outETy = getElementTypeOrSelf(op.getType());
- return !(inETy.isF32() && outETy.isBF16());
- });
}
+ if (includeF8E8M0) {
+ arith::populateExpandF8E8M0Patterns(patterns);
+ }
+
+ target.addDynamicallyLegalOp<arith::ExtFOp>(
+ [=](arith::ExtFOp op) {
+ Type inETy = getElementTypeOrSelf(op.getOperand().getType());
+ Type outETy = getElementTypeOrSelf(op.getType());
+ bool legalTypes = true;
+ if(includeBf16)
----------------
krzysz00 wrote:
Nit re space between `if` and the condition - surprised clang-format doesn't catch this
https://github.com/llvm/llvm-project/pull/140332
More information about the Mlir-commits
mailing list