[Mesa-dev] Understanding Components of SWR

Zielinski, Jan jan.zielinski at intel.com
Tue Sep 15 07:15:12 UTC 2020

> Is there any document for extending SWR for architectures other than Intel?

Unfortunately not. SWR was not architected to be portable beyond CPUs with different levels of AVX ISAs. 

> It seems like SWR uses llvm_pipe shader creation, so is it still based on tgsi IR to LLVM conversion? 

Yes, it is still based on TGSI.

> Is there a path from NIR->LLVM (it seems so as per https://phoronix.com/scan.php?page=news_item&px=LLVM-Switches-To-NIR-Default ?

For SWR no - it does not exist, at least not yet. From the top of my head, I don't really know how much effort it would be to port SWR to NIR, but I do plan to look into it. At some point... 

> Is the above idea possible at high-level? or I am missing lots of important points?

The most important point you may be missing is the fact that rasterization in SWR is not based on LLVM. It based on AVX intrinsics (see code in src/gallium/drivers/swr/rasterizer/core/). This is probably the biggest problem if you target any other architecture. Most probably you would need to rewrite the rasterizer to use LLVM IR or to some kind of language that is based on LLVM and supports explicit vectorization, like ISPC. Rewriting is most probably easier than convincing the community to introduce ISPC (or any other new language) dependency to Mesa, though. ;-)

> Overall idea is to have SWR retargettable for any architecture that is supported by LLVM codege and also don't want to use TGSI instead use NIR.

Are you thinking about using SWR for Libre-SOC?


Intel Technology Poland sp. z o.o.
ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN.
Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.

More information about the mesa-dev mailing list