[all-commits] [llvm/llvm-project] 1794ef: [mlir][xevm] Fold xevm.truncf of an xevm.extf roun...

Sang Ik Lee via All-commits all-commits at lists.llvm.org
Thu Sep 24 08:06:50 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1794efe8f33a965e55c1f532c88949cfcc152c1d
      https://github.com/llvm/llvm-project/commit/1794efe8f33a965e55c1f532c88949cfcc152c1d
  Author: Sang Ik Lee <sang.ik.lee at intel.com>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/XeVMOps.td
    M mlir/lib/Dialect/LLVMIR/IR/XeVMDialect.cpp
    A mlir/test/Dialect/LLVMIR/xevm-canonicalize.mlir

  Log Message:
  -----------
  [mlir][xevm] Fold xevm.truncf of an xevm.extf round trip (#225875)

A xevm.extf followed by a xevm.truncf through the same pair of formats
returns the value it started from, so the pair can be dropped. Fold it
on the truncf, the way arith::TruncFOp::fold recognizes truncf(extf(a)),
and gate it on APFloatBase::isLosslesslyConvertibleTo of the two formats
the element type attributes stand for.

That gate excludes bf8: it is IEEE-like, so extending a signaling NaN
quiets it and the original value cannot be recovered, which is the same
reason arith does not fold an f8E5M2 round trip. f8 (E4M3, NaN only) and
e2m1 (finite only) do fold.

Mark both ops Pure so the extf left without users is removed and the
pair folds to nothing.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list