Page MenuHomeSolus

Enable AVX2 glibc
Closed, ResolvedPublic

Tokens
"Like" token, awarded by Jacalz."Love" token, awarded by Vistaus."Burninate" token, awarded by FireballDWF."Love" token, awarded by aszrul."Dat Boi" token, awarded by kyrios123."Like" token, awarded by miwilc."Mountain of Wealth" token, awarded by Timalex.
Assigned To
Authored By
ikey, Oct 10 2017

Description

Enable an AVX2 build of glibc core libraries.

Note - the dynamic linker itself should be omitted from the avx2 directory, but the core glibc libs (math, etc) should have an AVX2 variant by
default to squeeze some extra juice out of the system.

At some point we should also do the same to Mesa, but this will require us to first move to glvnd and ypkg-ify our mesa, moving legacy comar
out to kernel-glue.

Event Timeline

ikey created this task.Oct 10 2017, 3:26 AM
Herald removed ikey as the assignee of this task. · View Herald TranscriptOct 10 2017, 3:26 AM
ikey claimed this task.Oct 10 2017, 3:26 AM
ikey triaged this task as Unbreak Now! priority.

Sidenote: Might also need to teach dracut about this stuff..

Also as compatibility for the future glibc upgrades (which actually has a regression with this upstreamed behaviour) we'll need to make sure we refer to this
internally as Haswell enabling for the extra libset.

In T4719#83766, @ikey wrote:

Sidenote: Might also need to teach dracut about this stuff..

This will be important I think. Whether you want to exclude them when doing initrd, so it can be booted on any CPU as I imagine a few of the tools will be high on my list of in terms of things like zlib/gcc math libs which are also great targets for avx2.

T4522 links to the patch that fixes upstream behaviour. But I do want those proper patches as they check against all CPU extensions added so no false positives which may have occurred using -march=haswell with our current method.

Also, when thinking in terms of tooling changes: It would be pretty swell to have a method to sort out libs not in %libdir% /usr/lib64/R/lib/libR.so as the first example that comes to mind.

Whether in the tooling itself (adding the path to the pattern) to work without patching the code to find it would be quite a boost if it's possible through RPATH and picking up the haswell/lib dir automagically.

The other case is dlopen where it's much easier to change the path (if patching the code) via an extension, rather than inserting haswell into the path.

My CPU is AVX "1" only. Does current glib already support AVX instructions?

Timalex added a subscriber: Timalex.

@livingsilver94 this'd be a special build that sits in /usr/lib64/avx2 for AVX2 capable CPUs. Right now glibc will be using SSE - which is probably better for most people in most
situations tbh.

aszrul added a subscriber: aszrul.
FireballDWF added a subscriber: FireballDWF.
kane lowered the priority of this task from Unbreak Now! to Normal.Jan 6 2018, 9:41 PM
kane raised the priority of this task from Normal to Needs Triage.
kane moved this task from Backlog to Improvement on the Software board.
kane moved this task from Improvement to Backlog on the Software board.
JoshStrobl triaged this task as Unbreak Now! priority.Jan 6 2018, 9:43 PM
JoshStrobl added subscribers: kane, JoshStrobl.

@kane Do not triage issues. Leave it to the triage team.

JoshStrobl changed the edit policy from "All Users" to "Triage Team (Project)".Jan 6 2018, 9:43 PM

@ikey So I've targeted down dracut in order to solve our kernel issues. There are two issues:

  1. It searches for some specific library paths manually via ldconfig. This attached patch takes care of it (this covers very few libraries that are manually searched for by name):
  1. Installation of dependency libraries. Currently this installs both the detected library (which will be haswell and the same library in the directory above if it exists.

This is actually broken if you ship /usr/lib64/haswell/avx512_1 libraries and build on an AVX512 machine, but I imagine, we simply want to ship 1 global version to reduce space:

https://github.com/dracutdevs/dracut/blob/master/install/dracut-install.c#L330 has the two functions resolve_deps which calls library_install and is the one installing the two versions of the libraries.

https://github.com/dracutdevs/dracut/commit/791532b0ce833614910d1d405c0238938408bd6b is the commit that added installing the 2 versions of the libraries into the initrd.