[Mesa-dev] [PATCH] i965: Re-index SSA definitions before printing NIR code.

Connor Abbott cwabbott0 at gmail.com
Thu Jun 11 09:54:27 PDT 2015


On Thu, Jun 11, 2015 at 8:27 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Thu, Jun 11, 2015 at 8:12 AM, Connor Abbott <cwabbott0 at gmail.com> wrote:
>> The one thing this will hurt is that diff'ing shaders from before and
>> after an optimization becomes harder, since just printing the shader
>> will re-order the numbers and add spurious changes. If we want to make
>> the result of doing INTEL_DEBUG=fs more reasonable, we could just do
>> it at the end of the optimization loop or before dumping the shader...
>
> Um... I think that's what this patch does...

Wow... apparently I can't read today. Anyways,

Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

>
>> On Wed, Jun 10, 2015 at 2:39 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
>>> This makes the SSA definitions use sequential numbers (0, 1, 2, ...)
>>> instead of seemingly random ones.  There's not much point normally,
>>> but it makes debug output much easier to read.
>>>
>>> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>>> ---
>>>  src/mesa/drivers/dri/i965/brw_nir.c | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
>>> index 142162c..c13708a 100644
>>> --- a/src/mesa/drivers/dri/i965/brw_nir.c
>>> +++ b/src/mesa/drivers/dri/i965/brw_nir.c
>>> @@ -167,6 +167,12 @@ brw_create_nir(struct brw_context *brw,
>>>     nir_validate_shader(nir);
>>>
>>>     if (unlikely(debug_enabled)) {
>>> +      /* Re-index SSA defs so we print more sensible numbers. */
>>> +      nir_foreach_overload(nir, overload) {
>>> +         if (overload->impl)
>>> +            nir_index_ssa_defs(overload->impl);
>>> +      }
>>> +
>>>        fprintf(stderr, "NIR (SSA form) for %s shader:\n",
>>>                _mesa_shader_stage_to_string(stage));
>>>        nir_print_shader(nir, stderr);
>>> --
>>> 2.4.2
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list