<div dir="ltr">2013/9/20 Tapani Pälli <span dir="ltr"><<a href="mailto:tapani.palli@intel.com" target="_blank">tapani.palli@intel.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hello;<br>
<br>
This is RFC for shader cache implementation, goal is to optimize application<br>
startup time. The implementation is based on idea that Kenneth had on a Mesa<br>
branch for memory based cache. These patches implement a 'behind the scenes'<br>
cache for shader compiler storing gl_shader struct to the disk. Later on my<br>
goal is to implement OES_get_program_binary extension using some of this<br>
implementation as the basis.<br>
<br>
There are already number of TODO's and issues mentioned in commit msgs,<br>
please check these first. Then, there are probably bugs and missing things<br>
that I'm not aware of, please let me know about any of these. One big TODO<br>
is to rewrite the serialization to happen to memory area first (not directly<br>
to the disk), this will make serialization more robust with more centralized<br>
error handling but also makes it more usable for OES_get_program_binary<br>
implementation. I haven't paid much attention to the portability of this code<br>
so I would be interested to know also how well this would work with windows<br>
and others.<br>
<br>
One big TODO/goal is to move this all to happen after linking to cache<br>
all shaders in a gl program. This will give far better optimization for<br>
startup time. Currently rough approx 1/4 time is spent during compilation<br>
but much more after linking and optimizations done after linking (this is<br>
based on analysis done with particular app and callgrind). I have already<br>
somewhat promising results from this cache, for example compiling L4D2<br>
shaders and shader-db runs are faster..<br>
<br>
On my SNB desktop machine shader-db takes ~2.4secs without cache, with cache<br>
it takes ~1.8secs (~2.7 when cache gets generated) (values are avg from 100<br>
runs compiling all the shaders). Shader-db creates 266 blobs eating 46M of<br>
disk space when using cache.<br></blockquote><div><br></div><div><div style="font-family:arial,sans-serif;font-size:13px">This sounds that we will need a configure option to disable the cache on platforms with</div><div style="font-family:arial,sans-serif;font-size:13px">
a low amount of disk space (thinking of phones/embedded devices here).</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Any comments greatly appreciated!<br>
<br>
Tapani Pälli (4):<br>
  glsl: add ir_cache class for IR serialization (WIP)<br>
  mesa: gl_shader_cache class (WIP)<br>
  glsl: export populate_symbol_table<br>
  glsl: use gl_shader_cache when compiling (WIP)<br>
<br>
 src/glsl/Makefile.sources         |   2 +<br>
 src/glsl/glsl_parser_extras.cpp   |  40 ++<br>
 src/glsl/ir_cache.h               | 535 +++++++++++++++++++++<br>
 src/glsl/ir_cache_serialize.cpp   | 603 ++++++++++++++++++++++++<br>
 src/glsl/ir_cache_unserialize.cpp | 969 ++++++++++++++++++++++++++++++++++++++<br>
 src/glsl/linker.cpp               |   2 +-<br>
 src/glsl/linker.h                 |   3 +<br>
 src/mesa/Makefile.sources         |   1 +<br>
 src/mesa/main/context.c           |   2 +<br>
 src/mesa/main/mtypes.h            |   4 +<br>
 src/mesa/main/shadercache.cpp     | 198 ++++++++<br>
 src/mesa/main/shadercache.h       |  68 +++<br>
 12 files changed, 2426 insertions(+), 1 deletion(-)<br>
 create mode 100644 src/glsl/ir_cache.h<br>
 create mode 100644 src/glsl/ir_cache_serialize.cpp<br>
 create mode 100644 src/glsl/ir_cache_unserialize.cpp<br>
 create mode 100644 src/mesa/main/shadercache.cpp<br>
 create mode 100644 src/mesa/main/shadercache.h<br>
<span class=""><font color="#888888"><br>
--<br>
1.8.1.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>