broadcom/compiler: return early for SFU op latency calculation
authorIago Toral Quiroga <itoral@igalia.com>
Tue, 25 Apr 2023 07:32:27 +0000 (09:32 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Tue, 25 Apr 2023 09:15:34 +0000 (11:15 +0200)
Since we are returning a fixed latency for these check for them
earlier and return early if they match.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22675>

src/broadcom/compiler/qpu_schedule.c

index 9061d2e..1b0d214 100644 (file)
@@ -1460,6 +1460,9 @@ instruction_latency(const struct v3d_device_info *devinfo,
             after_inst->type != V3D_QPU_INSTR_TYPE_ALU)
                 return latency;
 
+        if (v3d_qpu_instr_is_sfu(before_inst))
+                return 2;
+
         if (before_inst->alu.add.op != V3D_QPU_A_NOP &&
             before_inst->alu.add.magic_write) {
                 latency = MAX2(latency,
@@ -1476,9 +1479,6 @@ instruction_latency(const struct v3d_device_info *devinfo,
                                                    after_inst));
         }
 
-        if (v3d_qpu_instr_is_sfu(before_inst))
-                return 2;
-
         return latency;
 }