[Development] Enabling SSE2 by default on x86 builds (32-bit)

Boudewijn Rempt boud at valdyas.org
Thu Dec 12 19:20:25 CET 2013

On Thursday 12 December 2013 Dec 19:06:20 Pau Garcia i Quiles wrote:
> On Wed, Dec 11, 2013 at 10:21 AM, Simon Hausmann
> <simon.hausmann at digia.com>wrote:
> > > The other option for 5.2 would be to do runtime detection of SSE2 and
> > > enable/disable the JIT according to that.
> >
> > I think the main issue with run-time detection is that we need -msse2
> > -mfpmath=sse in order to get reliable math results (no 80-bit temps) that
> > match with our test expectations, when using the interpreter or non-inline
> > math functions.
> >
> I have not looked into the actual code, I know everybody hates dlopen and I
> haven't even though about the performance implications but, what about this?
> - Move "maybe-SSE2" code to a separate library
> - Compile that library twice, one with SSE2 (-msse2 -mfmath=sse), the other
> without SSE2
> - Ship both versions of the library: libwhatever_sse2.so,
> libwhatever_i486.so
> - On runtime, check for SSE2 and load the appropriate version
> The same approach could be used in other parts of Qt, or even for having
> SSE2, SSE2, etc versions of that library/plugin

In Krita, we use Vc to abstract away all this stuff -- we code our vectorization optimizations using Vc and then Vc takes care to select the best alternative run-time. I don't know how well it would fit with Qt, but I'm very glad with it:


For Krita 2.8, we added support for AVX2, but that's still in a separate branch.

Boudewijn Rempt
http://www.valdyas.org, http://www.krita.org, http://www.boudewijnrempt.nl

More information about the Development mailing list