[Mesa-dev] llvm compiler cache

Brian Paul brianp at vmware.com
Mon Jun 17 07:44:32 PDT 2013


On 06/16/2013 11:57 AM, Frank Henigman wrote:
> This works (has been in Chrome OS for a while) but only for vertex
> shaders, not geometry shaders nor llvmpipe.  I'm afraid I'm completely
> ignorant about AMD drivers.
> This applies on top of my recently posted memory saving patches.
> Without them the cache would take up too much memory, ~1MB per item
> compared to ~10KB.
>
> If this is interesting to anyone maybe it can be pushed farther down
> and leveraged by geometry shaders, llvmpipe, and more.  I don't know
> how much other apps care but it's a big win for Chrome because just
> opening an empty tab recompiles some shaders and takes hundreds of
> milliseconds on a low-end chromebook.  Revisiting a page with a bunch
> of shaders is seconds faster.
>
> Only works with JIT right now, not MCJIT which is perhaps the future.
> I see in LLVM 3.3 they've added some kind of caching to MCJIT.  My
> cache comes in before generating LLVM source however, thus should have
> bigger savings than can be realized at the LLVM level.
>
> Thanks in advance for any comments, and thanks to Jose Fonseca for
> some earlier suggestions.
> All shortcomings are purely my fault however.

I just took a quick look at the code for now (I might have time for a 
closer review later).

1. I wonder if this new cache-related code should go into a new 
draw_llvm_cache.c file.

2. We have a pipe_reference type for reference counting objects that you 
might want to use.

3. The code looks a bit light on comments.  You might want to scan the 
code and put comments on anything that's not obvious.  For example, what 
does LLVM_CACHE_MAX_UNUSED mean?

Thanks.

-Brian



More information about the mesa-dev mailing list