Re: [Mesa-dev] clover's interface to clang

2020-11-11 Thread Francisco Jerez
I don't remember the specifics of why we ended up interfacing with Clang
this way.  What is technically wrong with it, specifically?  I don't
have any objection to switching to the Driver and Compilation interface,
nor to translating the "-cl-denorms-are-zero" option to whatever the
current option name is so the current Clang interfacing keeps working.

Dave Airlie  writes:

> Hey all (mostly Tom).
>
> I've been learning new things today since Matt pushed a patch to clang
> to remove "-cl-denorms-are-zero" from cc1 options. I thought this was
> a regression or we should hack things to pass a different flag (which
> I did locally for testing), but Matt informed me clover is likely
> interfacing to clang wrong.
>
> The correct way to do things seems to be to build up a set of command
> line args pass those to the Driver, create a Compilation object, with
> jobs, and then execute each job in turns, one of the jobs would be a
> cc1 job and the driver would have all the correct arguments for it.
>
> Now I'll likely dig into this a bit more, but I was wondering if
> anyone knows historically why this wasn't done. I know for example
> with clover we really only want to use a the cc1 pass since at least
> for the NIR backend we just want to emit LLVM bytecode and pass it to
> the spirv conversion, so using the driver might be overkill.
>
> Dave.


signature.asc
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] clover's interface to clang

2020-11-11 Thread Dave Airlie
On Thu, 12 Nov 2020 at 06:23, Francisco Jerez  wrote:
>
> I don't remember the specifics of why we ended up interfacing with Clang
> this way.  What is technically wrong with it, specifically?  I don't
> have any objection to switching to the Driver and Compilation interface,
> nor to translating the "-cl-denorms-are-zero" option to whatever the
> current option name is so the current Clang interfacing keeps working.

Currently we pass a bunch of options from the user directly to the
clang cc1 internals. Up until recently this wasn't a problem as the
cc1 just happened to allow this and the options matched up. But this
was only ever a happy accident.

Now the options don't match up. What you are meant to do is pass the
options to the clang Driver and it gives you back a cc1 job which has
the cc1 specific arguments for what you passed to the driver.

So Driver sees "-cl-denorms-are-zero" and gives us back a compilation
job for cc1 which has some internal -f flags in it.

Otherwise clover has to keep track of the internal cc1 flags and remap
things itself which might not be easily discoverable moving forward.

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


Re: [Mesa-dev] clover's interface to clang

2020-11-11 Thread Dave Airlie
On Thu, 12 Nov 2020 at 06:37, Dave Airlie  wrote:
>
> On Thu, 12 Nov 2020 at 06:23, Francisco Jerez  wrote:
> >
> > I don't remember the specifics of why we ended up interfacing with Clang
> > this way.  What is technically wrong with it, specifically?  I don't
> > have any objection to switching to the Driver and Compilation interface,
> > nor to translating the "-cl-denorms-are-zero" option to whatever the
> > current option name is so the current Clang interfacing keeps working.
>
> Currently we pass a bunch of options from the user directly to the
> clang cc1 internals. Up until recently this wasn't a problem as the
> cc1 just happened to allow this and the options matched up. But this
> was only ever a happy accident.
>
> Now the options don't match up. What you are meant to do is pass the
> options to the clang Driver and it gives you back a cc1 job which has
> the cc1 specific arguments for what you passed to the driver.
>
> So Driver sees "-cl-denorms-are-zero" and gives us back a compilation
> job for cc1 which has some internal -f flags in it.
>
> Otherwise clover has to keep track of the internal cc1 flags and remap
> things itself which might not be easily discoverable moving forward.

I hacked a bit of a PoC up today for this
https://gitlab.freedesktop.org/airlied/mesa/-/commit/0981cd24ae6653ef058cbcbb5465f65d0cfdae65

Will try and make it better.

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