Mesa (main): r300: report number of loops in shader statistics

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Feb 24 21:41:11 UTC 2022


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

Author: Pavel Ondračka <pavel.ondracka at gmail.com>
Date:   Fri Feb 18 09:32:00 2022 +0100

r300: report number of loops in shader statistics

Signed-off-by: Pavel Ondračka <pavel.ondracka at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15077>

---

 src/gallium/drivers/r300/compiler/radeon_compiler.c | 9 ++++++---
 src/gallium/drivers/r300/compiler/radeon_compiler.h | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.c b/src/gallium/drivers/r300/compiler/radeon_compiler.c
index 3a21af0e8b5..1c1232f2e45 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.c
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.c
@@ -349,8 +349,11 @@ void rc_get_stats(struct radeon_compiler *c, struct rc_program_stats *s)
 			}
 			info = rc_get_opcode_info(tmp->U.P.RGB.Opcode);
 		}
-		if (info->IsFlowControl)
+		if (info->IsFlowControl) {
 			s->num_fc_insts++;
+			if (info->Opcode == RC_OPCODE_BGNLOOP)
+				s->num_loops++;
+		}
 		if (info->HasTexture)
 			s->num_tex_insts++;
 		s->num_insts++;
@@ -370,10 +373,10 @@ static void print_stats(struct radeon_compiler * c)
 	 * only the FS has, becasue shader-db's report.py wants all shaders to
 	 * have the same set.
 	 */
-	pipe_debug_message(c->debug, SHADER_INFO, "%s shader: %u inst, %u vinst, %u sinst, %u flowcontrol, %u tex, %u presub, %u omod, %u temps, %u consts, %u lits",
+	pipe_debug_message(c->debug, SHADER_INFO, "%s shader: %u inst, %u vinst, %u sinst, %u flowcontrol, %u loops, %u tex, %u presub, %u omod, %u temps, %u consts, %u lits",
 	                   c->type == RC_VERTEX_PROGRAM ? "VS" : "FS",
 	                   s.num_insts, s.num_rgb_insts, s.num_alpha_insts,
-	                   s.num_fc_insts, s.num_tex_insts, s.num_presub_ops,
+	                   s.num_fc_insts, s.num_loops, s.num_tex_insts, s.num_presub_ops,
 	                   s.num_omod_ops, s.num_temp_regs, s.num_consts, s.num_inline_literals);
 }
 
diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.h b/src/gallium/drivers/r300/compiler/radeon_compiler.h
index fa2fbd47d0e..3d15cb45f71 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.h
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h
@@ -156,6 +156,7 @@ struct rc_program_stats {
 	unsigned num_temp_regs;
 	unsigned num_omod_ops;
 	unsigned num_inline_literals;
+	unsigned num_loops;
 };
 
 void rc_get_stats(struct radeon_compiler *c, struct rc_program_stats *s);



More information about the mesa-commit mailing list