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

Thiago Macieira thiago.macieira at intel.com
Wed May 10 17:19:17 CEST 2017


On Wednesday, 10 May 2017 01:57:42 PDT René J. V. Bertin wrote:
> I was thinking a bit beyond those simple operations available in QVector and
> the like. QVector may not be the best example, but it does come to mind
> when you think vector calculus and being able to write its common
> operations as vector operations and not in loops (or calls to external
> library functions with cryptic names hailing back only "real programmers"
> understand ;) )

Then you should consider QVector3D and QVector4D. And Qt3D is adding SIMD-
optimised versions of those two, along with that of QMatrix4x4. For now, they 
are private API, but if there's interest, we could consider making them 
public.

Also, why not Eigen?

> > 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.
> 
> I do, at least on Mac I always configure everything with "-O3 -march=native"
> or even "-Ofast -march=native" (there's apparently a difference for clang's
> auto- vectorisation, beyond using "fast math").
> For my Linux builds I usually don't use -march because I also deploy to an
> old notebook where I think even -march=core2 is risky (-march=btver or
> amdfam10 do work but I doubt they're of much interest).
> 
> It'd be nice if Qt could be built with support for runtime-selection of the
> most efficient available implementation :)

It does in QtGui and for a couple of things in QtCore (like qHash and now 
QRandomGenerator). For other things in QString, the overhead of the selection 
is higher than the gain obtained by using SSE or AVX, so it's not done.

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




More information about the Interest mailing list