Mesa (main): aco: create v_fmamk_f32/v_fmaak_f32 from nir_op_ffma

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Dec 13 12:36:37 UTC 2021


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Jun 16 18:04:21 2020 +0100

aco: create v_fmamk_f32/v_fmaak_f32 from nir_op_ffma

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9805>

---

 src/amd/compiler/aco_optimizer.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index b93532c2291..548b9e0c4ae 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -3559,6 +3559,13 @@ combine_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
       }
    } else if (instr->opcode == aco_opcode::v_and_b32) {
       combine_and_subbrev(ctx, instr);
+   } else if (instr->opcode == aco_opcode::v_fma_f32 || instr->opcode == aco_opcode::v_fma_f16) {
+      /* set existing v_fma_f32 with label_mad so we can create v_fmamk_f32/v_fmaak_f32.
+       * since ctx.uses[mad_info::mul_temp_id] is always 0, we don't have to worry about
+       * select_instruction() using mad_info::add_instr.
+       */
+      ctx.mad_infos.emplace_back(nullptr, 0);
+      ctx.info[instr->definitions[0].tempId()].set_mad(instr.get(), ctx.mad_infos.size() - 1);
    } else {
       aco_opcode min, max, min3, max3, med3;
       bool some_gfx9_only;



More information about the mesa-commit mailing list