[Beignet] [PATCH] support LLVM 3.4
Sun, Yi
yi.sun at intel.com
Wed Sep 25 23:22:53 PDT 2013
Hi Zhigang,
I may lose some context.
So we're upgrading LLVM to 3.4 now? It seems we just get it to 3.3 version.
Thanks
--Sun, Yi
> -----Original Message-----
> From: beignet-bounces+yi.sun=intel.com at lists.freedesktop.org
> [mailto:beignet-bounces+yi.sun=intel.com at lists.freedesktop.org] On Behalf Of
> Zhigang Gong
> Sent: Wednesday, September 25, 2013 1:42 AM
> To: Xing, Homer
> Cc: beignet at lists.freedesktop.org
> Subject: Re: [Beignet] [PATCH] support LLVM 3.4
>
> Yi,
>
> Could you help to do a fully regression test for llvm 3.4?
>
> On Tue, Sep 24, 2013 at 10:10:46AM +0800, Homer Hsing wrote:
> > LLVM 3.3 or earlier version don't support unary addition of vectors,
> > such as "++ int2". This patch supports LLVM 3.4.
> > Tested by PIGLIT, no regression.
> >
> > Signed-off-by: Homer Hsing <homer.xing at intel.com>
> > ---
> > CMake/FindLLVM.cmake | 4 ++--
> > backend/src/backend/program.cpp | 7 ++++++-
> > backend/src/llvm/llvm_gen_backend.cpp | 6 +++---
> > docs/Beignet.mdwn | 2 +-
> > 4 files changed, 12 insertions(+), 7 deletions(-)
> >
> > diff --git a/CMake/FindLLVM.cmake b/CMake/FindLLVM.cmake index
> > e76ab42..3fa9ad9 100644
> > --- a/CMake/FindLLVM.cmake
> > +++ b/CMake/FindLLVM.cmake
> > @@ -7,9 +7,9 @@
> > # LLVM_MODULE_LIBS - list of llvm libs for working with modules.
> > # LLVM_FOUND - True if llvm found.
> > if (LLVM_INSTALL_DIR)
> > - find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32
> > llvm-config-3.2 llvm-config-31 llvm-config-3.1 llvm-config DOC
> > "llvm-config executable" PATHS ${LLVM_INSTALL_DIR} NO_DEFAULT_PATH)
> > + find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32
> > + llvm-config-3.2 llvm-config-31 llvm-config-3.1 llvm-config-3.4
> > + llvm-config DOC "llvm-config executable" PATHS ${LLVM_INSTALL_DIR}
> > + NO_DEFAULT_PATH)
> > else (LLVM_INSTALL_DIR)
> > - find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32
> > llvm-config-3.2 llvm-config-31 llvm-config-3.1 llvm-config DOC
> > "llvm-config executable")
> > + find_program(LLVM_CONFIG_EXECUTABLE NAMES llvm-config-32
> > + llvm-config-3.2 llvm-config-31 llvm-config-3.1 llvm-config-3.4
> > + llvm-config DOC "llvm-config executable")
> > endif (LLVM_INSTALL_DIR)
> >
> > if (LLVM_CONFIG_EXECUTABLE)
> > diff --git a/backend/src/backend/program.cpp
> > b/backend/src/backend/program.cpp index 68bb17e..9956e11 100644
> > --- a/backend/src/backend/program.cpp
> > +++ b/backend/src/backend/program.cpp
> > @@ -535,7 +535,12 @@ namespace gbe {
> > llvm::Module *module = Act->takeModule();
> >
> > std::string ErrorInfo;
> > - llvm::raw_fd_ostream OS(output,
> ErrorInfo,llvm::raw_fd_ostream::F_Binary);
> > +#if (LLVM_VERSION_MAJOR == 3) && (LLVM_VERSION_MINOR > 3)
> > + auto mode = llvm::sys::fs::F_Binary; #else
> > + auto mode = llvm::raw_fd_ostream::F_Binary; #endif
> > + llvm::raw_fd_ostream OS(output, ErrorInfo, mode);
> > //still write to temp file for code simply, otherwise need add another
> function.
> > //because gbe_program_new_from_llvm also be used by
> cl_program_create_from_llvm, can't be removed
> > //TODO: Pass module to llvmToGen, if use module, should return
> > Act and use OwningPtr out of this funciton diff --git
> > a/backend/src/llvm/llvm_gen_backend.cpp
> > b/backend/src/llvm/llvm_gen_backend.cpp
> > index fd42dca..c8c0866 100644
> > --- a/backend/src/llvm/llvm_gen_backend.cpp
> > +++ b/backend/src/llvm/llvm_gen_backend.cpp
> > @@ -154,9 +154,9 @@
> > #define LLVM_VERSION_MINOR 0
> > #endif /* !defined(LLVM_VERSION_MINOR) */
> >
> > -#if (LLVM_VERSION_MAJOR != 3) || (LLVM_VERSION_MINOR > 3) -#error
> > "Only LLVM 3.0 - 3.3 is supported"
> > -#endif /* (LLVM_VERSION_MAJOR != 3) || (LLVM_VERSION_MINOR > 3) */
> > +#if (LLVM_VERSION_MAJOR != 3) || (LLVM_VERSION_MINOR > 4) #error
> > +"Only LLVM 3.0 - 3.4 is supported"
> > +#endif /* (LLVM_VERSION_MAJOR != 3) || (LLVM_VERSION_MINOR > 4) */
> >
> > using namespace llvm;
> >
> > diff --git a/docs/Beignet.mdwn b/docs/Beignet.mdwn index
> > c0f88de..86a235e 100644
> > --- a/docs/Beignet.mdwn
> > +++ b/docs/Beignet.mdwn
> > @@ -55,7 +55,7 @@ with any thing older.
> >
> > [http://llvm.org/releases/](http://llvm.org/releases/)
> >
> > -LLVM 3.1,3.2 and 3.3 are supported.
> > +LLVM 3.1,3.2,3.3 and 3.4 are supported.
> >
> > Also note that the code was compiled on GCC 4.6 and GCC 4.7. Since
> > the code uses really recent C++11 features, you may expect problems
> > with older compilers. Last
> > --
> > 1.8.1.2
> >
> > _______________________________________________
> > Beignet mailing list
> > Beignet at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/beignet
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet
More information about the Beignet
mailing list