[Mesa-dev] [PATCH automake] Support LLVM >= 3.2 on radeonsi and opencl.

Johannes Obermayr johannesobermayr at gmx.de
Fri Dec 21 06:23:00 PST 2012


Am Freitag, 21. Dezember 2012, 10:58:53 schrieb Mike Lothian:
> Should the warning be updated to say you can now use llvm svn master with
> --enable-experimental-targets=R600?

Nope. Tom's git repository contains the stable branch (3.2) of LLVM and what I can see most of the work is based on AMDGPU (because it is git) before it will be pushed to R600 on LLVM svn trunk.

IMHO changing the development model will cause a change of the warning message.

> On 20 Dec 2012 19:58, "Johannes Obermayr" <johannesobermayr at gmx.de> wrote:
> 
> > ---
> > Because Tom's LLVM 3.2 git repository uses AMDGPU and LLVM 3.3 trunk uses
> > R600 we must adapt Mesa a bit to support both.
> >
> > This patch works only for automake branch because it requires
> > LLVM_VERSION_INT from:
> >
> > http://cgit.freedesktop.org/~mattst88/mesa/commit/?h=automake-gallium6&id=b772e110a2d744e782114859d475d109862a672d
> >
> > Clover tested with LLVM trunk and opencl-example/run_tests.sh on AMD
> > Fusion (ASUS E35M1-I Deluxe) by me.
> > ---
> >  configure.ac                                    |   11 ++++++-----
> >  src/gallium/drivers/radeon/radeon_llvm_emit.cpp |    7 +++++++
> >  2 Dateien geändert, 13 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 03e96c7..13f6127 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1779,22 +1779,23 @@ gallium_require_drm_loader() {
> >  radeon_llvm_check() {
> >      LLVM_REQUIRED_VERSION_MAJOR="3"
> >      LLVM_REQUIRED_VERSION_MINOR="2"
> > -    LLVM_AVAILABLE_VERSION_MAJOR=`echo $LLVM_VERSION | cut -d. -f1`
> > -    LLVM_AVAILABLE_VERSION_MINOR=`echo $LLVM_VERSION | cut -d. -f2`
> > -    if test "$LLVM_AVAILABLE_VERSION_MAJOR" -lt
> > "$LLVM_REQUIRED_VERSION_MAJOR" -o [ "$LLVM_AVAILABLE_VERSION_MAJOR" -eq
> > "$LLVM_REQUIRED_VERSION_MAJOR" -a "$LLVM_AVAILABLE_VERSION_MINOR" -lt
> > "$LLVM_REQUIRED_VERSION_MINOR" ] ; then
> > +    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 with
> > AMDGPU target enabled is required.
> >                       To use the r600/radeonsi LLVM backend, you need to
> > fetch the LLVM source from:
> >                       git://people.freedesktop.org/~tstellar/llvm master
> >                       and build with --enable-experimental-targets=AMDGPU])
> >      fi
> > -    if test true && $LLVM_CONFIG --targets-built | grep -qv '\<AMDGPU\>'
> > ; then
> > +    if test true && llvm-config --targets-built | grep -v -e '\<AMDGPU\>'
> > -e '\<R600\>' >/dev/null; then
> >          AC_MSG_ERROR([LLVM AMDGPU Target not enabled.
> >                        To use the r600/radeonsi LLVM backend, you need to
> > fetch the LLVM source from:
> >                        git://people.freedesktop.org/~tstellar/llvm master
> >                        and build with
> > --enable-experimental-targets=AMDGPU])
> >      fi
> >      AC_MSG_WARN([Please ensure you use the latest llvm tree from git://
> > people.freedesktop.org/~tstellar/llvm master before submitting a bug])
> > -    if test "x$LLVM_VERSION" = "x3.2"; then
> > +    if test "$LLVM_VERSION_INT" -ge "303"; then
> > +        LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs r600`"
> > +    fi
> > +    if test "$LLVM_VERSION_INT" -eq "302"; then
> >          LLVM_LIBS="$LLVM_LIBS `$LLVM_CONFIG --libs amdgpu`"
> >      fi
> >  }
> > diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
> > b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
> > index 21661a0..3ffd997 100644
> > --- a/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
> > +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.cpp
> > @@ -89,10 +89,17 @@ radeon_llvm_compile(LLVMModuleRef M, unsigned char **
> > bytes,
> >
> >     Triple AMDGPUTriple(sys::getDefaultTargetTriple());
> >
> > +#if HAVE_LLVM == 0x0302
> >     LLVMInitializeAMDGPUTargetInfo();
> >     LLVMInitializeAMDGPUTarget();
> >     LLVMInitializeAMDGPUTargetMC();
> >     LLVMInitializeAMDGPUAsmPrinter();
> > +#else
> > +   LLVMInitializeR600TargetInfo();
> > +   LLVMInitializeR600Target();
> > +   LLVMInitializeR600TargetMC();
> > +   LLVMInitializeR600AsmPrinter();
> > +#endif
> >
> >     std::string err;
> >     const Target * AMDGPUTarget = TargetRegistry::lookupTarget("r600",
> > err);
> > --
> > 1.7.10.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