llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.76k stars 11.89k forks source link

[powerpc-ubuntu] build failed with -maltivec option #24914

Open llvmbot opened 9 years ago

llvmbot commented 9 years ago
Bugzilla Link 24540
Version 3.7
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @AnastasiaStulova,@hfinkel,@nemanjai

Extended Description

I am using the latest LLVM/Clang Version: llc -version = LLVM (http://llvm.org/): LLVM version 3.8.0svn Optimized build with assertions. Built Aug 21 2015 (11:35:26). Default target: powerpc64le-unknown-linux-gnu Host CPU: pwr8

Registered Targets: ppc32 - PowerPC 32 ppc64 - PowerPC 64 ppc64le - PowerPC 64 LE clang --version = clang version 3.8.0 (trunk 245701)

When include the -maltivec in the compiler option i am seeing the following build error:

In file included from :332: In file included from :6: /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:122:35: error: passing 'vector long long' (vector of 1 'long long' value) to parameter of incompatible type 'attribute((vector_size(2 * sizeof(long long)))) long long' (vector of 2 'long long' values) return builtin_altivec_vmaxsd(a, -a); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:134:59: error: excess elements in vector initializer vector unsigned long long res = { 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF }; ^~~~~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:401:36: error: passing 'vector int128' (vector of 1 'int128' value) to parameter of incompatible type 'attribute((vector_size(1 * sizeof(unsigned int128)))) unsigned int128' (vector of 1 'unsigned int128' value) return builtin_altivec_vaddcuq(a, b); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:624:37: error: passing 'vector int128' (vector of 1 'int128' value) to parameter of incompatible type 'attribute((__vector_size(1 sizeof(unsigned int128)))) unsigned int128' (vector of 1 'unsigned int128' value) return builtin_altivec_vaddeuqm(a, b, c); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:637:36: error: passing 'vector int128' (vector of 1 'int128' value) to parameter of incompatible type 'attribute((__vector_size__(1 sizeof(unsigned int128)))) unsigned int128' (vector of 1 'unsigned int128' value) return builtin_altivec_vaddcuq(a, b); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:650:37: error: passing 'vector int128' (vector of 1 'int128' value) to parameter of incompatible type 'attribute((vector_size(1 * sizeof(unsigned int128)))) unsigned int128' (vector of 1 'unsigned int128' value) return builtin_altivec_vaddecuq(a, b, c); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1489:60: error: passing 'vector long long' (vector of 1 'long long' value) to parameter of incompatible type 'attribute((vector_size(2 * sizeof(long long)))) long long' (vector of 2 'long long' values) return (vector bool long long)builtin_altivec_vcmpequd(a, b); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1495:7: error: passing 'vector long long' (vector of 1 'long long' value) to parameter of incompatible type 'attribute((vector_size(2 * sizeof(long long)))) long long' (vector of 2 'long long' values) (vector long long)a, (vector long long)b); ^~~~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1511:10: error: invalid conversion between vector type 'vector bool unsigned long long' (vector of 1 'unsigned long long' value) and 'attribute((vector_size(2 * sizeof(unsigned long long)))) unsigned long long' (vector of 2 'unsigned long long' values) of different size return (vector bool long long)builtin_vsx_xvcmpeqdp(a, b); ^~~~~~~~~~~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1529:10: error: invalid conversion between vector type 'vector bool unsigned long long' (vector of 1 'unsigned long long' value) and 'attribute((vector_size(2 * sizeof(unsigned long long)))) unsigned long long' (vector of 2 'unsigned long long' values) of different size return (vector bool long long)builtin_vsx_xvcmpgedp(a, b); ^~~~~~~~~~~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1592:60: error: passing 'vector long long' (vector of 1 'long long' value) to parameter of incompatible type 'attribute((vector_size(2 sizeof(long long)))) long long' (vector of 2 'long long' values) return (vector bool long long)builtin_altivec_vcmpgtsd(a, b); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1597:60: error: passing 'vector unsigned long long' (vector of 1 'unsigned long long' value) to parameter of incompatible type 'attribute((__vector_size__(2 sizeof(unsigned long long)))) unsigned long long' (vector of 2 'unsigned long long' values) return (vector bool long long)builtin_altivec_vcmpgtud(a, b); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1613:10: error: invalid conversion between vector type 'vector bool unsigned long long' (vector of 1 'unsigned long long' value) and 'attribute((vector_size(2 * sizeof(unsigned long long)))) unsigned long long' (vector of 2 'unsigned long long' values) of different size return (vector bool long long)builtin_vsx_xvcmpgtdp(a, b); ^~~~~~~~~~~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1748:34: error: passing 'vector signed char' (vector of 16 'signed char' values) to parameter of incompatible type 'attribute((vector_size(16 * sizeof(unsigned char)))) unsigned char' (vector of 16 'unsigned char' values) return builtin_altivec_vclzb(a); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1754:34: error: passing 'vector short' (vector of 8 'short' values) to parameter of incompatible type 'attribute((vector_size(8 * sizeof(unsigned short)))) unsigned short' (vector of 8 'unsigned short' values) return builtin_altivec_vclzh(a); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1760:34: error: passing 'vector int' (vector of 4 'int' values) to parameter of incompatible type 'attribute((__vector_size(4 sizeof(unsigned int)))) unsigned int' (vector of 4 'unsigned int' values) return builtin_altivec_vclzw(a); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1767:34: error: passing 'vector long long' (vector of 1 'long long' value) to parameter of incompatible type 'attribute((vector_size__(2 sizeof(unsigned long long)))) unsigned long long' (vector of 2 'unsigned long long' values) return builtin_altivec_vclzd(a); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:1771:34: error: passing 'vector unsigned long long' (vector of 1 'unsigned long long' value) to parameter of incompatible type 'attribute((vector_size(2 * sizeof(unsigned long long)))) unsigned long long' (vector of 2 'unsigned long long' values) return builtin_altivec_vclzd(a); ^~~ /home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:2962:35: error: passing 'vector long long' (vector of 1 'long long' value) to parameter of incompatible type 'attribute((__vector_size(2 * sizeof(long long)))) long long' (vector of 2 'long long' values) return builtin_altivec_vmaxsd(a, b); ^~~ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. makefile:3: recipe for target 'kernel.ocl' failed make: *** [kernel.ocl] Error 1

-=------------------------------------------------------------------------

Let me know if you need any additional information: OpenCL kernel is very simple, I only wanted to test the -maltivec option using it.

AnastasiaStulova commented 8 years ago

It seems like you are mixing OpenCL with AltiVec extension. This isn't really legal usage. Primarily because OpenCL has its own vector support and PPC target is not OpenCL capable I believe.

If the problem is still relevant could you explain what you are trying to achieve and perhaps provide the command line you are running with an example code.

llvmbot commented 9 years ago

OK. Well, I haven't got a clue about the OpenCL front end, but it sounds to me like it has a bug with assumptions about vector types. Hopefully you can find an OpenCL front-end person to sort this out.

llvmbot commented 9 years ago

There seems to be something strange about your environment. Consider:

/altivec.h:122:35: error: passing 'vector long long' (vector of 1 'long long' value) to parameter of incompatible type 'attribute((vector_size(2 * sizeof(long long)))) long long' (vector of 2 'long long' values) return builtin_altivec_vmaxsd(a, -a); ^~~

"vector long long" is defined as a vector of two 64-bit integers. The error message you are seeing indicates that a vector long long is a single long long value, which would be one 64-bit integer. That makes no sense on a Power machine, and these built-ins have been tested to work properly on Linux.

Consider also:

/home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/ altivec.h:134:59: error: excess elements in vector initializer vector unsigned long long __res = { 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF }; ^~~~~~ Once again, here we are initializing a vector long long with two 64-bit quantities, which is correct. In your environment, a vector long long has somehow been redefined to be a single 64-bit quantity, so you see this error message. This is just bizarre.

You did not specify the operating system you were using. Also, was this a build with the GNU autoconf tools, or was it a cmake build?

There must be something very non-standard in your setup to see these results.

Hey, sorry i forgot those information.

So I am running the test on operatin system ubuntu 3.16.7-ckt2.

Also, forgot to mention I am hitting this problem when trying to compile altivec.h with ocl front end. i.e: clang -xcl -std=CL1.2 altivectest.cl -o kernel.ocl -m64 -mvsx -maltivec

llvmbot commented 9 years ago

There seems to be something strange about your environment. Consider:

/altivec.h:122:35: error: passing 'vector long long' (vector of 1 'long long' value) to parameter of incompatible type 'attribute((vector_size(2 * sizeof(long long)))) long long' (vector of 2 'long long' values) return builtin_altivec_vmaxsd(a, -a); ^~~

"vector long long" is defined as a vector of two 64-bit integers. The error message you are seeing indicates that a vector long long is a single long long value, which would be one 64-bit integer. That makes no sense on a Power machine, and these built-ins have been tested to work properly on Linux.

Consider also:

/home/kajank/compiler/llvm/Release+Asserts/bin/../lib/clang/3.8.0/include/altivec.h:134:59: error: excess elements in vector initializer vector unsigned long long __res = { 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFF }; ^~~~~~ Once again, here we are initializing a vector long long with two 64-bit quantities, which is correct. In your environment, a vector long long has somehow been redefined to be a single 64-bit quantity, so you see this error message. This is just bizarre.

You did not specify the operating system you were using. Also, was this a build with the GNU autoconf tools, or was it a cmake build?

There must be something very non-standard in your setup to see these results.