[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how best to package when using hardware vectorization with vector-unit specific code?



On Thu, May 11, 2017 at 12:01 AM, Kay F. Jahnke wrote:

> While this is tempting, I'd like to keep my code as general as possible.
> Also, I prefer compiling with clang++, which, for my use case, produces
> faster code, and clang++ does not support constructs like

Apparently clang supports something similar, some links I found:

http://clang.llvm.org/docs/AttributeReference.html#ifunc-gnu-ifunc
https://github.com/davisking/dlib/issues/36
http://llvm.org/devmtg/2014-10/Slides/Christopher-Function%20Multiversioning%20Talk.pdf

> Additionally, I find the notion of target_clones to compile a specific
> 'function' hard to digest. What do they mean, function? I write generic code
> in C++, most of my stuff is inlined from header-only libraries, it's all
> object-oriented. There are next to no 'functions' in my code.

I guess FMV is mostly suited to C style programs.

> I had something simpler in mind. I had hoped that a debian package would
> provide some sort of target-side script which is run when the application
> deploys with the user. Then it would be easy to have a bit of code à la

I think it would be better to put that in a wrapper script that is
always installed and executes the right binary.

> #! /bin/bash

Best use /bin/sh if possible.

> mv myprogram_$bestarch $target_bin/myprogram

Change this to exec myprogram_$bestarch "$@"

> ... and optionally delete the binaries for the other ISAs.

Packages should not delete their own files, especially in this case
since you could move your Debian install from one system to another
and then get a different CPU at runtime and need a different pv
binary.

> I am using Vc, so whatever Vc supports, my software supports as well. Vc is
> a generic C++ library to abstract away the architecture, so I just compile
> with -mmx -sse or whatever and Vc adapts and produces the code for the
> specific target. I've coded so that my program will also run without using
> the vector units, this is done by simple #ifdefs, and I pass the definition
> in via a -D directive (or I don't, to produce code without vectorization).
> Alternatively Vc can produce a scalar interpretation of the vector code
> which runs on any platform and is equivalent.

This sounds like the multi-binary plus wrapper script approach would
be best, unless you can figure out how to compile everything into one
binary and select the right code at runtime.

>> ... just not a RC bug.
>
> pardon me, but what's an RC bug?

Release-critical, which usually means it would not be allowed in Debian stable.

> So, yes, I can create base-level machine code and machine code for every
> platform Vc supports. Which still leaves me with the open question how best
> to proceed.

For now: multi-binary plus wrapper script.

-- 
bye,
pabs

https://wiki.debian.org/PaulWise


Reply to: