bf16 has a trivial truncation/extension behavior with F32 that
can be described in elementary arith operations. Include some
expansions to efficiently convert.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
LG to me, and optionally done via populate, I'm not sure if always good idea vs letting lower level codegen handle it (seems direct). But given not supported on all backends, SGTM.
mlir/include/mlir/Dialect/Arith/Transforms/Passes.h | ||
---|---|---|
41 | to lower level bitcasts and shifts ? (something useful, is not too descriptive). |
I agree. It does not appear that anything depends on the pass specifically and we should be able to integrate via the populate command.
mlir/lib/Dialect/Arith/Transforms/ExpandOps.cpp | ||
---|---|---|
223 | Sorry for being late, but this expansion is simply incorrect. converting from f32 to bf16 needs a rounding step. Can this pattern be removed or at least pulled out into an opt-in pass. Having it on by default just gives us incorrect results. |
to lower level bitcasts and shifts ?
(something useful, is not too descriptive).