Replacing NIR with SPIR-V?

Jason Ekstrand jason at jlekstrand.net
Thu Jan 20 01:36:24 UTC 2022


> - Does it make sense to move to SPIR-V?

None whatsoever.  SPIR-V is an interchange format, not a set of
manipulatable data structures suitable for compiler lowering and
optimization.

You also don't want to build hardware around consuming SPIR-V.  There are
lots of things that the SPIR-V has which you wouldn't want to support
natively in hardware such as structures and arrays in SSA values or complex
trig ops like atan2().  Part of the purpose of NIR is to lower these things
to simpler constructs which are supported in native hardware.

--Jason

On Wed, Jan 19, 2022 at 7:17 PM Abel Bernabeu <
abel.bernabeu at esperantotech.com> wrote:

> Hi,
>
> My name Abel Bernabeu and I currently chair the Graphics and ML Special
> Interest Group within RISC-V.
>
> As part of my work for RISC-V I am currently looking at what is needed for
> supporting a graphics product that uses a (potentially extended) RISC-V ISA
> for its shading cores. My initial focus has been on analyzing the
> functional gap between RISC-V and SPIR-V, assuming that whatever is needed
> for a modern graphics accelerator is inevitably present on SPIR-V.
>
> Now, the thing is that most of the potential adopters on our committee
> will likely be interested in using mesa for developing their drivers and
> that means using NIR as intermediate representation. Thus, I also need to
> consider NIR when looking at the functional gap, doubling the amount of
> work during the analysis.
>
> Why is mesa using NIR as intermediate representation rather than SPIR-V?
> It would make my life easier if mesa used SPIR-V rather than NIR for
> communicating the front-end and the backends.
>
> I know it is a lot of work to migrate to SPIR-V, but I am interested in
> knowing what is the opinion of the mesa developers:
>
> - My understanding is that when mesa adopted NIR, there was no SPIR-V. Was
> a comparison made after the SPIR-V ratification?
>
> - Does it make sense to move to SPIR-V?
>
> - Is it feasible in terms of functionality supported by SPIR-V?
>
> - Is the cost worth the potential advantage of using a more commonly
> adopted standard?
>
> Thanks in advance for your time and thoughts.
>
> Regards.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20220119/24b50544/attachment-0001.htm>


More information about the mesa-dev mailing list