summaryrefslogtreecommitdiffstats
path: root/src/broadcom/qpu/qpu_instr.c
diff options
context:
space:
mode:
authorJose Maria Casanova Crespo <[email protected]>2019-07-02 18:31:09 +0200
committerJose Maria Casanova Crespo <[email protected]>2019-07-22 03:00:50 +0200
commitc341ab7ffbac822d3d3cbb3d3ae9d2a19ea3cc9a (patch)
tree70eba195aec80c8ba4d6f0f721fd957b386e933f /src/broadcom/qpu/qpu_instr.c
parentf7224014df0d366453739356b9968ca94ad43979 (diff)
v3d: add shader-db stat to count SFU stalls
SFU operations have a latency of 2 cicles, so if their results are used in the following cycle to a SFU instruction, the GPU stalls for an extra cycle until the result is available. This adds the number of stalls to the shader-db debug mode and sum of instruction + stalls to evaluate optimizations to schedule instructions that avoid generating sfu-stalls. v2: Rename v3d_qpu_generates_sfu_stalls to v3d_qpu_instr_is_sfu (Eric) Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/broadcom/qpu/qpu_instr.c')
-rw-r--r--src/broadcom/qpu/qpu_instr.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/broadcom/qpu/qpu_instr.c b/src/broadcom/qpu/qpu_instr.c
index 66e53a6accd..09d06b3fa3e 100644
--- a/src/broadcom/qpu/qpu_instr.c
+++ b/src/broadcom/qpu/qpu_instr.c
@@ -645,19 +645,10 @@ v3d_qpu_uses_tlb(const struct v3d_qpu_instr *inst)
bool
v3d_qpu_uses_sfu(const struct v3d_qpu_instr *inst)
{
- if (inst->type == V3D_QPU_INSTR_TYPE_ALU) {
- switch (inst->alu.add.op) {
- case V3D_QPU_A_RECIP:
- case V3D_QPU_A_RSQRT:
- case V3D_QPU_A_EXP:
- case V3D_QPU_A_LOG:
- case V3D_QPU_A_SIN:
- case V3D_QPU_A_RSQRT2:
- return true;
- default:
- break;
- }
+ if (v3d_qpu_instr_is_sfu(inst))
+ return true;
+ if (inst->type == V3D_QPU_INSTR_TYPE_ALU) {
if (inst->alu.add.magic_write &&
v3d_qpu_magic_waddr_is_sfu(inst->alu.add.waddr)) {
return true;
@@ -673,6 +664,25 @@ v3d_qpu_uses_sfu(const struct v3d_qpu_instr *inst)
}
bool
+v3d_qpu_instr_is_sfu(const struct v3d_qpu_instr *inst)
+{
+ if (inst->type == V3D_QPU_INSTR_TYPE_ALU) {
+ switch (inst->alu.add.op) {
+ case V3D_QPU_A_RECIP:
+ case V3D_QPU_A_RSQRT:
+ case V3D_QPU_A_EXP:
+ case V3D_QPU_A_LOG:
+ case V3D_QPU_A_SIN:
+ case V3D_QPU_A_RSQRT2:
+ return true;
+ default:
+ return false;
+ }
+ }
+ return false;
+}
+
+bool
v3d_qpu_writes_tmu(const struct v3d_qpu_instr *inst)
{
return (inst->type == V3D_QPU_INSTR_TYPE_ALU &&