[Mesa-dev] [PATCH] i965: Do not overwrite optimizer dumps
Juan A. Suarez Romero
jasuarez at igalia.com
Wed Nov 25 04:28:20 PST 2015
When using INTEL_DEBUG=optimizer, each optimizing step is dump to disk,
in a separate file.
But as fs_visitor::optimize() and vec4_visitor::run() are called more
than once, it ends up overwriting the files already on disk, loosing
then previous optimizer steps.
To avoid this, add a new static variable that tracks the global
iteration across the entire life of the program running.
Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 13 +++++++++----
src/mesa/drivers/dri/i965/brw_vec4.cpp | 11 +++++++----
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 29f19cc..9520a62 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -4947,6 +4947,8 @@ fs_visitor::calculate_register_pressure()
void
fs_visitor::optimize()
{
+ static int global_iteration = 0;
+
/* Start by validating the shader we currently have. */
validate();
@@ -4977,8 +4979,9 @@ fs_visitor::optimize()
\
if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) { \
char filename[64]; \
- snprintf(filename, 64, "%s%d-%s-%02d-%02d-" #pass, \
- stage_abbrev, dispatch_width, nir->info.name, iteration, pass_num); \
+ snprintf(filename, 64, "%s%d-%s-%02d-%02d-%02d-" #pass, \
+ stage_abbrev, dispatch_width, nir->info.name, \
+ global_iteration, iteration, pass_num); \
\
backend_shader::dump_instructions(filename); \
} \
@@ -4989,10 +4992,12 @@ fs_visitor::optimize()
this_progress; \
})
+ global_iteration++;
+
if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
char filename[64];
- snprintf(filename, 64, "%s%d-%s-00-start",
- stage_abbrev, dispatch_width, nir->info.name);
+ snprintf(filename, 64, "%s%d-%s-%02d-00-00-start",
+ stage_abbrev, dispatch_width, nir->info.name, global_iteration);
backend_shader::dump_instructions(filename);
}
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index 9a79d67..689ed2a 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -1779,6 +1779,8 @@ vec4_visitor::convert_to_hw_regs()
bool
vec4_visitor::run()
{
+ static int global_iteration = 0;
+
if (shader_time_index >= 0)
emit_shader_time_begin();
@@ -1812,8 +1814,8 @@ vec4_visitor::run()
\
if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) { \
char filename[64]; \
- snprintf(filename, 64, "%s-%s-%02d-%02d-" #pass, \
- stage_abbrev, nir->info.name, iteration, pass_num); \
+ snprintf(filename, 64, "%s-%s-%02d-%02d-%02d-" #pass, \
+ stage_abbrev, nir->info.name, global_iteration, iteration, pass_num); \
\
backend_shader::dump_instructions(filename); \
} \
@@ -1822,11 +1824,12 @@ vec4_visitor::run()
this_progress; \
})
+ global_iteration++;
if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
char filename[64];
- snprintf(filename, 64, "%s-%s-00-start",
- stage_abbrev, nir->info.name);
+ snprintf(filename, 64, "%s-%s-%02d-00-00-start",
+ stage_abbrev, nir->info.name, global_iteration);
backend_shader::dump_instructions(filename);
}
--
2.5.0
More information about the mesa-dev
mailing list