JonBCode / openjpeg

Automatically exported from code.google.com/p/openjpeg
Other
0 stars 0 forks source link

Improve SIMD support with automatic/manual dispatching #450

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
OpenJPEG already uses SIMD code (only SSE) when __SSE__ is defined.
This is the case for x64 code by default (not under Visual Studio though) 
because x64 CPUs all have SSE/SSE2. This is also the case under MacOS for x86 
because Apple switch to Intel CPUs recently & thus enables SSE3 (I think) by 
default.

In all other cases, SIMD is not used by default. If it's switch on using -msse 
on gcc or just by defining __SSE__ on Visual C++, then the library should only 
be used on CPUs with this instruction set. A crash would appear otherwise.

This being said, we can see that x86 code could benefit from automatic/manual 
dispatching rather than static dispatching. One could say that SSE can be 
enabled anyway for x86 as it's old enough. Even if I were to agree with this, 
this would still limit potential optimizations using more recent Instruction 
Sets (AVX would be trivial given there's already SSE code for OpenJPEG).

This should allow for different instruction sets on different platform (why 
limit to x86/x64) like ARM NEON, PPC AltiVec just to name a few without getting 
unreadable C code base (one should use different files to implement different 
instruction set).

Original issue reported on code.google.com by m.darb...@gmail.com on 13 Dec 2014 at 11:59

GoogleCodeExporter commented 9 years ago
See also Issue 451.
It shows that SSE41 can speedup MCT quite nicely (ok, this a small amount of 
time compared to other functions but this is just to show what could be done on 
other functions as well).
SSE41 can't be enabled on all builds...

Original comment by m.darb...@gmail.com on 13 Dec 2014 at 12:26