[Beignet] beignet doesnt compile with LLVM 3.6

Yang, Rong R rong.r.yang at intel.com
Tue Feb 3 19:03:25 PST 2015


Hi,

The llvm 3.6 supporting is in process.
Beignet backend use LLVM IR as input, and llvm 3.6 will produce lots of new non-stander width integer IR, such as i3, i7 and more large integers, need legalize in beignet, Ruiling has some changes and still working on it.
To fully support the new llvm version, only pass the build is not enough. So beignet only support the released llvm, it is hard to support llvm mainstream, for example llvm3.7.

Thanks

From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of Paulo Dias
Sent: Tuesday, February 3, 2015 02:33
To: Yang, Rong R
Cc: junyan.he at linux.intel.com; beignet at lists.freedesktop.org; Zhenyu Wang
Subject: Re: [Beignet] beignet doesnt compile with LLVM 3.6

Hi, im still unable to compile beignet with llvm 3.6/3.7 git.

I get this errors:

In file included from /usr/lib/llvm-3.6/include/clang/AST/Decl.h:17:0,
                 from /usr/lib/llvm-3.6/include/clang/AST/ASTTypeTraits.h:20,
                 from /usr/lib/llvm-3.6/include/clang/AST/ASTContext.h:18,
                 from /usr/lib/llvm-3.6/include/clang/Frontend/ASTUnit.h:18,
                 from /usr/lib/llvm-3.6/include/clang/Frontend/FrontendAction.h:24,
                 from /usr/lib/llvm-3.6/include/clang/CodeGen/CodeGenAction.h:13,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/backend/program.cpp:64:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue::APSInt& clang::APValue::getInt()’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:202:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return *(APSInt*)(char*)Data.buffer;
                                  ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue::APFloat& clang::APValue::getFloat()’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:210:35: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return *(APFloat*)(char*)Data.buffer;
                                   ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue::APSInt& clang::APValue::getComplexIntReal()’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:218:48: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((ComplexAPSInt*)(char*)Data.buffer)->Real;
                                                ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue::APSInt& clang::APValue::getComplexIntImag()’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:226:48: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((ComplexAPSInt*)(char*)Data.buffer)->Imag;
                                                ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue::APFloat& clang::APValue::getComplexFloatReal()’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:234:49: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((ComplexAPFloat*)(char*)Data.buffer)->Real;
                                                 ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue::APFloat& clang::APValue::getComplexFloatImag()’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:242:49: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((ComplexAPFloat*)(char*)Data.buffer)->Imag;
                                                 ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue& clang::APValue::getVectorElt(unsigned int)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:261:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((Vec*)(char*)Data.buffer)->Elts[I];
                                      ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘unsigned int clang::APValue::getVectorLength() const’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:268:51: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((const Vec*)(const void *)Data.buffer)->NumElts;
                                                   ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue& clang::APValue::getArrayInitializedElt(unsigned int)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:274:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((Arr*)(char*)Data.buffer)->Elts[I];
                                      ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue& clang::APValue::getArrayFiller()’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:285:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((Arr*)(char*)Data.buffer)->Elts[getArrayInitializedElts()];
                                      ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘unsigned int clang::APValue::getArrayInitializedElts() const’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:292:51: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((const Arr*)(const void *)Data.buffer)->NumElts;
                                                   ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘unsigned int clang::APValue::getArraySize() const’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:296:51: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((const Arr*)(const void *)Data.buffer)->ArrSize;
                                                   ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘unsigned int clang::APValue::getStructNumBases() const’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:301:57: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((const StructData*)(const char*)Data.buffer)->NumBases;
                                                         ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘unsigned int clang::APValue::getStructNumFields() const’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:305:57: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((const StructData*)(const char*)Data.buffer)->NumFields;
                                                         ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue& clang::APValue::getStructBase(unsigned int)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:309:45: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((StructData*)(char*)Data.buffer)->Elts[i];
                                             ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue& clang::APValue::getStructField(unsigned int)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:313:45: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((StructData*)(char*)Data.buffer)->Elts[getStructNumBases() + i];
                                             ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘const clang::FieldDecl* clang::APValue::getUnionField() const’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:324:56: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((const UnionData*)(const char*)Data.buffer)->Field;
                                                        ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘clang::APValue& clang::APValue::getUnionValue()’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:328:45: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return *((UnionData*)(char*)Data.buffer)->Value;
                                             ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘const clang::AddrLabelExpr* clang::APValue::getAddrLabelDiffLHS() const’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:340:64: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((const AddrLabelDiffData*)(const char*)Data.buffer)->LHSExpr;
                                                                ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘const clang::AddrLabelExpr* clang::APValue::getAddrLabelDiffRHS() const’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:344:64: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     return ((const AddrLabelDiffData*)(const char*)Data.buffer)->RHSExpr;
                                                                ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘void clang::APValue::setInt(clang::APValue::APSInt)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:349:29: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     *(APSInt *)(char *)Data.buffer = std::move(I);
                             ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘void clang::APValue::setFloat(clang::APValue::APFloat)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:353:30: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     *(APFloat *)(char *)Data.buffer = std::move(F);
                              ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘void clang::APValue::setVector(const clang::APValue*, unsigned int)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:357:31: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((Vec*)(char*)Data.buffer)->Elts = new APValue[N];
                               ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:358:31: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((Vec*)(char*)Data.buffer)->NumElts = N;
                               ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:360:33: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
       ((Vec*)(char*)Data.buffer)->Elts[i] = E[i];
                                 ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘void clang::APValue::setComplexInt(clang::APValue::APSInt, clang::APValue::APSInt)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:366:43: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((ComplexAPSInt *)(char *)Data.buffer)->Real = std::move(R);
                                           ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:367:43: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((ComplexAPSInt *)(char *)Data.buffer)->Imag = std::move(I);
                                           ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘void clang::APValue::setComplexFloat(clang::APValue::APFloat, clang::APValue::APFloat)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:373:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((ComplexAPFloat *)(char *)Data.buffer)->Real = std::move(R);
                                            ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:374:44: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((ComplexAPFloat *)(char *)Data.buffer)->Imag = std::move(I);
                                            ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘void clang::APValue::setUnion(const clang::FieldDecl*, const clang::APValue&)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:383:37: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((UnionData*)(char*)Data.buffer)->Field = Field;
                                     ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:384:38: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     *((UnionData*)(char*)Data.buffer)->Value = Value;
                                      ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h: In member function ‘void clang::APValue::setAddrLabelDiff(const clang::AddrLabelExpr*, const clang::AddrLabelExpr*)’:
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:388:45: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((AddrLabelDiffData*)(char*)Data.buffer)->LHSExpr = LHSExpr;
                                             ^
/usr/lib/llvm-3.6/include/clang/AST/APValue.h:389:45: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     ((AddrLabelDiffData*)(char*)Data.buffer)->RHSExpr = RHSExpr;
                                             ^
In file included from /home/groo/devel/intel/beignet/beignet/backend/src/./sys/vector.hpp:28:0,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/./ir/register.hpp:27,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/./ir/instruction.hpp:27,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/./backend/context.hpp:23,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/backend/program.hpp:29,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/backend/program.cpp:26:
/usr/lib/llvm-3.6/include/llvm/Support/SpecialCaseList.h: At global scope:
/home/groo/devel/intel/beignet/beignet/backend/src/./sys/platform.hpp:263:12: error: expected ‘,’ or ‘...’ before ‘(’ token
 #define MB (KB*KB)
            ^
/usr/lib/llvm-3.6/include/llvm/Support/SpecialCaseList.h:67:70: note: in expansion of macro ‘MB’
   static std::unique_ptr<SpecialCaseList> create(const MemoryBuffer *MB,
                                                                      ^
/home/groo/devel/intel/beignet/beignet/backend/src/./sys/platform.hpp:263:12: error: expected ‘,’ or ‘...’ before ‘(’ token
 #define MB (KB*KB)
            ^
/usr/lib/llvm-3.6/include/llvm/Support/SpecialCaseList.h:92:34: note: in expansion of macro ‘MB’
   bool parse(const MemoryBuffer *MB, std::string &Error);
                                  ^
/home/groo/devel/intel/beignet/beignet/backend/src/backend/program.cpp: In function ‘bool gbe::buildModuleFromSource(const char*, llvm::Module**, llvm::LLVMContext*, std::vector<std::basic_string<char> >&, size_t, char*, size_t*)’:
/home/groo/devel/intel/beignet/beignet/backend/src/backend/program.cpp:624:44: error: cannot convert ‘std::unique_ptr<llvm::Module>’ to ‘llvm::Module*’ in initialization
     llvm::Module *module = Act->takeModule();
                                            ^
backend/src/CMakeFiles/gbe.dir/build.make:586<http://gbe.dir/build.make:586>: recipe for target 'backend/src/CMakeFiles/gbe.dir/backend/program.cpp.o<http://gbe.dir/backend/program.cpp.o>' failed
make[3]: *** [backend/src/CMakeFiles/gbe.dir/backend/program.cpp.o<http://gbe.dir/backend/program.cpp.o>] Error 1
make[3]: Leaving directory '/home/groo/devel/intel/beignet/beignet'
CMakeFiles/Makefile2:115: recipe for target 'backend/src/CMakeFiles/gbe.dir/all<http://gbe.dir/all>' failed
make[2]: *** [backend/src/CMakeFiles/gbe.dir/all<http://gbe.dir/all>] Error 2

can you take a look at this?

thanks in advance :)

| Paulo Dias
| paulo.miguel.dias at gmail.com<mailto:paulo.miguel.dias at gmail.com>

Tempora mutantur, nos et mutamur in illis.

On Tue, Dec 16, 2014 at 12:19 AM, Yang, Rong R <rong.r.yang at intel.com<mailto:rong.r.yang at intel.com>> wrote:
I planned to support llvm3.6 before. But after fix all llvm3.6 compiler errors, there are some beignet’s utests fails.
Because llvm 3.6 seems has some bugs in that time and it’s release schedule delayed, I pending it.
Now, I will restart supporting and need some time.

Thanks
From: Beignet [mailto:beignet-bounces at lists.freedesktop.org<mailto:beignet-bounces at lists.freedesktop.org>] On Behalf Of Paulo Dias
Sent: Monday, December 15, 2014 19:47
To: Zhenyu Wang; Yang, Rong R
Cc: junyan.he at linux.intel.com<mailto:junyan.he at linux.intel.com>; beignet at lists.freedesktop.org<mailto:beignet at lists.freedesktop.org>
Subject: Re: [Beignet] beignet doesnt compile with LLVM 3.6

Hi to you,

sorry to bother you guys again, but llvm 3.6 is almost out and beignet still doesnt compile with the latest git:

In file included from /home/groo/devel/intel/beignet/beignet/backend/src/./sys/vector.hpp:28:0,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/./ir/register.hpp:27,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/./ir/instruction.hpp:27,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/./backend/context.hpp:23,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/backend/program.hpp:29,
                 from /home/groo/devel/intel/beignet/beignet/backend/src/backend/program.cpp:26:
/usr/lib/llvm-3.6/include/llvm/Support/SpecialCaseList.h: At global scope:
/home/groo/devel/intel/beignet/beignet/backend/src/./sys/platform.hpp:263:12: error: expected ‘,’ or ‘...’ before ‘(’ token
 #define MB (KB*KB)
            ^
/usr/lib/llvm-3.6/include/llvm/Support/SpecialCaseList.h:67:70: note: in expansion of macro ‘MB’
   static std::unique_ptr<SpecialCaseList> create(const MemoryBuffer *MB,
                                                                      ^
/home/groo/devel/intel/beignet/beignet/backend/src/./sys/platform.hpp:263:12: error: expected ‘,’ or ‘...’ before ‘(’ token
 #define MB (KB*KB)
            ^
/usr/lib/llvm-3.6/include/llvm/Support/SpecialCaseList.h:92:34: note: in expansion of macro ‘MB’
   bool parse(const MemoryBuffer *MB, std::string &Error);
                                  ^
/home/groo/devel/intel/beignet/beignet/backend/src/backend/program.cpp: In function ‘bool gbe::buildModuleFromSource(const char*, llvm::Module**, llvm::LLVMContext*, std::vector<std::basic_string<char> >&, size_t, char*, size_t*)’:
/home/groo/devel/intel/beignet/beignet/backend/src/backend/program.cpp:614:44: error: cannot convert ‘std::unique_ptr<llvm::Module>’ to ‘llvm::Module*’ in initialization
     llvm::Module *module = Act->takeModule();
                                            ^
backend/src/CMakeFiles/gbe.dir/build.make:586<http://gbe.dir/build.make:586>: recipe for target 'backend/src/CMakeFiles/gbe.dir/backend/program.cpp.o<http://gbe.dir/backend/program.cpp.o>' failed
make[2]: *** [backend/src/CMakeFiles/gbe.dir/backend/program.cpp.o<http://gbe.dir/backend/program.cpp.o>] Error 1
CMakeFiles/Makefile2:114: recipe for target 'backend/src/CMakeFiles/gbe.dir/all<http://gbe.dir/all>' failed

could you guys take a look at it?

thanks in advance

Paulo Dias

On Tue Nov 04 2014 at 5:18:25 AM Zhenyu Wang <zhenyuw at linux.intel.com<mailto:zhenyuw at linux.intel.com>> wrote:
On 2014.11.03 08:46:41 +0000, Yang, Rong R wrote:
> Yes, some errors is because llvm use std:: unique_ptr as some function’s return
> value instead of the normal ptr, there are some other errors after fix std::
> unique_ptr error.
>
> As we notice that LLVM plan to release LLVM/Clang 3.6 soon, suppose the LLVM
> 3.6 approach to stable now, I am working to support LLVM 3.6 now. Hope could
> finish it soon.
>

One option is to explicitly say the llvm version that beignet does support
and refuse to go on otherwise, like below one?

From: Zhenyu Wang <zhenyuw at linux.intel.com<mailto:zhenyuw at linux.intel.com>>
Date: Tue, 4 Nov 2014 15:14:44 +0800
Subject: [PATCH] Explicitly check LLVM version when building

Instead of allowing for failure attemps to build with llvm unstable
version this trys to explicitly tell the llvm version that beignet support.

Signed-off-by: Zhenyu Wang <zhenyuw at linux.intel.com<mailto:zhenyuw at linux.intel.com>>
---
 CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 40cb74c..7059b2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,9 @@ set (CMAKE_C_FLAGS_RELEASE        "-O2 -DNDEBUG -DGBE_DEBUG=0")
 # Front end stuff we need
 #INCLUDE(CMake/FindLLVM.cmake)
 Find_Package(LLVM 3.3)
+IF(LLVM_VERSION VERSION_GREATER 3.5)
+  MESSAGE(FATAL_ERROR "Don't support LLVM > 3.5 now.")
+ENDIF(LLVM_VERSION VERSION_GREATER 3.5)

 set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${LLVM_LDFLAGS}")

--
2.1.1

--
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net<http://wwwkeys.pgp.net> --recv-keys 4D781827

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20150204/a73c3284/attachment-0001.html>


More information about the Beignet mailing list