[Mesa-dev] [PATCH 1/4] radeonsi: correct maximum wave count per SIMD

Nicolai Hähnle nhaehnle at gmail.com
Thu Aug 24 13:24:07 UTC 2017


On 24.08.2017 13:32, Marek Olšák wrote:
> 
> 
> On Aug 24, 2017 1:21 PM, "Nicolai Hähnle" <nhaehnle at gmail.com 
> <mailto:nhaehnle at gmail.com>> wrote:
> 
>     On 24.08.2017 12 <tel:24.08.2017%2012>:34, Marek Olšák wrote:
> 
> 
> 
>         On Aug 24, 2017 10:17 AM, "Nicolai Hähnle" <nhaehnle at gmail.com
>         <mailto:nhaehnle at gmail.com> <mailto:nhaehnle at gmail.com
>         <mailto:nhaehnle at gmail.com>>> wrote:
> 
>              On 23.08.2017 22:44, Marek Olšák wrote:
> 
>                  From: Marek Olšák <marek.olsak at amd.com
>         <mailto:marek.olsak at amd.com> <mailto:marek.olsak at amd.com
>         <mailto:marek.olsak at amd.com>>>
> 
> 
>                  ---
>                     src/gallium/drivers/radeonsi/si_shader.c | 17
>         ++++++++++++++++-
>                     1 file changed, 16 insertions(+), 1 deletion(-)
> 
>                  diff --git a/src/gallium/drivers/radeonsi/si_shader.c
>                  b/src/gallium/drivers/radeonsi/si_shader.c
>                  index f02fc9e..186a3dd 100644
>                  --- a/src/gallium/drivers/radeonsi/si_shader.c
>                  +++ b/src/gallium/drivers/radeonsi/si_shader.c
>                  @@ -5029,21 +5029,36 @@ static void
>         si_shader_dump_stats(struct
>                  si_screen *sscreen,
>                                                    struct
>         pipe_debug_callback *debug,
>                                                    unsigned processor,
>                                                    FILE *file,
>                                                    bool check_debug_option)
>                     {
>                           const struct si_shader_config *conf =
>         &shader->config;
>                           unsigned num_inputs = shader->selector ?
>                  shader->selector->info.num_inputs : 0;
>                           unsigned code_size =
>         si_get_shader_binary_size(shader);
>                           unsigned lds_increment = sscreen->b.chip_class
>          >= CIK ?
>                  512 : 256;
>                           unsigned lds_per_wave = 0;
>                  -       unsigned max_simd_waves = 10;
>                  +       unsigned max_simd_waves;
>                  +
>                  +       switch (sscreen->b.family) {
>                  +       /* SGPR initialization bug workaround on Tonga and
>                  Iceland reduces
>                  +        * the wave count to 8. */
>                  +       case CHIP_TONGA:
>                  +       case CHIP_ICELAND:
>                  +       /* These always have 8 waves: */
>                  +       case CHIP_POLARIS10:
>                  +       case CHIP_POLARIS11:
>                  +       case CHIP_POLARIS12:
>                  +               max_simd_waves = 8;
> 
> 
>              This should be implied by the num_sgprs set by LLVM, though.
> 
> 
>         I have no idea what you mean or why it's relevant.
> 
> 
>     There's this code later in the function:
> 
>              if (conf->num_sgprs) {
>                      if (sscreen->b.chip_class >= VI)
>                              max_simd_waves = MIN2(max_simd_waves, 800 /
>     conf->num_sgprs);
>                      else
>                              max_simd_waves = MIN2(max_simd_waves, 512 /
>     conf->num_sgprs);
>              }
> 
> 
> Yes, but that's alright. Why is it important? num_sgprs is always nonzero.

It means that the SGPR initialization bug part of the change is 
redundant. LLVM sets the num_sgprs in such a way that the calculation

   max_simd_waves = MIN2(max_simd_waves, 800 / conf->num_sgprs);

will set max_simd_waves to 8.

Cheers,
Nicolai


>     Also, what do you mean by Polaris always having 8 waves?
> 
> 
> The closed Vulkan driver source code says that.
> 
> Marek
> 
> 
>     Cheers,
>     Nicolai
> 
> 
> 
> 
>         Marek
> 
> 
>              Cheers,
>              Nicolai
> 
> 
> 
>                  +               break;
>                  +       default:
>                  +               max_simd_waves = 10;
>                  +       }
>                           /* Compute LDS usage for PS. */
>                           switch (processor) {
>                           case PIPE_SHADER_FRAGMENT:
>                                   /* The minimum usage per wave is
>         (num_inputs *
>                  48). The maximum
>                                    * usage is (num_inputs * 48 * 16).
>                                    * We can get anything in between and
>         it varies
>                  between waves.
>                                    *
>                                    * The 48 bytes per input for a single
>                  primitive is equal to
>                                    * 4 bytes/component * 4
>         components/input * 3
>                  points.
> 
> 
> 
>              --     Lerne, wie die Welt wirklich ist,
>              Aber vergiss niemals, wie sie sein sollte.
> 
> 
> 
> 
>     -- 
>     Lerne, wie die Welt wirklich ist,
>     Aber vergiss niemals, wie sie sein sollte.
> 
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list