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?

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].

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]).

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

[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

-- 

Ashley Dixon
suugaku.co.uk

2A9A 4117
DA96 D18A
8A7B B0D2
A30E BF25
F290 A8AA

Attachment: signature.asc
Description: PGP signature

Reply via email to