[libclc] [libclc] Use float sw_fma for spirv*-mesa-mesa3d targets (PR #199626)

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue May 26 05:59:48 PDT 2026


jhuber6 wrote:

> I think there is a misunderstanding. We don't need fma implemented as a software fma.
> 
> We need an exported function that we can use for devices that do not have native fma.
> 
> Inside mesa we have logic to control whether `OpFmaKHR` or the `Fma` OpenCL extended instruction is implemented as a native hardware instruction or emulated in software.
> 
> It's fine for the SPIR-V binary to end up with those opcodes. What is the problem is, that the software implementation isn't available inside the SPIR-V anymore.

Shouldn't lowering FMA properly be the backend's job? I'm curious why we cannot simply call a single FMA function and have the target decide if it can be implemented natively or in software. https://godbolt.org/z/5qodxY3vM

https://github.com/llvm/llvm-project/pull/199626


More information about the cfe-commits mailing list