Mesa (main): r300: Add consts (uniforms) count to the shader-db output.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 19 01:00:26 UTC 2022


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

Author: Emma Anholt <emma at anholt.net>
Date:   Sun Dec 26 09:23:39 2021 -0800

r300: Add consts (uniforms) count to the shader-db output.

This is one of the critical metrics for this driver.

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14600>

---

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

diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.c b/src/gallium/drivers/r300/compiler/radeon_compiler.c
index 4e8563c53c0..e85da7a2d1c 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.c
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.c
@@ -309,6 +309,8 @@ static void reg_count_callback(void * userdata, struct rc_instruction * inst,
 		(int)index > s->num_temp_regs ? s->num_temp_regs = index : 0;
 	if (file == RC_FILE_INLINE)
 		s->num_inline_literals++;
+	if (file == RC_FILE_CONSTANT)
+		s->num_consts = MAX2(s->num_consts, index + 1);
 }
 
 void rc_get_stats(struct radeon_compiler *c, struct rc_program_stats *s)
@@ -368,11 +370,11 @@ 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: %d inst, %d vinst, %d sinst, %d flowcontrol, %d tex, %d presub, %d omod, %d temps, %d lits",
+	pipe_debug_message(c->debug, SHADER_INFO, "%s shader: %d inst, %d vinst, %d sinst, %d flowcontrol, %d tex, %d presub, %d omod, %d temps, %d consts, %d 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_omod_ops, s.num_temp_regs, s.num_inline_literals);
+	                   s.num_omod_ops, s.num_temp_regs, s.num_consts, s.num_inline_literals);
 }
 
 static const char *shader_name[RC_NUM_PROGRAM_TYPES] = {
diff --git a/src/gallium/drivers/r300/compiler/radeon_compiler.h b/src/gallium/drivers/r300/compiler/radeon_compiler.h
index f9976d2e0c9..99ded74e487 100644
--- a/src/gallium/drivers/r300/compiler/radeon_compiler.h
+++ b/src/gallium/drivers/r300/compiler/radeon_compiler.h
@@ -146,6 +146,7 @@ struct radeon_compiler_pass {
 };
 
 struct rc_program_stats {
+	unsigned num_consts;
 	unsigned num_insts;
 	unsigned num_fc_insts;
 	unsigned num_tex_insts;



More information about the mesa-commit mailing list