Mesa (main): r300: add predicate instructions to statistics of vertex shaders

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


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

Author: Pavel Ondračka <pavel.ondracka at gmail.com>
Date:   Fri Feb 18 11:48:23 2022 +0100

r300: add predicate instructions to statistics of vertex shaders

All of IF, ELSE, ENDIF, BREAK and CONTINUE were already translated
to the predication instructions in rc_vert_fc so all the flow control
we count at the moment is just BGNLOOP and ENDLOOP.

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 | 10 ++++++++--
 src/gallium/drivers/r300/compiler/radeon_compiler.h |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.c b/src/gallium/drivers/r300/compiler/radeon_compiler.c
index 1c1232f2e45..481b10e6dfe 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.c
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.c
@@ -25,6 +25,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "util/u_debug.h"
 #include "pipe/p_state.h"
@@ -354,6 +355,11 @@ void rc_get_stats(struct radeon_compiler *c, struct rc_program_stats *s)
 			if (info->Opcode == RC_OPCODE_BGNLOOP)
 				s->num_loops++;
 		}
+		/* VS flow control was already translated to the predicate instructions */
+		if (c->type == RC_VERTEX_PROGRAM)
+			if (strstr(info->Name, "PRED") != NULL)
+				s->num_pred_insts++;
+
 		if (info->HasTexture)
 			s->num_tex_insts++;
 		s->num_insts++;
@@ -373,9 +379,9 @@ 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 loops, %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 predicate, %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_insts, s.num_rgb_insts, s.num_alpha_insts, s.num_pred_insts,
 	                   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 3d15cb45f71..3e6029fcad7 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.h
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h
@@ -152,6 +152,7 @@ struct rc_program_stats {
 	unsigned num_tex_insts;
 	unsigned num_rgb_insts;
 	unsigned num_alpha_insts;
+	unsigned num_pred_insts;
 	unsigned num_presub_ops;
 	unsigned num_temp_regs;
 	unsigned num_omod_ops;



More information about the mesa-commit mailing list