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

Re: [Debian-med-packaging] Help to build library in generic form, avx and sse3



Hi all,

[...]
>> 2. What do you think about the plan to support specific hardware 
>> features in separate binary packages?
> 
> GCC from version 6 (which is in Debian Stretch) supports function 
> multi-versioning (and GCC from 4.8 onwards, which is even in Jessie,
> supports a subset of that), which allows you to do the following:
> 
> - have a function with generic C/C++ code be compiled multiple times 
> in different variants, and have the most optimal variant be selected 
> at runtime (requires GCC 6),

I have recently noticed a similar approach in the latest version of one
of the pattern matching libraries that the IDS Suricata depends on,
Hyperscan [1].
The Hyperscan build process compiles several variants of the scanning
engine specialised for different processor feature sets into one "fat
runtime" and selects the most appropriate one for the host at runtime.
This uses the "ifunc" indirect function attribute provided by GCC.
very cool IMHO.

This development, together with the fact that they also provided a
run-time function to check for the presence of the required
instructions, made it possible to drop one of these extra Debian
packages with optimized binaries that we were shipping for Suricata at
the time [2,3]. For the record, we used alternatives in this case to
switch out binaries with and without optimizations.

Cheers
Sascha


[1] https://github.com/01org/hyperscan/blob/master/CHANGELOG.md
[2]
https://anonscm.debian.org/cgit/pkg-suricata/pkg-suricata.git/commit/?id=8c7704dd158f59694b1b0bf4bbb8008727c6dc6b
[3]
https://anonscm.debian.org/cgit/pkg-suricata/pkg-suricata.git/commit/?id=209d2cffabb6588d8e9468b4f9535cad3ecf3d36

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: