[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
** Also affects: glibc (Ubuntu Zesty) Importance: Undecided Status: Confirmed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1663280 Title: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug To manage notifications about this bug go to: https://bugs.launchpad.net/glibc/+bug/1663280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
** Tags added: upgrade-software-version xenial yakkety zesty -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1663280 Title: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug To manage notifications about this bug go to: https://bugs.launchpad.net/glibc/+bug/1663280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
Regarding glibc 2.24: note that the version in use in Debian testing/unstable (i.e. stretch/sid) is 2.24-9 which already incorporates the upstream fix, i.e. Debian is not affected. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1663280 Title: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug To manage notifications about this bug go to: https://bugs.launchpad.net/glibc/+bug/1663280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
Bug description has been updated to include the following information: @strikov: According to a quite reliable source [5] all AMD CPUs and latest Intel CPUs (Skylake and Knights Landing) don't suffer from AVX/SSE transition penalty. It means that the scope of this bug becomes smaller and includes only the following generations of Intel's CPUs: Sandy Bridge, Ivy Bridge, Haswell, and Broadwell. Scope still remains quite large though. @strikov: Ubuntu 16.10/17.04 which use Glibc 2.24 may recieve the fix from upstream 2.24 branch (as Marcel pointed out, fix has been backported to 2.24 branch where Fedora took it successfully) if such synchronization will take place. Ubuntu 16.04 (the main target of this bug) uses Glibc 2.23 which hasn't been patched upstream and will suffer from performance degradation until we fix it manually. ** Description changed: Bug [0] has been introduced in Glibc 2.23 [1] and fixed in Glibc 2.25 [2]. All Ubuntu versions starting from 16.04 are affected because they use either Glibc 2.23 or 2.24. Bug introduces serious (2x-4x) performance degradation of math functions (pow, exp/exp2/exp10, log/log2/log10, sin/cos/sincos/tan, asin/acos/atan/atan2, sinh/cosh/tanh, asinh/acosh/atanh) provided by libm. Bug can be reproduced on any AVX-capable x86-64 machine. + + @strikov: According to a quite reliable source [5] all AMD CPUs and + latest Intel CPUs (Skylake and Knights Landing) don't suffer from + AVX/SSE transition penalty. It means that the scope of this bug becomes + smaller and includes only the following generations of Intel's CPUs: + Sandy Bridge, Ivy Bridge, Haswell, and Broadwell. Scope still remains + quite large though. + + @strikov: Ubuntu 16.10/17.04 which use Glibc 2.24 may recieve the fix + from upstream 2.24 branch (as Marcel pointed out, fix has been + backported to 2.24 branch where Fedora took it successfully) if such + synchronization will take place. Ubuntu 16.04 (the main target of this + bug) uses Glibc 2.23 which hasn't been patched upstream and will suffer + from performance degradation until we fix it manually. This bug is all about AVX-SSE transition penalty [3]. 256-bit YMM registers used by AVX-256 instructions extend 128-bit registers used by SSE (XMM0 is a low half of YMM0 and so on). Every time CPU executes SSE instruction after AVX-256 instruction it has to store upper half of the YMM register to the internal buffer and then restore it when execution returns back to AVX instructions. Store/restore is required because old- fashioned SSE knows nothing about the upper halves of its registers and may damage them. This store/restore operation is time consuming (several tens of clock cycles for each operation). To deal with this issue, Intel introduced AVX-128 instructions which operate on the same 128-bit XMM register as SSE but take into account upper halves of YMM registers. Hence, no store/restore required. Practically speaking, AVX-128 instructions is a new smart form of SSE instructions which can be used together with full-size AVX-256 instructions without any penalty. Intel recommends to use AVX-128 instructions instead of SSE instructions wherever possible. To sum things up, it's okay to mix SSE with AVX-128 and AVX-128 with AVX-256. Mixing AVX-128 with AVX-256 is allowed because both types of instructions are aware of 256-bit YMM registers. Mixing SSE with AVX-128 is okay because CPU can guarantee that the upper halves of YMM registers don't contain any meaningful data (how one can put it there without using AVX-256 instructions) and avoid doing store/restore operation (why to care about random trash in the upper halves of the YMM registers). It's not okay to mix SSE with AVX-256 due to the transition penalty. Scalar floating-point instructions used by routines mentioned above are implemented as a subset of SSE and AVX-128 instructions. They operate on a small fraction of 128-bit register but still considered SSE/AVX-128 instruction. And they suffer from SSE/AVX transition penalty as well. Glibc inadvertently triggers a chain of AVX/SSE transition penalties due to inappropriate use of AVX-256 instructions inside _dl_runtime_resolve() procedure. By using AVX-256 instructions to push/pop YMM registers [4], Glibc makes CPU think that the upper halves of XMM registers contain meaningful data which needs to be preserved during execution of SSE instructions. With such a 'dirty' flag set every switch between SSE and AVX instructions (AVX-128 or AVX-256) leads to a time consuming store/restore procedure. This 'dirty' flag never gets cleared during the whole program execution which leads to a serious overall slowdown. Fixed implementation [2] of _dl_runtime_resolve() procedure tries to avoid using AVX-256 instructions if possible. Buggy _dl_runtime_resolve() gets called every time when dynamic linker tries to resolve a symbol (any symbol, not just ones
[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
** Bug watch added: Red Hat Bugzilla #1421121 https://bugzilla.redhat.com/show_bug.cgi?id=1421121 ** Also affects: glibc (Fedora) via https://bugzilla.redhat.com/show_bug.cgi?id=1421121 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1663280 Title: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug To manage notifications about this bug go to: https://bugs.launchpad.net/glibc/+bug/1663280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
** Changed in: glibc Status: Unknown => Fix Released ** Changed in: glibc Importance: Unknown => Medium -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1663280 Title: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug To manage notifications about this bug go to: https://bugs.launchpad.net/glibc/+bug/1663280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
It seems that the fix has been backported to upstreams's 2.24 branch: https://sourceware.org/git/?p=glibc.git;a=commit;h=4b8790c81c1a7b870a43810ec95e08a2e501123d -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1663280 Title: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug To manage notifications about this bug go to: https://bugs.launchpad.net/glibc/+bug/1663280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
** Bug watch added: Sourceware.org Bugzilla #20508 https://sourceware.org/bugzilla/show_bug.cgi?id=20508 ** Also affects: glibc via https://sourceware.org/bugzilla/show_bug.cgi?id=20508 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1663280 Title: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug To manage notifications about this bug go to: https://bugs.launchpad.net/glibc/+bug/1663280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1663280] Re: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug
Status changed to 'Confirmed' because the bug affects multiple users. ** Changed in: glibc (Ubuntu) Status: New => Confirmed -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1663280 Title: Serious performance degradation of math functions in 16.04/16.10/17.04 due to known Glibc bug To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1663280/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs