On Fri, Jun 26, 2015 at 08:38:56PM +0300, Roman Lebedev wrote:
> On Fri, Jun 26, 2015 at 6:33 PM, Bruce Guenter <br...@untroubled.org> wrote:
> > Here's what I've found out: GCC does support function multiversioning
> > (https://gcc.gnu.org/wiki/FunctionMultiVersioning) to provide the same
> > function name for different architectures and dispatching them at run
> > time.  The same function marked with __attribute__((target("X"))) is
> > indeed compiled differently within the same source for X is SSE2 vs AVX,
> > taking advantage of the different instruction sets.
>
> Just facts: that is a GCC-specific thing, supported only by gcc-4.8+,
> and completely unsupported by clang, not even by clang+llvm 3.7 nightly
> snapshot.

Right. That was just an illustration that GCC had support for multiple
versions of the same function name with automatic internal switching.
It's still not particularly useful nor portable.

> > However, GCC does *NOT* do any of this automatically, or at least I have
> > not found any way to make it. A function (with or without a vectorized
> > loop) is emitted exactly once each time it appears, and there are no
> > internal branches to different (SSE vs AVX) code paths.
> >
> > So to take full advantage of it we would still need to repeat the
> > function for each target hardware.
> 
> Yes, here i definitely agree with you.

> Regardless of why it will be done (process() + process_cl() + process_avx()
> + ... OR
> process() + process_cl() + process_simd()), that is the ONLY way that would
> allow to
> eventually implement some kind of automatic implementation verification
> tests without
> changing much of the code.

That is what I was leaning towards, yes.

I am actually in favor of going the compiler vectorization model via
OpenMP SIMD. I like the idea of future proofing the code by making it
more portable. In fact, it would work fine for me, as I can build the
code separately on my different systems to get separate AVX vs SSE
implementations. It just doesn't seem to be a viable solution for
distributors without some kind of runtime switch.

-- 
Bruce Guenter <br...@untroubled.org>                http://untroubled.org/

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
darktable-devel mailing list
darktable-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/darktable-devel

Reply via email to