[Mesa-dev] NIR, SCons, and Gallium

Marek Olšák maraeo at gmail.com
Tue Jan 12 03:02:32 PST 2016


On Tue, Jan 12, 2016 at 1:11 AM, Ian Romanick <idr at freedesktop.org> wrote:
> On 01/11/2016 06:21 AM, Jose Fonseca wrote:
>> FWIW, I updated SCons to build NIR, both with GCC and MSVC:
>>
>>   http://cgit.freedesktop.org/~jrfonseca/mesa/log/?h=scons-nir
>>
>> It was actually simpler than I anticipated.
>>
>> But I hit a wall -- there's actually no way to get NIR used with
>> softpipe/llvmpipe, not even as an intermediate IR somewhere between GLSL
>> IR and TGSI, is there?
>>
>> Without this I can't actually test it.  And I'm afraid the scons
>> integration will rot again unless it is used.
>>
>>
>> I know other gallium drivers already use NIR, but IIUC, they use NIR
>> internally, ie., TGSI -> NIR-> HW.
>>
>>
>> So what is exactly the long term plan for NIR in Mesa general, and
>> Gallium in particular?
>> - replace GLSL IR completely?
>
> Not likely.  GLSL IR has a lot of GLSL-specific semantics that aren't
> really appropriate for an IR at NIR's level.
>
>> - use NIR as intermediate IR betweem GLSL IR and TGSI, and run
>> optimizations in there?
>> - use NIR instead of TGSI at the gallium interface?
>
> I think folks have expressed a (slight?) preference for the latter
> rather than the former.  However, the former may provide an easier
> stepping stone.
>
> I know that Ilia has expressed some concerns about how NIR will effect
> nouveau.  I don't recall hearing an opinion expressed by Marek or any of
> the other AMD guys, but that probably just means that I wasn't paying
> enough attention.

Since most of the compilation overhead is spent in LLVM with our
driver, we plan to add a shader cache to st/mesa or mesa/main and have
1 variant per shader in the driver. Due to that, we won't have to care
about compile times much. The shader cache should be invoked before
the linker and if there is a cache hit, it should skip the linker and
everything that follows.

We plan to stay with TGSI, because rewriting our TGSI->LLVM conversion
code would be too much work with no benefits.

Marek


More information about the mesa-dev mailing list