Re: [Mesa-dev] Understanding Components of SWR

2020-09-15 Thread vivek pandya
Hello Jan,
On Tue, Sep 15, 2020 at 12:45 PM Zielinski, Jan 
wrote:

> > 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=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. ;-)
>
Thanks for the information.

>
> > 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?
>
Yes but for now I am developing simple thing similar to
https://github.com/baldurk/visor that is enough for experiments.

>
> BR,
> Jan
>
> -
> 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.
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Understanding Components of SWR

2020-09-15 Thread Zielinski, Jan
> 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=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?

BR,
Jan

-
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.
 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] Understanding Components of SWR

2020-09-12 Thread vivek pandya
Hello,

I would like to understand the high level architecture of SWR codebase.

Is there any document for extending SWR for architectures other than Intel?
It seems like SWR uses llvm_pipe shader creation, so is it still based on
tgsi IR to LLVM conversion?
Is there a path from NIR->LLVM (it seems so as per
https://phoronix.com/scan.php?page=news_item=LLVM-Switches-To-NIR-Default
?
If yes please point to the code?
If not then How much effort will it take to get a NIR to LLVM IR converter?

To get LLVM directly from NIR I am thinking to use RADV's NIR to LLVM IR
converter but make it more suitable to generate LLVM IR for any other
architecture by simply having a text file to look up for NIR to LLVM ir
mapping and that makes RADV's LLVMIR generator target independent. If it is
not one to one mapping then something more complex like LLVM's table gen
can be used.

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

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.

Thanks,
Vivek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev