[Mesa-dev] [PATCH 2/2] intel/tools: Fix program disassembly in aubinator_error_decode.

Lionel Landwerlin lionel.g.landwerlin at intel.com
Sat Nov 11 23:35:21 UTC 2017


:(

The intention was to deal with cases where we've encountered more than 
MAX_NUM_PROGRAMS (actually happened to me).
So we start by the index + 1 assuming this is the oldest program because 
we're in a rolling window of programs.

This is obviously broken with the < 4096 programs case. Maybe we should 
just replace idx with :

idx = ((num_programs == MAX_NUM_PROGRAMS ? idx_program : 0) + i) % 
MAX_NUM_PROGRAMS;

On 11/11/17 00:55, Kenneth Graunke wrote:
> This indexing is bogus.  idx_program is the offset of the next program.
> At this point, we've walked through the entire batch, and accumulated
> all the programs.  So adding it again simply skips over 100% of the
> programs.
> ---
>   src/intel/tools/aubinator_error_decode.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
> index 2322bac8391..00e1a872bd0 100644
> --- a/src/intel/tools/aubinator_error_decode.c
> +++ b/src/intel/tools/aubinator_error_decode.c
> @@ -601,15 +601,14 @@ read_data_file(FILE *file)
>               printf("Disassembly of programs in instruction buffer at "
>                      "0x%08"PRIx64":\n", gtt_offset);
>               for (int i = 0; i < num_programs; i++) {
> -               int idx = (idx_program + i) % MAX_NUM_PROGRAMS;
> -               if (programs[idx].instruction_base_address == gtt_offset) {
> +               if (programs[i].instruction_base_address == gtt_offset) {
>                       printf("\n%s (specified by %s at batch offset "
>                              "0x%08"PRIx64") at offset 0x%08"PRIx64"\n",
> -                           programs[idx].type,
> -                           programs[idx].command,
> -                           programs[idx].command_offset,
> -                           programs[idx].ksp);
> -                    gen_disasm_disassemble(disasm, data, programs[idx].ksp,
> +                           programs[i].type,
> +                           programs[i].command,
> +                           programs[i].command_offset,
> +                           programs[i].ksp);
> +                    gen_disasm_disassemble(disasm, data, programs[i].ksp,
>                                              stdout);
>                  }
>               }




More information about the mesa-dev mailing list