[all-commits] [llvm/llvm-project] f47034: AMDGPU: Add round-to-odd rounding during f64 to bf...

Changpeng Fang via All-commits all-commits at lists.llvm.org
Fri Apr 4 21:20:05 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f47034cbe5c02b748742c733cf453b3b907687e5
      https://github.com/llvm/llvm-project/commit/f47034cbe5c02b748742c733cf453b3b907687e5
  Author: Changpeng Fang <changpeng.fang at amd.com>
  Date:   2025-04-04 (Fri, 04 Apr 2025)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIISelLowering.cpp
    M llvm/lib/Target/AMDGPU/VOP3Instructions.td
    M llvm/test/CodeGen/AMDGPU/bf16-conversions.ll

  Log Message:
  -----------
  AMDGPU: Add round-to-odd rounding during f64 to bf16 conversion (#133995)

f64 -> bf16 conversion can be lowered to f64 -> f32 followed by f32 ->
bf16:
   v_cvt_f32_f64_e32 v0, v[0:1]
   v_cvt_pk_bf16_f32 v0, v0, s0
Both conversion instructions will do round-to-even rounding, and thus we
will have double rounding issue which may generate incorrect result in
some data range. We need to add round-to-odd rounding during f64 -> f32
to avoid double rounding,.

NOTE: we are having the same issue with f64 -> f16 conversion. Will add
round-to-odd rounding for it in a separate patch, which fixes
SWDEV-523856

---------

Co-authored-by: Matt Arsenault <arsenm2 at gmail.com>



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