broadcom/compiler: add a NOP count stat to shader-db

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9918>
This commit is contained in:
Iago Toral Quiroga
2021-03-30 11:48:10 +02:00
committed by Marge Bot
parent 062eee7d33
commit f33ca092da
5 changed files with 25 additions and 2 deletions

View File

@@ -760,6 +760,7 @@ struct v3d_compile {
uint32_t qpu_inst_count; uint32_t qpu_inst_count;
uint32_t qpu_inst_size; uint32_t qpu_inst_size;
uint32_t qpu_inst_stalled_count; uint32_t qpu_inst_stalled_count;
uint32_t nop_count;
/* For the FS, the number of varying inputs not counting the /* For the FS, the number of varying inputs not counting the
* point/line varyings payload * point/line varyings payload

View File

@@ -1238,7 +1238,7 @@ int v3d_shaderdb_dump(struct v3d_compile *c,
return asprintf(shaderdb_str, return asprintf(shaderdb_str,
"%s shader: %d inst, %d threads, %d loops, " "%s shader: %d inst, %d threads, %d loops, "
"%d uniforms, %d max-temps, %d:%d spills:fills, " "%d uniforms, %d max-temps, %d:%d spills:fills, "
"%d sfu-stalls, %d inst-and-stalls", "%d sfu-stalls, %d inst-and-stalls, %d nops",
vir_get_stage_name(c), vir_get_stage_name(c),
c->qpu_inst_count, c->qpu_inst_count,
c->threads, c->threads,
@@ -1248,7 +1248,8 @@ int v3d_shaderdb_dump(struct v3d_compile *c,
c->spills, c->spills,
c->fills, c->fills,
c->qpu_inst_stalled_count, c->qpu_inst_stalled_count,
c->qpu_inst_count + c->qpu_inst_stalled_count); c->qpu_inst_count + c->qpu_inst_stalled_count,
c->nop_count);
} }
uint64_t *v3d_compile(const struct v3d_compiler *compiler, uint64_t *v3d_compile(const struct v3d_compiler *compiler,

View File

@@ -425,6 +425,9 @@ v3d_vir_to_qpu(struct v3d_compile *c, struct qpu_reg *temp_registers)
c->compilation_result = V3D_COMPILATION_FAILED; c->compilation_result = V3D_COMPILATION_FAILED;
return; return;
} }
if (v3d_qpu_is_nop(&inst->qpu))
c->nop_count++;
} }
assert(i == c->qpu_inst_count); assert(i == c->qpu_inst_count);

View File

@@ -22,6 +22,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "util/macros.h" #include "util/macros.h"
#include "broadcom/common/v3d_device_info.h" #include "broadcom/common/v3d_device_info.h"
#include "qpu_instr.h" #include "qpu_instr.h"
@@ -1017,3 +1018,19 @@ v3d_qpu_unpacks_f16(const struct v3d_qpu_instr *inst)
return false; return false;
} }
bool
v3d_qpu_is_nop(struct v3d_qpu_instr *inst)
{
static const struct v3d_qpu_sig nosig = { 0 };
if (inst->type != V3D_QPU_INSTR_TYPE_ALU)
return false;
if (inst->alu.add.op != V3D_QPU_A_NOP)
return false;
if (inst->alu.mul.op != V3D_QPU_M_NOP)
return false;
if (memcmp(&inst->sig, &nosig, sizeof(nosig)))
return false;
return true;
}

View File

@@ -479,4 +479,5 @@ bool v3d_qpu_sig_writes_address(const struct v3d_device_info *devinfo,
bool v3d_qpu_unpacks_f32(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST; bool v3d_qpu_unpacks_f32(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST;
bool v3d_qpu_unpacks_f16(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST; bool v3d_qpu_unpacks_f16(const struct v3d_qpu_instr *inst) ATTRIBUTE_CONST;
bool v3d_qpu_is_nop(struct v3d_qpu_instr *inst) ATTRIBUTE_CONST;
#endif #endif