[Mesa-dev] [PATCH 11/12] i965: Create NIR during LinkShader() and ProgramStringNotify().
Kenneth Graunke
kenneth at whitecape.org
Sat Apr 11 11:30:41 PDT 2015
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150411/2ddb5622/attachment.sig>
More information about the mesa-dev
mailing list