[Mlir-commits] [mlir] [mlir] [arith] Fold trunc(extremum(ext(lhs), ext(rhs))) (PR #214658)

Chuanqi Xu llvmlistbot at llvm.org
Fri Aug 7 02:41:57 PDT 2026


ChuanqiXu9 wrote:

> > I was told this may be intentional as some old hardware doesn't have instructions to deal with maximum with fp16. But I think in the higher level we should do such optimizations. And specific hardware can make their own transformations according to their specific details.
> 
> It's not that simple. If you add this to the canonical folding, it will always end up folded. If a particular hardware pass _creates_ that pattern because it doesn't support BF16 MAX, it will be reversed in the first canonicalization pass.

I was thinking LLVM will handle that. I didn't image the pattern matcher will rely that.

If we don't want this to be a canonicalization, how do you think about to make this a populate*Patterns API? Or make this a pass?

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


More information about the Mlir-commits mailing list