[Mesa-dev] [PATCH] configure: Add --with-llvm-shared-libs

Tom Stellard tstellar at gmail.com
Thu Mar 29 05:50:38 PDT 2012


On Thu, Mar 29, 2012 at 12:07:46AM -0700, Jose Fonseca wrote:
> Looks good to me.
> 
> It's disabled by default, which is important because upstream doesn't really support shared llvm libs -- it's something that distros are doing on their initiative.
> 
> Also note that this will saves disk at the expense of runtime memory -- as the shared LLVM library will contain the _whole_ LLVM, and not just the components targets needed, and given that there is usually only xxx_dri.so module on a system at a time, that means a net increase. libLLMVM-3.0 is 22MB on my system, which means 22MB - 13MB = +9MB of increased memory usage. Linux kernel may page out some portions to disk though.

libLLVM-2.9.so is much smaller at only 12.4 MB (though it probably depends
on how many backends were built).  I checked again, and I  miscalculated
the space savings of the r300 targets, they're really only 11.1 MB smaller.
Anyway you're right for the single xxx_dri.so use case it will increase
memory usage.

LLVM shared libs should help a lot with the clover state tracker, because
libOpenCL.so depends on LLVM as do some of the pipe drivers it loads,
like r600_pipe.so.  It is also very useful for development purposes,
because with shared libraries, I don't need to rebuild mesa every time I
make a change to LLVM.

-Tom

> 
> Jose
> 
> ----- Original Message -----
> > From: Tom Stellard <tstellar at gmail.com>
> > 
> > This option allows targets to link against the LLVM shared library
> > instead of the static libs.  With LLVM 2.9, his saves ~13 MB for each
> > of
> > the r300 target libraries.
> > ---
> >  configure.ac |   15 +++++++++++++--
> >  1 files changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index ac7d49f..4ff02e4 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1779,6 +1779,13 @@ AC_ARG_ENABLE([gallium-llvm],
> >          [build gallium LLVM support @<:@default=enabled on
> >          x86/x86_64@:>@])],
> >      [enable_gallium_llvm="$enableval"],
> >      [enable_gallium_llvm=auto])
> > +
> > +AC_ARG_WITH([llvm-shared-libs],
> > +    [AS_HELP_STRING([--with-llvm-shared-libs],
> > +        [link with LLVM shared libraries
> > @<:@default=disabled@:>@])],
> > +    [with_llvm_shared_libs=yes],
> > +    [with_llvm_shared_libs=no])
> > +
> >  if test "x$with_gallium_drivers" = x; then
> >      enable_gallium_llvm=no
> >  fi
> > @@ -1793,8 +1800,12 @@ if test "x$enable_gallium_llvm" = xyes; then
> >      if test "x$LLVM_CONFIG" != xno; then
> >  	LLVM_VERSION=`$LLVM_CONFIG --version | sed 's/svn.*//g'`
> >  	LLVM_CFLAGS=`$LLVM_CONFIG --cppflags|sed -e 's/-DNDEBUG\>//g' -e
> >  	's/-pedantic//g'`
> > -	LLVM_LIBS="`$LLVM_CONFIG --libs engine bitwriter`"
> > -
> > +	if test "x$with_llvm_shared_libs" = xyes; then
> > +	    dnl We can't use $LLVM_VERSION because it has 'svn' stripped
> > out,
> > +	    LLVM_LIBS="-lLLVM-`$LLVM_CONFIG --version`"
> > +	else
> > +	    LLVM_LIBS="`$LLVM_CONFIG --libs engine bitwriter`"
> > +	fi
> >  	LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
> >  	DEFINES="$DEFINES -D__STDC_CONSTANT_MACROS"
> >  	MESA_LLVM=1
> > --
> > 1.7.3.4
> > 
> > _______________________________________________
> > mesa-dev mailing list
> > mesa-dev at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> > 


More information about the mesa-dev mailing list