[libc-commits] [PATCH] D152923: [libc] Add support for FMA in the GPU utilities

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Jun 14 09:14:06 PDT 2023


jhuber6 added a comment.

In D152923#4421453 <https://reviews.llvm.org/D152923#4421453>, @arsenm wrote:

>> These may not have strict compliance
>
> I expect every FMA instruction in existence to be strictly compliant. There's not even errno to worry about. For AMDGPU FP exceptions should even work with strictfp

May be misusing terminology here, they are definitely compliant with IEEE, but maybe not with `libc`'s desire for all math to be correct under every rounding mode. I don't have a complete understanding of the requirements or desires here from the `libc` team.

Could you explain `strictfp` here? I've never encountered it in AMDGPU.



================
Comment at: libc/src/__support/FPUtil/gpu/FMA.h:13-15
+// For AMDGPU these will map to instructions with 0.5 ULP accuracy. The NVPTX
+// implementation performs this operation at infinite precision and then rounds
+// to the nearest even value.
----------------
arsenm wrote:
> The NVPTX description sounds like you're just describing what FMA is
NVPTX has different versions for all the rounding modes, AFAICT `__builtin_fma` maps to the round to nearest version while AMDGPU has no such facilities. So I'm assuming that this doesn't work "correctly" if the user changes the rounding mode, but it's unlikely we'd want to support that on the GPU much.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152923/new/

https://reviews.llvm.org/D152923



More information about the libc-commits mailing list