Re: [Mesa-dev] [PATCH v3 12/25] configure.ac: Move gallium LLVM checks

2016-10-12 Thread Tobias Droste
Am Mittwoch, 12. Oktober 2016, 19:39:47 CEST schrieb Jose Fonseca:
> >> 
> >> Right now --enable-gallium-llvm will be set to no if it is "auto" on non
> >> x86.
> >> 
> >> gallivm/llvm use the x86 target
> > 
> > I haven't look too closely at the llvm code but there's nothing in
> > scons/automake which supports this, perhaps Jose can confirm.
> > 
> > Jose, does the gallium llvm code require the x86 target or can it work
> > with other as well ? At least in theory.
> 
> At VMware we only use llvmpipe + LLVM with x86: we have CI in place to
> make sure it works.
> 
> I understand others have it working with PowerPC and ARM.  The code is
> there.  So we shouln't forbid people from enabling if they want.
> 
> (In fact, in theory llvmpipe should work any CPU that's supported by
> LLVM.  But I wouldn't be surprised if there are bugs in practice.)
> 
> 
> I'm not involved in these porting efforts myself.  I don't know how
> stable llvmpipe on PowerPC/ARM is kept (whether there's any CI in
> place), and therefore I can't say it's OK to enable LLVM by default
> outside x86 or not.

Ok good to know. Then I will check version etc. for all CPUs but only "auto 
enable" it on x86.

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


Re: [Mesa-dev] [PATCH v3 12/25] configure.ac: Move gallium LLVM checks

2016-10-12 Thread Jose Fonseca

On 12/10/16 19:30, Emil Velikov wrote:

On 12 October 2016 at 19:14, Tobias Droste  wrote:

Am Mittwoch, 12. Oktober 2016, 10:42:19 CEST schrieb Emil Velikov:

On 12 October 2016 at 00:02, Tobias Droste  wrote:


 gallium_require_llvm() {

-if test "x$MESA_LLVM" = x0; then
-case "$host" in *gnux32) return;; esac
-case "$host_cpu" in
-i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on
x86 and x86_64]);; -esac
-fi
+case "$host" in *gnux32) return;; esac
+case "$host_cpu" in
+i*86|x86_64|amd64)
+LLVM_REQUIRED_VERSION_MAJOR="3"
+LLVM_REQUIRED_VERSION_MINOR="3"
+if test "$LLVM_VERSION_INT" -lt
"${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then +
 AC_MSG_ERROR([LLVM
$LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is
required]) +fi
+;;
+esac

 }


The function it quite "ugly" as-is and this patch changes things in a fun
way.

Namely: before you'll get the minimum required version check
regardless of host_cpu for everyone, while now you get the opposite -
everyone is 'constrained' by the host_cpu check. Admittedly I've have
not idea if llvmpipe is a thing on outside x86 land.

Checking the gallium_require_llvm users we want:
 - swr -> bail out if host_cpu !x86/x86-64 or gallium-llvm toggle is
off || llvm version req. is not met
 - r300 -> on host_cpu eq. x86/x86-64, check the gallium-llvm toggle
(this is 'premature' optimisation which we might want to rework/drop
in the long run)


Right now --enable-gallium-llvm will be set to no if it is "auto" on non x86.



gallivm/llvm use the x86 target

I haven't look too closely at the llvm code but there's nothing in
scons/automake which supports this, perhaps Jose can confirm.

Jose, does the gallium llvm code require the x86 target or can it work
with other as well ? At least in theory.


At VMware we only use llvmpipe + LLVM with x86: we have CI in place to 
make sure it works.


I understand others have it working with PowerPC and ARM.  The code is 
there.  So we shouln't forbid people from enabling if they want.


(In fact, in theory llvmpipe should work any CPU that's supported by 
LLVM.  But I wouldn't be surprised if there are bugs in practice.)



I'm not involved in these porting efforts myself.  I don't know how 
stable llvmpipe on PowerPC/ARM is kept (whether there's any CI in 
place), and therefore I can't say it's OK to enable LLVM by default 
outside x86 or not.



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


Re: [Mesa-dev] [PATCH v3 12/25] configure.ac: Move gallium LLVM checks

2016-10-12 Thread Tobias Droste
Am Mittwoch, 12. Oktober 2016, 19:30:51 CEST schrieb Emil Velikov:
> >> 
> >> The function it quite "ugly" as-is and this patch changes things in a fun
> >> way.
> >> 
> >> Namely: before you'll get the minimum required version check
> >> regardless of host_cpu for everyone, while now you get the opposite -
> >> everyone is 'constrained' by the host_cpu check. Admittedly I've have
> >> not idea if llvmpipe is a thing on outside x86 land.
> >> 
> >> Checking the gallium_require_llvm users we want:
> >>  - swr -> bail out if host_cpu !x86/x86-64 or gallium-llvm toggle is
> >> 
> >> off || llvm version req. is not met
> >> 
> >>  - r300 -> on host_cpu eq. x86/x86-64, check the gallium-llvm toggle
> >> 
> >> (this is 'premature' optimisation which we might want to rework/drop
> >> in the long run)
> > 
> > Right now --enable-gallium-llvm will be set to no if it is "auto" on non
> > x86.
> > 
> > gallivm/llvm use the x86 target
> 
> I haven't look too closely at the llvm code but there's nothing in
> scons/automake which supports this, perhaps Jose can confirm.
> 
> Jose, does the gallium llvm code require the x86 target or can it work
> with other as well ? At least in theory.

I looked at this:

https://cgit.freedesktop.org/mesa/mesa/tree/configure.ac#n2204

if test "x$enable_gallium_llvm" = xauto; then
case "$host_cpu" in
i*86|x86_64|amd64) enable_gallium_llvm=yes;;
esac
fi

That's why I thought it's only x86.

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


Re: [Mesa-dev] [PATCH v3 12/25] configure.ac: Move gallium LLVM checks

2016-10-12 Thread Emil Velikov
On 12 October 2016 at 19:14, Tobias Droste  wrote:
> Am Mittwoch, 12. Oktober 2016, 10:42:19 CEST schrieb Emil Velikov:
>> On 12 October 2016 at 00:02, Tobias Droste  wrote:
>> >
>> >  gallium_require_llvm() {
>> >
>> > -if test "x$MESA_LLVM" = x0; then
>> > -case "$host" in *gnux32) return;; esac
>> > -case "$host_cpu" in
>> > -i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on
>> > x86 and x86_64]);; -esac
>> > -fi
>> > +case "$host" in *gnux32) return;; esac
>> > +case "$host_cpu" in
>> > +i*86|x86_64|amd64)
>> > +LLVM_REQUIRED_VERSION_MAJOR="3"
>> > +LLVM_REQUIRED_VERSION_MINOR="3"
>> > +if test "$LLVM_VERSION_INT" -lt
>> > "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then +
>> >  AC_MSG_ERROR([LLVM
>> > $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is
>> > required]) +fi
>> > +;;
>> > +esac
>> >
>> >  }
>>
>> The function it quite "ugly" as-is and this patch changes things in a fun
>> way.
>>
>> Namely: before you'll get the minimum required version check
>> regardless of host_cpu for everyone, while now you get the opposite -
>> everyone is 'constrained' by the host_cpu check. Admittedly I've have
>> not idea if llvmpipe is a thing on outside x86 land.
>>
>> Checking the gallium_require_llvm users we want:
>>  - swr -> bail out if host_cpu !x86/x86-64 or gallium-llvm toggle is
>> off || llvm version req. is not met
>>  - r300 -> on host_cpu eq. x86/x86-64, check the gallium-llvm toggle
>> (this is 'premature' optimisation which we might want to rework/drop
>> in the long run)
>
> Right now --enable-gallium-llvm will be set to no if it is "auto" on non x86.

> gallivm/llvm use the x86 target
I haven't look too closely at the llvm code but there's nothing in
scons/automake which supports this, perhaps Jose can confirm.

Jose, does the gallium llvm code require the x86 target or can it work
with other as well ? At least in theory.

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


Re: [Mesa-dev] [PATCH v3 12/25] configure.ac: Move gallium LLVM checks

2016-10-12 Thread Tobias Droste
Am Mittwoch, 12. Oktober 2016, 10:42:19 CEST schrieb Emil Velikov:
> On 12 October 2016 at 00:02, Tobias Droste  wrote:
> >  
> >  gallium_require_llvm() {
> > 
> > -if test "x$MESA_LLVM" = x0; then
> > -case "$host" in *gnux32) return;; esac
> > -case "$host_cpu" in
> > -i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on
> > x86 and x86_64]);; -esac
> > -fi
> > +case "$host" in *gnux32) return;; esac
> > +case "$host_cpu" in
> > +i*86|x86_64|amd64)
> > +LLVM_REQUIRED_VERSION_MAJOR="3"
> > +LLVM_REQUIRED_VERSION_MINOR="3"
> > +if test "$LLVM_VERSION_INT" -lt
> > "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then +  
> >  AC_MSG_ERROR([LLVM
> > $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is
> > required]) +fi
> > +;;
> > +esac
> > 
> >  }
> 
> The function it quite "ugly" as-is and this patch changes things in a fun
> way.
> 
> Namely: before you'll get the minimum required version check
> regardless of host_cpu for everyone, while now you get the opposite -
> everyone is 'constrained' by the host_cpu check. Admittedly I've have
> not idea if llvmpipe is a thing on outside x86 land.
> 
> Checking the gallium_require_llvm users we want:
>  - swr -> bail out if host_cpu !x86/x86-64 or gallium-llvm toggle is
> off || llvm version req. is not met
>  - r300 -> on host_cpu eq. x86/x86-64, check the gallium-llvm toggle
> (this is 'premature' optimisation which we might want to rework/drop
> in the long run)

Right now --enable-gallium-llvm will be set to no if it is "auto" on non x86.
gallivm/llvm use the x86 target so it probably only works there, that's why I 
did it this way. 

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


Re: [Mesa-dev] [PATCH v3 12/25] configure.ac: Move gallium LLVM checks

2016-10-12 Thread Emil Velikov
On 12 October 2016 at 00:02, Tobias Droste  wrote:
> There's already a function for gallium LLVM checks.
> Move the remaining code to this function and call it for every driver
> that uses LLVM.
>
> Signed-off-by: Tobias Droste 
> ---
>  configure.ac | 31 +--
>  1 file changed, 13 insertions(+), 18 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 283e553..61a0253 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -2310,18 +2310,6 @@ if test "x$enable_gallium_llvm" = xauto; then
>  esac
>  fi
>
> -gallium_llvm_check() {
> -LLVM_REQUIRED_VERSION_MAJOR="3"
> -LLVM_REQUIRED_VERSION_MINOR="3"
> -if test "$LLVM_VERSION_INT" -lt 
> "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
> -AC_MSG_ERROR([LLVM 
> $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is 
> required])
> -fi
> -}
> -
> -if test "x$enable_gallium_llvm" = xyes; then
> -gallium_llvm_check
> -fi
> -
>  dnl Directory for XVMC libs
>  AC_ARG_WITH([xvmc-libdir],
>  [AS_HELP_STRING([--with-xvmc-libdir=DIR],
> @@ -2378,12 +2366,16 @@ gallium_require_drm() {
>  }
>
>  gallium_require_llvm() {
> -if test "x$MESA_LLVM" = x0; then
> -case "$host" in *gnux32) return;; esac
> -case "$host_cpu" in
> -i*86|x86_64|amd64) AC_MSG_ERROR([LLVM is required to build $1 on x86 
> and x86_64]);;
> -esac
> -fi
> +case "$host" in *gnux32) return;; esac
> +case "$host_cpu" in
> +i*86|x86_64|amd64)
> +LLVM_REQUIRED_VERSION_MAJOR="3"
> +LLVM_REQUIRED_VERSION_MINOR="3"
> +if test "$LLVM_VERSION_INT" -lt 
> "${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}"; then
> +AC_MSG_ERROR([LLVM 
> $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is 
> required])
> +fi
> +;;
> +esac
>  }
>
The function it quite "ugly" as-is and this patch changes things in a fun way.

Namely: before you'll get the minimum required version check
regardless of host_cpu for everyone, while now you get the opposite -
everyone is 'constrained' by the host_cpu check. Admittedly I've have
not idea if llvmpipe is a thing on outside x86 land.

Checking the gallium_require_llvm users we want:
 - swr -> bail out if host_cpu !x86/x86-64 or gallium-llvm toggle is
off || llvm version req. is not met
 - r300 -> on host_cpu eq. x86/x86-64, check the gallium-llvm toggle
(this is 'premature' optimisation which we might want to rework/drop
in the long run)

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