[PATCH] D85911: libclc: spirv: Add various functions

Jesse Natalie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 08:53:19 PDT 2020


jenatali added a comment.

In D85911#2247484 <https://reviews.llvm.org/D85911#2247484>, @daniels wrote:

> In D85911#2247480 <https://reviews.llvm.org/D85911#2247480>, @jvesely wrote:
>
>> Why does this need a special implementation of fma.cl and fma.inc? The fp64 paths are missing, is there an expectation that something else will translate `fma(double)` function calls to `llvm.fma` opcodes?
>
> D85910 <https://reviews.llvm.org/D85910> should explain it: if we have precise hardware fma (e.g. on NV hardware) we want to be able to pass through to the hardware opcode, but if not we need to fall back to the slow & huge (but precise) software implementation. We want to expose which is in use back into libclc, so e.g. sin/cos can generate better code when using the software variant.

To clarify further, we specifically need a way to access the 32-bit software fma. We could've just used `__clc_sw_fma()` directly, but that seemed like an inappropriate symbol to take a hard external dependency on. Instead, we expose only the overloads of the `fma()` function which have implementations, rather than mapping to intrinsics/opcodes. Since the SPIR-V conversion converts all calls to `fma()` into opcodes already, we only want to back-translate real code. Calls to LLVM intrinsics will fail to translate to SPIR-V.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85911



More information about the llvm-commits mailing list