[Mesa-dev] [PATCH] llvmpipe: increase fs shader variant instruction cache limit by factor 4

Jose Fonseca jfonseca at vmware.com
Mon Oct 14 17:49:55 CEST 2013



----- Original Message -----
> Am 11.10.2013 16:21, schrieb Brian Paul:
> > On 10/11/2013 07:11 AM, sroland at vmware.com wrote:
> >> From: Roland Scheidegger <sroland at vmware.com>
> >>
> >> The previous limit of of 128*1024 was reported to cause frequent
> >> recompiles
> >> in some apps due to shader variant thrashing on IRC in some apps leading
> >> to noticeable lags.
> >> Note that the LP_MAX_SHADER_VARIANTS limit (1024) was more or less
> >> impossible
> >> to reach, since even simple fragment shaders without texturing
> >> (glxgears) used
> >> more than twice than 128 instructions, hence the instruction limit
> >> would have
> >> always been reached first (excluding things like trivial shaders not
> >> writing
> >> color). Even with the new limit it is VERY likely the instruction
> >> limit is hit
> >> first.
> >> Should help with such lags due to recompiles (though other shader
> >> types have
> >> their own limits, LP_MAX_SETUP_VARIANTS and DRAW_MAX_SHADER_VARIANTS, in
> >> particular the latter seems a bit small (128)).
> >> ---
> >>   src/gallium/drivers/llvmpipe/lp_limits.h |    2 +-
> >>   1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/src/gallium/drivers/llvmpipe/lp_limits.h
> >> b/src/gallium/drivers/llvmpipe/lp_limits.h
> >> index af31b35..8cfab5a 100644
> >> --- a/src/gallium/drivers/llvmpipe/lp_limits.h
> >> +++ b/src/gallium/drivers/llvmpipe/lp_limits.h
> >> @@ -79,7 +79,7 @@
> >>    * Max number of instructions (for all fragment shaders combined per
> >> context)
> >>    * that will be kept around.
> >>    */
> >> -#define LP_MAX_SHADER_INSTRUCTIONS (128*1024)
> >> +#define LP_MAX_SHADER_INSTRUCTIONS (512*LP_MAX_SHADER_VARIANTS)
> >>
> >>   /**
> >>    * Max number of setup variants that will be kept around.
> >>
> > 

Looks good to me.

> > Reviewed-by: Brian Paul <brianp at vmware.com>
> > 
> > Maybe the comment on LP_MAX_SHADER_INSTRUCTIONS should indicate that
> > these are LLVM IR instructions, not TGSI instructions, not machine
> > instructions.  I had to dig for a while to find that.
> 
> Oh yes that's a good idea. I think ideally we'd just count compiled size
> of the shaders but IIRC that was actually difficult to do.
> 


Agreed.

Jose


More information about the mesa-dev mailing list