FS#32661 - [opencv] built with SSE2 instructions on

Attached to Project: Arch Linux
Opened by Hartmut Seichter (seichterh) - Wednesday, 14 November 2012, 22:20 GMT
Last edited by Ray Rashif (schivmeister) - Tuesday, 20 November 2012, 13:29 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Ray Rashif (schivmeister)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Unlike recent versions (2.4.2) and unlike the x86_64 version the i686 version seems to be built with SSE2/SSE3 instructions switched on. This breaks things quite subtle on older machines that only have SSE and MMX. Disabling optimizations via cv::setOptimize does not effect this as these are generated on compile time.

Additional info:
* package version(s) 2.4.3-2

Steps to reproduce:
Build against the library with code such as cv::Kalman (uses heavily cv::gemm) or cv::getPerspectiveTransform (uses cv::JacobiSVD_Impl) which will segfault. Disassembly shows instructions such as movddup %xmm1,%xmm4 (which is SSE3).

IMHO if somebody needs heavily optimized libs they should not rely on the distribution shipped version.
This task depends upon

Closed by  Ray Rashif (schivmeister)
Tuesday, 20 November 2012, 13:29 GMT
Reason for closing:  Fixed
Additional comments about closing:  Rolled with 2.4.3-3. Note that even SSE is OFF now. Rebuild package with custom flags in makepkg.conf to take advantage of your hardware. See https://wiki.archlinux.org/index.php/Saf e_Cflags#Architecture.2C_compile_flags
Comment by Ray Rashif (schivmeister) - Thursday, 15 November 2012, 17:48 GMT
Thank you. I actually wanted to get some feedback on this so I took out all so-called optimisation flags on purpose and depended on upstream defaults for the last update we rolled. I have a new config staged which just switches them all off since the only thing they do is add to the build flags.
Comment by Hartmut Seichter (seichterh) - Friday, 16 November 2012, 16:05 GMT
I was just checking the 2.4.3 tag in the OpenCV git repo and it seems by default MMX->SSE3 is toggled "ON" by default. Hence, I guess you might need to add config switches to explicitly switch them off to keep in line with minimum requirements for i686. Not sure with x86_64 - no idea if there was ever a IA64 chip without SSE.
Comment by Jan de Groot (JGC) - Saturday, 17 November 2012, 16:00 GMT
x86_64 supports SSE and SSE2 by default. SSE3 was added later and is not supported by first generation amd64 CPUs.
Comment by Ray Rashif (schivmeister) - Sunday, 18 November 2012, 12:44 GMT
Not to worry. OpenCV's build system merely enables C/CXX flags for the SSE stuff, which is in fact useless for us since we depend on predefined flags (default or user's if building locally). That is why the next release bump will just build with whatever support -march=i686 and -march=x86_64 imply.

This effectively means that our binary will do away with SSE for i686 (I used to keep SSE and SSE2 on), and x86_64 will only have SSE<3 (I used to keep this on for x64, see previous SVN revisions). So from now on you will have to rebuild the package if you want more optimisation, that's it :)

Loading...