[Mesa-dev] [PATCH 1/2] radeonsi: fix NUM_SGPRS calculation once more

Marek Olšák maraeo at gmail.com
Wed Apr 13 12:36:54 UTC 2016


On Wed, Apr 13, 2016 at 2:19 PM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> This fixes GS piglit failures after adding SI_PARAM_SHADER_BUFFERS,
> which bumped NUM_USER_SGPRS and uncovered this bug on SI.
>
> If this was fixed in LLVM, these workarounds wouldn't be needed.
>
> LLVM would have to look at the calling convention to know how many SGPR
> inputs are declared, and add VCC and the scratch wave offset (which is
> enabled even if we spill SGPRs but not VGPRs, oh well).
> ---
>  src/gallium/drivers/radeonsi/si_shader.c        | 11 ++++
>  src/gallium/drivers/radeonsi/si_state_shaders.c | 67 +++++--------------------
>  2 files changed, 23 insertions(+), 55 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index c58467d..31fae85 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -6761,6 +6761,16 @@ static bool si_shader_select_ps_parts(struct si_screen *sscreen,
>         return true;
>  }
>
> +static void si_fix_num_sgprs(struct si_shader *shader)
> +{
> +       unsigned min_sgprs = shader->info.num_input_sgprs + 2; /* VCC */
> +
> +       if (shader->config.scratch_bytes_per_wave)
> +               min_sgprs += 2; /* scratch wave offset */

Sorry, this should be += 1.

Marek


More information about the mesa-dev mailing list