[Interest] SIMD accelerated wrappers for relevant Qt container classes (QVector, ...) or QByteArray?

Thiago Macieira thiago.macieira at intel.com
Tue May 9 22:37:56 CEST 2017


Em terça-feira, 9 de maio de 2017, às 13:20:04 PDT, René J. V. Bertin 
escreveu:
> Thiago Macieira wrote:
> > QString is already SIMD accelearated and has been since Qt 4.5.
> 
> I'm perverse but not to the point that I'd consider using QString for math
> operations :)

No, but you convert to and from Latin1 with it, you search for characters in 
it, etc. That's optimised.

> > If you want any inline operations to become SIMD accelerated, compile your
> > code with -O3.
> 
> That'd only be as good as the compiler's auto-vectorisation, which rarely
> has a significant impact on anything but the simpler operations.

True, but "simpler operations" also describes the extent of the operations 
available in QVector. Comparing ranges, clearing them, finding an element, etc. 
are all operations that the compiler can easily autovectorise for you.

> Also, to get SIMD support and auto-vectorisation you need the correct -march
> CPU flag, no?

That depends. Some operations it may do the CPU check for you, but it may not 
generate the most efficient code if it decides to keep to the lowest processor 
settings.

You ought to consider always compiling your code with -march=sandybridge (2011 
CPU) or -march=haswell (2013). You should do that for Qt too, as it enables 
most of the optimisations in QString I was talking about.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list