[Mesa-dev] [PATCH] gallivm: allow large numbers of temporaries
Jose Fonseca
jfonseca at vmware.com
Tue Feb 4 21:44:14 CET 2014
Sounds great to me.
Jose
----- Original Message -----
> The number of allowed temporaries increases almost with every
> iteration of an api. We used to support 128, then we started
> increasing and the newer api's support 4096+. So if we notice
> that the number of temporaries is larger than our statically
> allocated storage would allow we just treat them as indexable
> temporaries and allocate them as an array from the start.
>
> Signed-off-by: Zack Rusin <zackr at vmware.com>
> ---
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 9db41a9..7c5de21 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -2672,8 +2672,8 @@ lp_emit_declaration_soa(
> assert(last <= bld->bld_base.info->file_max[decl->Declaration.File]);
> switch (decl->Declaration.File) {
> case TGSI_FILE_TEMPORARY:
> - assert(idx < LP_MAX_TGSI_TEMPS);
> if (!(bld->indirect_files & (1 << TGSI_FILE_TEMPORARY))) {
> + assert(idx < LP_MAX_TGSI_TEMPS);
> for (i = 0; i < TGSI_NUM_CHANNELS; i++)
> bld->temps[idx][i] = lp_build_alloca(gallivm, vec_type,
> "temp");
> }
> @@ -3621,6 +3621,15 @@ lp_build_tgsi_soa(struct gallivm_state *gallivm,
> bld.bld_base.info = info;
> bld.indirect_files = info->indirect_files;
>
> + /*
> + * If the number of temporaries is rather large then we just
> + * allocate them as an array right from the start and treat
> + * like indirect temporaries.
> + */
> + if (info->file_max[TGSI_FILE_TEMPORARY] >= LP_MAX_TGSI_TEMPS) {
> + bld.indirect_files |= (1 << TGSI_FILE_TEMPORARY);
> + }
> +
> bld.bld_base.soa = TRUE;
> bld.bld_base.emit_debug = emit_debug;
> bld.bld_base.emit_fetch_funcs[TGSI_FILE_CONSTANT] = emit_fetch_constant;
> --
> 1.8.3.2
>
More information about the mesa-dev
mailing list