[all-commits] [llvm/llvm-project] 10b56e: [mlir][Arith] Add pass for emulating unsupported f...
Krzysztof Drewniak via All-commits
all-commits at lists.llvm.org
Tue Jul 11 13:32:50 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 10b56e0210bf615519570f561acbeb916db032f4
https://github.com/llvm/llvm-project/commit/10b56e0210bf615519570f561acbeb916db032f4
Author: Krzysztof Drewniak <Krzysztof.Drewniak at amd.com>
Date: 2023-07-11 (Tue, 11 Jul 2023)
Changed paths:
M mlir/include/mlir/Dialect/Arith/Transforms/Passes.h
M mlir/include/mlir/Dialect/Arith/Transforms/Passes.td
M mlir/lib/Dialect/Arith/Transforms/CMakeLists.txt
A mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp
A mlir/test/Dialect/Arith/emulate-unsupported-floats.mlir
Log Message:
-----------
[mlir][Arith] Add pass for emulating unsupported float ops (#1079)
To complement the bf16 expansion and truncation patterns added to
ExpandOps, define a pass that replaces, for any arithmetic operation
op,
%y = arith.op %v0, %v1, ... : T
with
%e0 = arith.expf %v0 : T to U
%e1 = arith.expf %v1 : T to U
...
%y.exp = arith.op %e0, %e1, ... : U
%y = arith.truncf %y.exp : U to T
This allows for "emulating" floating-point operations not supported on
a given target (such as bfloat operations or most arithmetic on 8-bit
floats) by extending those types to supported ones, performing the
arithmetic operation, and then truncating back to the original
type (which ensures appropriate rounding behavior).
The lowering of the extf and truncf ops introduced by this
transformation should be handled by subsequent passes.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D154539
More information about the All-commits
mailing list