Klemens Nanni <[email protected]> writes:

> On Mon, Dec 20, 2021 at 07:59:38AM +0000, Stuart Henderson wrote:
>> On 2021/12/20 00:05, Omar Polo wrote:
>> >  - it enables avx2.  I don't know what's going on, I have an i386 that
>> >    should lack avx/avx2 (it's a pentium T2130) but the port builds and
>> >    the test situation is the same as on amd64: 628 tests pass and 5
>> >    fails.
>> 
>> I didn't check but quite likely it uses runtime cpuid detection
>
> So there's build/arch.mk which relies on ARCH for detection.
>
> On i386  the value is "i386" so it goes down the x86 ASM way.
>
> On amd64 the value is "amd64" but arch.mk expects "x86_64", so no
> nasm(1) or AVX2 usage by default.
> On arm64 the value is "arm64" so NEON is used automatically.

thanks for tracking that down

> We can now either pass ARCH=bogus or more explicitly pass USE_ASM=No
> (implies HAVE_AVX2=No HAVE_NEON_AARCH64=No ENABLE_MMI=No ENABLE_MSA=No)
> to disable optimizations and ship generic ports.
>
> Or we pass the right ARCH value for each platform as follows, depend on
> nasm or i386 and amd64 and make use of optimizations:
>
>       MAKE_FLAGS +=   ARCH=${ARCH:S/amd64/x86_64/}
>
>
> My guess is that not all machines support all optimizations openh264
> employs, so best go the USE_ASM=No way.
>
> FWIW, both FreeBSD and NetBSD just pass ARCH (with amd64 -> x86_64) and
> depend on nasm for i386 and amd64, so they must be building with
> optimizations on all platforms.

Stuart guess was right, it uses cpu detection to see if instructions are
available or not, see for example codec/common/x86/cpuid.asm.

> Here's a new tarball that uses optimizations.
> Builds and tests fine on amd64, sparc64 and arm64.

it builds fine on my old i386 (that lacks avx/avx2) too with and without
optimizations enabled.

It'd be better to leave them enabled I think, but I don't have strong
opinions on that, I'm fine either the way :)

Reply via email to