[all-commits] [llvm/llvm-project] 8b46b9: AMDGPU: Fix the double rounding issue in v2f64 -> ...

Changpeng Fang via All-commits all-commits at lists.llvm.org
Thu Apr 17 11:16:11 PDT 2025


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

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp
    M llvm/lib/Target/AMDGPU/SIISelLowering.cpp
    M llvm/test/CodeGen/AMDGPU/fptrunc.f16.ll
    A llvm/test/CodeGen/AMDGPU/fptrunc.v2f16.fpmath.ll

  Log Message:
  -----------
  AMDGPU: Fix the double rounding issue in v2f64 -> v2f16 conversion (#135659)

On targets that support v_cvt_pk_f16_f32 instruction, if we make v2f64
-> v2f16 Legal, we will generate the following sequence of instructions:
  v_cvt_f32_f64_e32 v1, s[6:7]
  v_cvt_f32_f64_e32 v2, s[4:5]
  v_cvt_pk_f16_f32 v1, v2, v1
It possibly returns imprecise results due to double rounding. This patch
fixes the issue by not setting the conversion Legal. While we may still
expect the above sequence of code when unsafe fpmath is set, I hope
https://github.com/llvm/llvm-project/pull/134738 can address that
performance concern.

Fixes: SWDEV-523856



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