Mesa (master): freedreno/ir3: also track # of nops for shader-db

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Nov 9 03:07:48 UTC 2019


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Mon Nov  4 11:41:55 2019 -0800

freedreno/ir3: also track # of nops for shader-db

The instruction count is (mostly) a measure of what optimization passes
can do, while # of nops is more an indication of how effectively the
scheduler is balancing register pressure vs instruction count.  So track
these independently.

(There could be opportunities to rematerialize values to reduce register
pressure, swapping some nop's with other alu instructions, so nothing is
truely independent.. but it is still useful to break these stats out.)

Signed-off-by: Rob Clark <robdclark at chromium.org>

---

 src/freedreno/ir3/ir3.c                         | 3 +++
 src/freedreno/ir3/ir3.h                         | 1 +
 src/gallium/drivers/freedreno/ir3/ir3_gallium.c | 4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c
index a0a2dcbd805..2d2c7f591fc 100644
--- a/src/freedreno/ir3/ir3.c
+++ b/src/freedreno/ir3/ir3.c
@@ -922,6 +922,9 @@ void * ir3_assemble(struct ir3 *shader, struct ir3_info *info,
 			if (ret)
 				goto fail;
 			info->instrs_count += 1 + instr->repeat + instr->nop;
+			info->nops_count += instr->nop;
+			if (instr->opc == OPC_NOP)
+				info->nops_count += 1 + instr->repeat;
 			dwords += 2;
 
 			if (instr->flags & IR3_INSTR_SS)
diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h
index 17c4178d963..e1ec7579341 100644
--- a/src/freedreno/ir3/ir3.h
+++ b/src/freedreno/ir3/ir3.h
@@ -47,6 +47,7 @@ struct ir3_info {
 	uint32_t gpu_id;
 	uint16_t sizedwords;
 	uint16_t instrs_count;   /* expanded to account for rpt's */
+	uint16_t nops_count;     /* # of nop instructions, including nopN */
 	/* NOTE: max_reg, etc, does not include registers not touched
 	 * by the shader (ie. vertex fetched via VFD_DECODE but not
 	 * touched by shader)
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
index 8b329687978..8d77c7357c3 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
@@ -51,11 +51,13 @@ dump_shader_info(struct ir3_shader_variant *v, bool binning_pass,
 		return;
 
 	pipe_debug_message(debug, SHADER_INFO,
-			"%s shader: %u inst, %u dwords, "
+			"%s shader: %u inst, %u nops, %u non-nops, %u dwords, "
 			"%u half, %u full, %u constlen, "
 			"%u (ss), %u (sy), %d max_sun, %d loops\n",
 			ir3_shader_stage(v),
 			v->info.instrs_count,
+			v->info.nops_count,
+			v->info.instrs_count - v->info.nops_count,
 			v->info.sizedwords,
 			v->info.max_half_reg + 1,
 			v->info.max_reg + 1,




More information about the mesa-commit mailing list