[libc-commits] [PATCH] D152486: [libc] Begin implementing a 'libmgpu.a' for math on the GPU

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Jun 9 06:51:04 PDT 2023


jhuber6 added a comment.

In D152486#4408610 <https://reviews.llvm.org/D152486#4408610>, @JonChesterfield wrote:

> @Joseph I'd really like us to be able to get rid of the header files that currently do the remapping from libm calls to the vendor ones. Have you spoken to the hip / cuda / openmp people to see if any of them are in principle willing to part with the current header translation thing?

Killing off the headers would be ideal, as it stands there are a few deficiencies in this approach.

- This currently relies on a build-time dependency on `libdevice.10.bc` or `ocml.bc` for the best support. We can link it late with the support in D152442 <https://reviews.llvm.org/D152442> but currently that's an opt-in thing currently because it will result in longer compile times. Ideally we would have the files we need in a binary blob upstream somewhere or we implement the math functions without relying on them.
- We don't handle special-case math optimizations that the vendors have. The headers allow us at compile time to select `-ffast-math` variants from `libdevice.10.bc` or to enable the controls for things like `__oclc_unsafe_math_opt`
- The NVPTX backend currently cannot codegen the math intrinsics so we'll need to fix that before this can be used.
- Obviously this requires building the `libc` project which would then need to be a mandatory thing for math if we remove the headers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152486



More information about the libc-commits mailing list