[Mesa-dev] [PATCH] i965: Unhardcode a few more stage names and abbreviations.
The stage_abbrev and stage_name fields in backend_visitor provide what we need without any additional effort. It also means we'll get the right names for compute shaders, SIMD8 geometry shaders, and both kinds of tessellation shaders. This does unfortunately change the capitalization of the stage abbreviation in the INTEL_DEBUG=optimizer output filenames. It doesn't seem worth adding code to handle, though. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++--- src/mesa/drivers/dri/i965/brw_vec4.cpp | 6 ++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 61ee056..4e4f646 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3763,8 +3763,6 @@ fs_visitor::calculate_register_pressure() void fs_visitor::optimize() { - const char *stage_name = stage == MESA_SHADER_VERTEX ? vs : fs; - split_virtual_grfs(); move_uniform_array_access_to_pull_constants(); @@ -3778,7 +3776,7 @@ fs_visitor::optimize() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER) this_progress) { \ char filename[64]; \ snprintf(filename, 64, %s%d-%04d-%02d-%02d- #pass, \ - stage_name, dispatch_width, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ + stage_abbrev, dispatch_width, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ \ backend_visitor::dump_instructions(filename); \ } \ @@ -3790,7 +3788,8 @@ fs_visitor::optimize() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER)) { char filename[64]; snprintf(filename, 64, %s%d-%04d-00-start, - stage_name, dispatch_width, shader_prog ? shader_prog-Name : 0); + stage_abbrev, dispatch_width, + shader_prog ? shader_prog-Name : 0); backend_visitor::dump_instructions(filename); } @@ -3882,9 +3881,6 @@ fs_visitor::allocate_registers() } if (!allocated_without_spills) { - const char *stage_name = stage == MESA_SHADER_VERTEX ? - Vertex : Fragment; - /* We assume that any spilling is worse than just dropping back to * SIMD8. There's probably actually some intermediate point where * SIMD16 with a couple of spills is still better. diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 8ce07637..57b507d 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1700,8 +1700,6 @@ vec4_visitor::run() move_push_constants_to_pull_constants(); split_virtual_grfs(); - const char *stage_name = stage == MESA_SHADER_GEOMETRY ? gs : vs; - #define OPT(pass, args...) ({ \ pass_num++; \ bool this_progress = pass(args); \ @@ -1709,7 +1707,7 @@ vec4_visitor::run() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER) this_progress) { \ char filename[64];\ snprintf(filename, 64, %s-%04d-%02d-%02d- #pass,\ - stage_name, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ + stage_abbrev, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ \ backend_visitor::dump_instructions(filename); \ }\ @@ -1722,7 +1720,7 @@ vec4_visitor::run() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER)) { char filename[64]; snprintf(filename, 64, %s-%04d-00-start, - stage_name, shader_prog ? shader_prog-Name : 0); + stage_abbrev, shader_prog ? shader_prog-Name : 0); backend_visitor::dump_instructions(filename); } -- 2.3.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Unhardcode a few more stage names and abbreviations.
On Mon, Apr 27, 2015 at 2:57 PM, Kenneth Graunke kenn...@whitecape.org wrote: The stage_abbrev and stage_name fields in backend_visitor provide what we need without any additional effort. It also means we'll get the right names for compute shaders, SIMD8 geometry shaders, and both kinds of tessellation shaders. This does unfortunately change the capitalization of the stage abbreviation in the INTEL_DEBUG=optimizer output filenames. It doesn't seem worth adding code to handle, though. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++--- src/mesa/drivers/dri/i965/brw_vec4.cpp | 6 ++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 61ee056..4e4f646 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3763,8 +3763,6 @@ fs_visitor::calculate_register_pressure() void fs_visitor::optimize() { - const char *stage_name = stage == MESA_SHADER_VERTEX ? vs : fs; - split_virtual_grfs(); move_uniform_array_access_to_pull_constants(); @@ -3778,7 +3776,7 @@ fs_visitor::optimize() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER) this_progress) { \ char filename[64]; \ snprintf(filename, 64, %s%d-%04d-%02d-%02d- #pass, \ - stage_name, dispatch_width, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ + stage_abbrev, dispatch_width, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ \ backend_visitor::dump_instructions(filename); \ } \ @@ -3790,7 +3788,8 @@ fs_visitor::optimize() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER)) { char filename[64]; snprintf(filename, 64, %s%d-%04d-00-start, - stage_name, dispatch_width, shader_prog ? shader_prog-Name : 0); + stage_abbrev, dispatch_width, + shader_prog ? shader_prog-Name : 0); backend_visitor::dump_instructions(filename); } @@ -3882,9 +3881,6 @@ fs_visitor::allocate_registers() } if (!allocated_without_spills) { - const char *stage_name = stage == MESA_SHADER_VERTEX ? - Vertex : Fragment; - /* We assume that any spilling is worse than just dropping back to * SIMD8. There's probably actually some intermediate point where * SIMD16 with a couple of spills is still better. diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp index 8ce07637..57b507d 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp @@ -1700,8 +1700,6 @@ vec4_visitor::run() move_push_constants_to_pull_constants(); split_virtual_grfs(); - const char *stage_name = stage == MESA_SHADER_GEOMETRY ? gs : vs; - #define OPT(pass, args...) ({ \ pass_num++; \ bool this_progress = pass(args); \ @@ -1709,7 +1707,7 @@ vec4_visitor::run() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER) this_progress) { \ char filename[64];\ snprintf(filename, 64, %s-%04d-%02d-%02d- #pass,\ - stage_name, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ + stage_abbrev, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ \ backend_visitor::dump_instructions(filename); \ }\ @@ -1722,7 +1720,7 @@ vec4_visitor::run() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER)) { char filename[64]; snprintf(filename, 64, %s-%04d-00-start, - stage_name, shader_prog ? shader_prog-Name : 0); + stage_abbrev, shader_prog ? shader_prog-Name : 0); backend_visitor::dump_instructions(filename); } -- 2.3.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev Reviewed-by: Anuj Phogat anuj.pho...@gmail.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Unhardcode a few more stage names and abbreviations.
On Mon, Apr 27, 2015 at 2:57 PM, Kenneth Graunke kenn...@whitecape.org wrote: The stage_abbrev and stage_name fields in backend_visitor provide what we need without any additional effort. It also means we'll get the right names for compute shaders, SIMD8 geometry shaders, and both kinds of tessellation shaders. This does unfortunately change the capitalization of the stage abbreviation in the INTEL_DEBUG=optimizer output filenames. It doesn't seem worth adding code to handle, though. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_fs.cpp | 10 +++--- src/mesa/drivers/dri/i965/brw_vec4.cpp | 6 ++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 61ee056..4e4f646 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -3763,8 +3763,6 @@ fs_visitor::calculate_register_pressure() void fs_visitor::optimize() { - const char *stage_name = stage == MESA_SHADER_VERTEX ? vs : fs; - split_virtual_grfs(); move_uniform_array_access_to_pull_constants(); @@ -3778,7 +3776,7 @@ fs_visitor::optimize() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER) this_progress) { \ char filename[64]; \ snprintf(filename, 64, %s%d-%04d-%02d-%02d- #pass, \ - stage_name, dispatch_width, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ + stage_abbrev, dispatch_width, shader_prog ? shader_prog-Name : 0, iteration, pass_num); \ \ backend_visitor::dump_instructions(filename); \ } \ @@ -3790,7 +3788,8 @@ fs_visitor::optimize() if (unlikely(INTEL_DEBUG DEBUG_OPTIMIZER)) { char filename[64]; snprintf(filename, 64, %s%d-%04d-00-start, - stage_name, dispatch_width, shader_prog ? shader_prog-Name : 0); + stage_abbrev, dispatch_width, + shader_prog ? shader_prog-Name : 0); backend_visitor::dump_instructions(filename); } @@ -3882,9 +3881,6 @@ fs_visitor::allocate_registers() } if (!allocated_without_spills) { - const char *stage_name = stage == MESA_SHADER_VERTEX ? - Vertex : Fragment; - I was confused for a second how this could work, since stage_name is used right after this hunk ends, but stage_name/stage_abbrev are backend_visitor members. As long as you don't care that we're losing the capital V/F with this change, the patch is Reviewed-by: Matt Turner matts...@gmail.com /* We assume that any spilling is worse than just dropping back to * SIMD8. There's probably actually some intermediate point where * SIMD16 with a couple of spills is still better. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev