On Wednesday, April 08, 2015 12:25:27 PM Martin Peres wrote: > On 08/04/15 10:06, Kenneth Graunke wrote: > > Previously, we translated into NIR and did all the optimizations and > > lowering as part of running fs_visitor. This meant that we did all of > > that work twice for fragment shaders - once for SIMD8, and again for > > SIMD16. We also had to redo it every time we hit a state based > > recompile. > > > > We now generate NIR once at link time. ARB programs don't have linking, > > so we instead generate it at ProgramStringNotify time. > > > > Mesa's fixed function vertex program handling doesn't bother to inform > > the driver about new programs at all (which is rather mean), so we > > generate NIR at the last minute, if it hasn't happened already. > > > > shader-db runs ~9.4% faster on my i7-5600U, with a release build. > > Nice speed improvement but wouldn't it affect negatively programs using > SSO to recombine shaders at run time?
Hi Martin! I don't think so, no. In the SSO world, glCreateShaderProgramv compiles a single shader and immediately links it into a separable program. This triggers the LinkShader() driver hook, which is where I'm generating NIR. In other words, we now generate NIR when first creating the program, rather than deferring it until later (and potentially draw time). We don't do any cross-stage optimization when using SSO today. It might be a good idea - I haven't looked into it. "The Talos Principle" and "Serious Sam 3" would be good applications to investigate the possible benefit of doing that. Cross-stage optimization usually works by taking optimized IR for each stage, copying it, eliminating unnecessary inputs/outputs, then re-optimizing. We probably want to do that with NIR, so I think this patch is still useful - it makes the per-stage optimized IR available. Thanks for asking! --Ken
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev