Mesa (main): nouveau/nir: Don't try to emit OP_FMA pre-nvc0.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 14 13:13:30 UTC 2022


Module: Mesa
Branch: main
Commit: b62087e069c4b5e9738d753c8c03cad2f3085d4f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b62087e069c4b5e9738d753c8c03cad2f3085d4f

Author: Emma Anholt <emma at anholt.net>
Date:   Fri Mar 25 21:06:35 2022 -0700

nouveau/nir: Don't try to emit OP_FMA pre-nvc0.

The TGSI backend avoids TGSI_OPCODE_FMA (and thus OP_FMA) pre-nvc0,
replacing it with TGSI_OPCODE_MAD in that case.

Noticed when looking at native-NIR stats and finding that load
optimization wasn't taking place on the unsupported opcode.

Reviewed-by: Karol Herbst <kherbst at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15543>

---

 src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index 4c5e3261d7a..f9703fe7cde 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -433,6 +433,9 @@ Converter::getOperation(nir_op op)
    case nir_op_ffloor:
       return OP_FLOOR;
    case nir_op_ffma:
+      /* No FMA op pre-nvc0 */
+      if (info->target < 0xc0)
+         return OP_MAD;
       return OP_FMA;
    case nir_op_flog2:
       return OP_LG2;



More information about the mesa-commit mailing list