On 10/8/20 3:40 PM, Ashley Dixon wrote:
On Thu, Oct 08, 2020 at 11:57:52AM +0000, Jonathan Yong wrote:
I am getting AVX2 related compile errors in 32bit media-libs/opencv-4.4.0,
there are some internet text mentioning not all AVX2 instructions are
supported on 32bit x86.

For now, I have set -abi_x86_32 since I don't need it now.

Any plans to support ABI specific USE masking/setting?

Do you mean that you want to install the 32-bit and 64-bit version of a package,
enabling one set of flags on one, and another set on the other?


Yes exactly, but more to CPU, I understand perfectly other USE flags will make dependency calculation much more complicated.

The problem you will face is that the CPU_FLAGS_X86 option, which allows you  to
disable AVX(2)  instructions,  amongst  many  other  processor  extensions  [1],
applies to both x86 and amd64 architectures, and from reading the according wiki
page [2], I don't think it's possible to discriminate between those two;  it  is
the responsibility of the package to test  whether  a  particular  AVX  function
should be employed or not.

Can you post the output of `cpuid2cpuflags`  (from  app-portage/cpuid2cpuflags)?
If this list includes "avx2", and the compilation is still failing,  this  is  a
BUG and should be reported as such.  I think it's known to the Gentoo  community
already, although it seems to be an issue with upstream [3].   Analogous  issues
exist in other packages [4].


I have a skylake system:
CPU_FLAGS_X86: aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3

The problem in upstream is probably caused by this call to  _mm256_extract_epi64
[5], introduced quite a while ago (the nature of this function, being  exclusive
to 64-bit processors, was even noted in the commit message [6]).


Yes this was the same error I had, albeit through some C++ error message mangling.

It will probably be fixed soon. No need to worry since you don't need the 32-bit
binary interface anyway.


This time, I can avoid it, since OpenCV is not a dependency of 32bit Wine, which I do use.

[1] 
https://gitweb.gentoo.org/repo/gentoo.git/plain/profiles/desc/cpu_flags_x86.desc
[2] https://wiki.gentoo.org/wiki/CPU_FLAGS_X86#Configuration
[3] https://bugs.gentoo.org/747163
[4] https://github.com/pytorch/pytorch/issues/17901
[5] 
https://github.com/opencv/opencv/blame/152e6476d9a270e6ce35d3f1b200a303654e576e/modules/core/include/opencv2/core/hal/intrin_avx.hpp#L130
[6] 
https://github.com/opencv/opencv/commit/75315fb297a010153d3acab8111ebb87d909cdcf


I'm open to fixing ebuild packages by myself in my own overlay, though I prefer not to due to eventual bit rot. Any hints on how to mask CPU USE flags based on multilib arch in the .ebuild file itself?

My previous attempt was through portage bashrc, but it was too late in the emerge processing.

Attachment: OpenPGP_0x713B5FE29C145D45_and_old_rev.asc
Description: application/pgp-keys

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to