[Mlir-commits] [mlir] [MLIR][Math] add canonicalize-f32-promotion pass (PR #92482)

Ivy Zhang llvmlistbot at llvm.org
Wed May 22 07:58:46 PDT 2024


crazydemo wrote:

> Re bf16 ... one change I've wanted to make is to (factoring some logic out of arith-emulate-unsuoported-floats) let callers of this pass allowlist some short types. That is, I'd want to let people legalize all the short types except f16 ... or all the short types except f16 and b16 and so on
> 
> Maybe that'd help your usecase?
> 
> I'm opposed to trying to hardcore a list of f16 supported ops because that's target-dependent

Currently, I am focusing on `bf16 legalization`, and may extend to `fp16 legalization` in future. With the current `legalize-to-f32` pass, only `math ops` can be legalized to f32, while `arith ops`, like `arith::AddFOp` will not be legalized, but it needs to be promoted for computing. I think we can at least expand the current op list to support my usecase. 

And as you are focusing on shorter types, I think we have no conflicts in implementing. I think hard code a list of f16 supported ops is reasonable after the target description is ready in MLIR. Here's an [RFC](https://discourse.llvm.org/t/rfc-target-description-and-cost-model-in-mlir/76990) about adding target description into MLIR. 

@ZhennanQin 

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


More information about the Mlir-commits mailing list