[Mesa-dev] i965 NIR linking

Timothy Arceri tarceri at itsqueeze.com
Thu Sep 14 11:57:53 UTC 2017



On 14/09/17 18:19, Eduardo Lima Mitev wrote:
> On 09/13/2017 01:37 AM, Timothy Arceri wrote:
>> This started out based off the work Jason did back in 2015 to add
>> NIR linking to the Intel VK driver. It needed a reasonable amount
>> of updates to work with the GL driver, tess, xfb, etc.
>>
>> As per the results in patch 8, it can provide some nice
>> improvements despite the GLSL IR linker already doing the same
>> link time removal of unused varyings.
>>
>> Ultimately I'd like to use this with radv but adding it to i965
>> first provides a good test platform given the mature test suites,
>> and extensive shader-db collections available for OpenGL. I'm
>> planning on also adding a NIR packing pass and it makes sense
>> to test that here also. I beleive the packing pass should be the
>> last set towards removing any dependency on the GLSL IR
>> optimisation passes.
>>
>> Please review.
>>
> 
> Hi Timothy,
> 
> Apart from the comments I left in some patches, series is
> 
> Reviewed-by: Eduardo Lima Mitev <elima at igalia.com>
> 
> Thank you for bringing up this series. This is interesting ground work
> looking into support for ARB_gl_spirv on i965. We are still analyzing
> different approaches, and one option is having "SPIR-V -> NIR -> BRW",
> doing linkage in NIR.

Hi Eduardo,

You might want to talk with Nicolai, he is working on ARB_gl_spirv 
support for radeonsi [1]. And is talking a SPIR-V -> NIR -> LLVm path so 
most of your work will likely overlap.

[1] https://lists.freedesktop.org/archives/mesa-dev/2017-May/156413.html

> Related to that, I have a couple questions:
> 
> Do you plan to continue working on improving on this (tackling the open
> points you mention)? If so, do you have a roadmap?
> 
> Have you thoughts already on potential issues to implement a fully
> capable NIR linker (e.g, one that would avoid any use of the GLSL linker)?.

No real roadmap. I'm going to start playing with a nir varying packing 
pass tomorrow/next week, I've tried to do this a number of times in the 
past for i965 but there always seemed to be something else that needed 
to be done first for it to work. This time however I think everything is 
pretty much in place.

My plan for was never to avoid the GLSL linker, it was to do something 
like this around the same spot I call this linking pass.

   - remove from GLSL IR the varyings/uniforms that the nir opt
     passes removed. This is safe because at this point all we want
     from the GLSL IR is to assign locations and do validation on
     varyings and uniforms we don't care if we make the IR invalid.

   - call GLSL IR assign varying/uniform location/validation passes this
     will throw any OpenGL api errors we are required to, setup all the
     various GL state that can be queried, etc.

   - free GLSL IR

   - add a NIR varying packing pass here

We *could* replace the above last stage of the GLSL IR linker with a 
version that just uses NIR but that seemed like too much work for a 
single person so I was going for the short cut.

I believe we also need theses patches which I never got a review for 
which move some GLSL IR lowering passes earlier [1][2].

[1] https://patchwork.freedesktop.org/patch/112044/
[2] https://patchwork.freedesktop.org/patch/112045/

> 
> Thanks!
> 
> Eduardo
> 


More information about the mesa-dev mailing list