Skip to content

Draft: nir: split ffma

Karol Herbst requested to merge karolherbst/mesa:nir_ffma_split into main

This will allow us to track better the intent of the original source and enable more optimizations depending on hardware support.

Also this will be useful for OpenCL where the spec requires ffma to be fused and a * b + c to be unfused except -cl-mad-enable was added to the compiler options.

TODOS:

  • in glsl_to_nir we should emit nir_op_fmad for hardware without nir_op_ffma support for fma.
  • wire up nir_op_fmad in more drivers supporting it.
  • Find solution for drivers wanting to support neither, but keep nir_op_ffma around
  • Find solution for drivers having both, but has a strong preference on one. E.g. nir_op_fmad being faster on some AMD hardware.
  • Splitting up nir_op_ffma first doing optimizations and merging it back can result in better codegen.
Edited by Karol Herbst

Merge request reports