[Beignet] opencl-1.2 branch head compile error and warnings

Zhigang Gong zhigang.gong at linux.intel.com
Wed Jan 8 20:33:58 PST 2014


On Wed, Jan 08, 2014 at 08:39:28PM +0100, Robert Jobbagy wrote:
> Thanks your help.
> 
> First of all I use this llvm version :
> https://launchpad.net/ubuntu/saucy/+source/llvm-toolchain-3.3
> 
> I update to HEAD and I gave two errors :
> 
> first :
> 
> [  0%] Generating ocl_barrier.ll.bc
> llvm-as:
> /home/evil85/workspace/cpp/beignet_opencl_1_2/backend/src/ocl_barrier.ll:13:43:
> error: expected '{' in function body
> define void @barrier(i32 %flags) nounwind noduplicate alwaysinline {

"noduplicate" can't be removed here. It's weird that llvm-as 3.3 should support noduplicate
attribute. Could you double check the llvm-as version by execute:
llvm-as --version
manually?

>                                           ^
> make[2]: *** [backend/src/ocl_barrier.ll.bc] Error 1
> make[1]: *** [backend/src/CMakeFiles/beignet.bc.dir/all] Error 2
> 
> 
> This modification is fixed it :
> 
> --- a/backend/src/ocl_barrier.ll
> +++ b/backend/src/ocl_barrier.ll
> @@ -10,7 +10,7 @@ declare void @__gen_ocl_barrier_local() nounwind
> alwaysinline
>  declare void @__gen_ocl_barrier_global() nounwind alwaysinline
>  declare void @__gen_ocl_barrier_local_and_global() nounwind alwaysinline
> 
> -define void @barrier(i32 %flags) nounwind noduplicate alwaysinline {
> +define void @barrier(i32 %flags) nounwind alwaysinline {
>    %1 = icmp eq i32 %flags, 3
>    br i1 %1, label %barrier_local_global, label %barrier_local_check
> 
> 
> second :
> 
> In file included from
> /home/evil85/workspace/cpp/beignet_opencl_1_2/src/cl_khr_icd.c:18:0:
> /usr/include/ocl_icd.h:744:5: error: unknown type name
> ‘cl_device_partition_property’
>      const cl_device_partition_property * /* properties */,
>      ^
> /usr/include/ocl_icd.h:748:5: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or
> ‘__attribute__’ before ‘CL_API_SUFFIX__VERSION_1_2’
>    ) CL_API_SUFFIX__VERSION_1_2;
>      ^
> make[2]: *** [src/CMakeFiles/cl.dir/cl_khr_icd.c.o] Error 1
> make[1]: *** [src/CMakeFiles/cl.dir/all] Error 2
> make: *** [all] Error 2
> 
> 
> Solution:
> 
> I applied your CL: back port ICD support to 1.1. branch patch on my 1.2
> branch and everything compiled fine :)
This sympton means it is on the master branch rather the opencl-1.2 branch.

If it is opencl-1.2 branch, then it uses those opencl 1.2 header files which
should not have this compilation problem. This compilation problem will only
be triggerred with opencl 1.1 header file included. And my patch is to fix that
with 1.1 header files.

> 
> 
> 
> 2014/1/8 Zhigang Gong <zhigang.gong at linux.intel.com>
> 
> > I'm using 3.3.1 which works fine on the 1.2 branch. From the warning
> > messages
> > you gave below, I doubt there maybe some conflict llvm/clang version
> > problem
> > on your system. You can see the first warning is totally triggerred by the
> > llvm
> > and clang's header files. If you have a clean 3.3 clang/llvm installation
> > in your
> > system, that should not happen.
> >
> > Another issue is that now we only support llvm/clang 3.3 but the cmake
> > will find
> > some earlier version of llvm. Simon already submitted a patch to fix that.
> > I just
> > modified it slightly and push it to both master branch and opencl-1.2
> > branch.
> >
> > My suggestion for you is to update to the latest opencl-1.2 branch. And
> > make
> > sure you have a clean llvm/clang 3.3 installation and try it again.
> >
> > Thanks for reporting this to us and good luck.
> >
> > On Tue, Jan 07, 2014 at 06:27:55PM +0100, Robert Jobbagy wrote:
> > > Hi,
> > >
> > > After the update I gave this error :
> > >
> > > /beignet_opencl_1_2/backend/src/ocl_barrier.ll:9:50: error: expected
> > > top-level entity
> > > declare void @__gen_ocl_barrier_local() nounwind noduplicate alwaysinline
> > >                                                  ^
> > > make[2]: *** [backend/src/ocl_barrier.ll.bc] Error 1
> > > make[1]: *** [backend/src/CMakeFiles/beignet.bc.dir/all] Error 2
> > > make[1]: *** Waiting for unfinished jobs....
> > >
> > > I used llvm 3.3-5ubuntu4
> > >
> > > workaround:
> > > I removed all noduplicate marker from declares and defines
> > >
> > > I saw these warnings too:
> > >
> > > In file included from
> > > /usr/lib/llvm-3.3/include/clang/Basic/VersionTuple.h:19:0,
> > >                  from
> > > /usr/lib/llvm-3.3/include/clang/Basic/ObjCRuntime.h:18,
> > >                  from
> > > /usr/lib/llvm-3.3/include/clang/Basic/LangOptions.h:20,
> > >                  from
> > > /usr/lib/llvm-3.3/include/clang/Frontend/FrontendAction.h:22,
> > >                  from
> > > /usr/lib/llvm-3.3/include/clang/CodeGen/CodeGenAction.h:13,
> > >                  from
> > >
> > /home/evil85/workspace/cpp/beignet_opencl_1_2/backend/src/backend/program.cpp:56:
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h: In instantiation of ‘T*
> > > llvm::Optional<T>::getPointer() [with T = unsigned int]’:
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h:123:76:   required from ‘T&
> > > llvm::Optional<T>::operator*() [with T = unsigned int]’
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h:51:7:   required from
> > > ‘llvm::Optional<T>::Optional(llvm::Optional<T>&&) [with T = unsigned
> > int]’
> > > /usr/lib/llvm-3.3/include/clang/Basic/VersionTuple.h:60:14:   required
> > from
> > > here
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h:114:79: warning:
> > > dereferencing type-punned pointer will break strict-aliasing rules
> > > [-Wstrict-aliasing]
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h: In instantiation of ‘T*
> > > llvm::Optional<T>::getPointer() [with T = bool]’:
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h:123:76:   required from ‘T&
> > > llvm::Optional<T>::operator*() [with T = bool]’
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h:104:7:   required from
> > ‘void
> > > llvm::Optional<T>::reset() [with T = bool]’
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h:110:5:   required from
> > > ‘llvm::Optional<T>::~Optional() [with T = bool]’
> > >
> > /usr/lib/llvm-3.3/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h:397:27:
> > >   required from here
> > > /usr/lib/llvm-3.3/include/llvm/ADT/Optional.h:114:79: warning:
> > > dereferencing type-punned pointer will break strict-aliasing rules
> > > [-Wstrict-aliasing]
> > >
> > >
> > /home/evil85/workspace/cpp/beignet_opencl_1_2/backend/src/backend/program.cpp:652:
> > > warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
> > >
> > >
> > > I made something wrong ? Previous version (2013-12-05) compiled fine.
> > >
> > >
> > >
> > >
> > > --
> > > Best Regards,
> > >
> > > Robert
> >
> > > _______________________________________________
> > > Beignet mailing list
> > > Beignet at lists.freedesktop.org
> > > http://lists.freedesktop.org/mailman/listinfo/beignet
> >
> >
> 
> 
> -- 
> Best Regards,
> 
> Robert


More information about the Beignet mailing list