Reviewed-by: Marek Olšák
It looks like the key change here is the use of si_shader_create,
which calls si_fix_num_sgprs, which is what the title describes. This
is something that should be mentioned in the commit message, because
it's not immediately obvious from the patch.
Marek
On Tue, Apr 19, 2016 at 2:51 PM, Bas Nieuwenhuizen
wrote:
> Signed-off-by: Bas Nieuwenhuizen
> ---
> src/gallium/drivers/radeonsi/si_compute.c | 16 +++-
> src/gallium/drivers/radeonsi/si_shader.c | 3 ++-
> 2 files changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_compute.c
> b/src/gallium/drivers/radeonsi/si_compute.c
> index 557e892..905c169 100644
> --- a/src/gallium/drivers/radeonsi/si_compute.c
> +++ b/src/gallium/drivers/radeonsi/si_compute.c
> @@ -81,14 +81,20 @@ static void *si_create_compute_state(
>
> program->shader.selector = &sel;
>
> - if (si_compile_tgsi_shader(sscreen, sctx->tm,
> &program->shader,
> - true, &sctx->b.debug)) {
> + if (si_shader_create(sscreen, sctx->tm, &program->shader,
> +&sctx->b.debug)) {
> FREE(sel.tokens);
> return NULL;
> }
>
> scratch_enabled = shader->config.scratch_bytes_per_wave > 0;
>
> + shader->config.rsrc1 =
> + S_00B848_VGPRS((shader->config.num_vgprs - 1) / 4)
> |
> + S_00B848_SGPRS((shader->config.num_sgprs - 1) / 8)
> |
> + S_00B848_DX10_CLAMP(1) |
> + S_00B848_FLOAT_MODE(shader->config.float_mode);
> +
> shader->config.rsrc2 =
> S_00B84C_USER_SGPR(SI_CS_NUM_USER_SGPR) |
>S_00B84C_SCRATCH_EN(scratch_enabled) |
>S_00B84C_TGID_X_EN(1) | S_00B84C_TGID_Y_EN(1) |
> @@ -105,10 +111,10 @@ static void *si_create_compute_state(
> radeon_elf_read(code, header->num_bytes,
> &program->shader.binary);
> si_shader_binary_read_config(&program->shader.binary,
> &program->shader.config, 0);
> + si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
> + PIPE_SHADER_COMPUTE, stderr);
> + si_shader_binary_upload(sctx->screen, &program->shader);
> }
> - si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
> - TGSI_PROCESSOR_COMPUTE, stderr);
> - si_shader_binary_upload(sctx->screen, &program->shader);
>
> return program;
> }
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c
> b/src/gallium/drivers/radeonsi/si_shader.c
> index 605b964..3bf68eb 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -7022,7 +7022,8 @@ int si_shader_create(struct si_screen *sscreen,
> LLVMTargetMachineRef tm,
> (shader->key.vs.as_es != mainp->key.vs.as_es ||
> shader->key.vs.as_ls != mainp->key.vs.as_ls)) ||
> (shader->selector->type == PIPE_SHADER_TESS_EVAL &&
> -shader->key.tes.as_es != mainp->key.tes.as_es)) {
> +shader->key.tes.as_es != mainp->key.tes.as_es) ||
> + shader->selector->type == PIPE_SHADER_COMPUTE) {
> /* Monolithic shader (compiled as a whole, has many variants,
> * may take a long time to compile).
> */
> --
> 2.8.0
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev