[llvm] [NVPTX] Custom lower integer<->bf16 conversions for sm_80 (PR #74827)
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 11 11:37:51 PST 2023
================
@@ -2580,6 +2586,37 @@ SDValue NVPTXTargetLowering::LowerFROUND64(SDValue Op,
return DAG.getNode(ISD::SELECT, SL, VT, IsLarge, A, RoundedA);
}
+SDValue NVPTXTargetLowering::LowerINT_TO_FP(SDValue Op,
+ SelectionDAG &DAG) const {
+ // sm_90 has instructions for bf16 conversions, sm_80 only has f32 -> bf16.
+ if (Op.getValueType() == MVT::bf16 &&
+ (STI.getSmVersion() < 90 || STI.getPTXVersion() < 78)) {
+ SDLoc Loc(Op);
+ return DAG.getNode(
+ ISD::FP_ROUND, Loc, MVT::bf16,
----------------
d0k wrote:
`BF16_TO_FP` is a bit of an odd beast that's only used during legalization. We can't use it here because it's not a legal op. I would be really surprised if the SASS is different.
https://github.com/llvm/llvm-project/pull/74827
More information about the llvm-commits
mailing list