[Mlir-commits] [mlir] [mlir][arith] Fold scaling_extf and scaling_truncf with constant operands (PR #215123)

曾鈜寬 Tseng Hung Kuan llvmlistbot at llvm.org
Sun Aug 9 11:02:18 PDT 2026


Tim096 wrote:

@umangyadav (you introduced these ops in #141965) and @kuhar — could you take a look?

One decision is worth flagging, because it is the part I am least sure about. The folder only fires when the scale already has element type `f8E8M0FNU`. Wider scales are accepted by both lowerings but interpreted differently: `-arith-expand` truncates the scale to `f8E8M0FNU` first, while `ArithToAMDGPU` reads its exponent field, so for `scale = 1.6 : f16` they produce 2.0 and 1.0 respectively. I did not want a folder to settle that, but if one of the two is the intended semantics, say so and I will extend the fold to cover it.

The other thing to know when reading the NaN path: widening a `f8E8M0FNU` NaN currently produces a value that is a NaN but is encoded as an infinity (#214919). Any arithmetic on it quiets the NaN and repairs the encoding, which is why the expansion still reaches a NaN today, so this PR does not depend on that fix landing — it just does not rely on the repair.

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


More information about the Mlir-commits mailing list