Bug 258714 - devel/py-tables: Disable automatic AVX2 CPU optimizations
Summary: devel/py-tables: Disable automatic AVX2 CPU optimizations
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Kai Knoblich
URL: https://github.com/PyTables/PyTables/...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-25 08:30 UTC by Kai Knoblich
Modified: 2021-09-28 08:10 UTC (History)
3 users (show)

See Also:
wen: maintainer-feedback+
kai: merge-quarterly+


Attachments
py-tables-fix-automatic-avx2-support.patch (939 bytes, patch)
2021-09-25 08:30 UTC, Kai Knoblich
kai: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Knoblich freebsd_committer 2021-09-25 08:30:27 UTC
Created attachment 228163 [details]
py-tables-fix-automatic-avx2-support.patch

Hi Wen,

if devel/py-tables is built on amd64 hosts that have a CPU with AVX2 support,
optimizations for that CPU are automatically compiled in.

This then causes problems for amd64 hosts that have no AVX2, because the
generated .so files then contains unknown instructions for those hosts and they
crash with SIGILL.

It was discovered by dvl@, where devel/py-tables was built on a host with AVX2
and then used in a VM without AVX2.

QA:
~~~
- poudriere -> OK [*] (11.4-, 12.2-, 13.0-RELEASE, 14.0-CURRENT@9f7a81b133 amd64/i386 for py36, py37, py38, py39)

[*] I myself only have a host without AVX2, but dvl@ has already confirmed (via IRC) that the original patch fixed the issue.

Attached you can find a patch for the above issue.  In contrast to the original patch, which was tested by dvl@, only one detail has changed: The option AVX2 is only displayed for amd64 hosts, because AVX2 is an amd64 CPU feature.

At last but not least: This also needs to be MFH'ed.
Comment 1 Wen Heping freebsd_committer 2021-09-25 08:46:03 UTC
Approved.
Thank you !

wen
Comment 2 Wen Heping freebsd_committer 2021-09-25 08:47:02 UTC
Would you commit it ?
Comment 3 Kai Knoblich freebsd_committer 2021-09-25 08:59:34 UTC
Comment on attachment 228163 [details]
py-tables-fix-automatic-avx2-support.patch

^ Triage: Set maintainer-approval to '+' as given via comment #2.
Comment 4 Kai Knoblich freebsd_committer 2021-09-25 09:00:37 UTC
(In reply to Wen Heping from comment #2)

Thank you for your quick review and approval.  I'll commit and MFH it in the next few days.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2021-09-25 22:57:19 UTC
Note even if one creates issues/reviews as a heads-up to maintainers, that build/run fixes are:

Approved by: portmgr (blanket: build fix)
Comment 6 commit-hook freebsd_committer 2021-09-28 08:03:34 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f31b25e7dc91402729ecc19c1fca66e9ebe5ddc8

commit f31b25e7dc91402729ecc19c1fca66e9ebe5ddc8
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2021-09-28 07:43:34 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2021-09-28 07:43:34 +0000

    devel/py-tables: Disable AVX2 CPU optimizations

    On amd64 platforms that have a CPU with Haswell New Instructions (AVX2),
    related optimizations are automatically compiled in, unless this is
    explicitly prevented.

    If the package is then used on other amd64 platforms, that have no AVX2
    support, this causes problems, because the generated .so files are
    incompatible and lead to crashes with SIGILL upon invocation.

    Remedy the issue by turning off AVX2 support by default which is also
    upstream's default and bump PORTREVISION to force a rebuild.

    PR:             258714
    Reported by:    dvl (on IRC)
    Reviewed by:    wen (maintainer)
    Approved by:    portmgr (blanket: build fix)
    MFH:            2021Q3

 devel/py-tables/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 7 commit-hook freebsd_committer 2021-09-28 08:05:36 UTC
A commit in branch 2021Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=70843a665d45e14e5b45a87b4c6205555040c555

commit 70843a665d45e14e5b45a87b4c6205555040c555
Author:     Kai Knoblich <kai@FreeBSD.org>
AuthorDate: 2021-09-28 07:43:34 +0000
Commit:     Kai Knoblich <kai@FreeBSD.org>
CommitDate: 2021-09-28 08:04:57 +0000

    devel/py-tables: Disable AVX2 CPU optimizations

    On amd64 platforms that have a CPU with Haswell New Instructions (AVX2),
    related optimizations are automatically compiled in, unless this is
    explicitly prevented.

    If the package is then used on other amd64 platforms, that have no AVX2
    support, this causes problems, because the generated .so files are
    incompatible and lead to crashes with SIGILL upon invocation.

    Remedy the issue by turning off AVX2 support by default which is also
    upstream's default and bump PORTREVISION to force a rebuild.

    PR:             258714
    Reported by:    dvl (on IRC)
    Reviewed by:    wen (maintainer)
    Approved by:    portmgr (blanket: build fix)
    MFH:            2021Q3

    (cherry picked from commit f31b25e7dc91402729ecc19c1fca66e9ebe5ddc8)

 devel/py-tables/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)
Comment 8 Kai Knoblich freebsd_committer 2021-09-28 08:10:14 UTC
(In reply to Wen Heping from comment #1)

Committed to main and merged to 2021Q1 as well. Once again thank you for the quick review!