On 04/26/2011 08:39 PM, Ronald S. Bultje wrote:
Hi,

On Tue, Apr 26, 2011 at 11:14 AM, Vitor Sessak<[email protected]>  wrote:
On 04/26/2011 07:18 PM, Måns Rullgård wrote:

"Vitor Sessak"<[email protected]>    writes:

Module: libav
Branch: master
Commit: 13dfce3d44f99a2d7df71aba8ae003d58db726f7

Author:    Vitor Sessak<[email protected]>
Committer: Reinhard Tartler<[email protected]>
Date:      Sat Apr 23 19:24:31 2011 +0200

Increase alignment of av_malloc() as needed by AVX ASM.

This wastes memory for no benefit on non-avx systems.  We should make
the minimum alignment somehow configurable.

Agree, not only for this patch, but also reduce it to 8 for systems without
SIMD, but I don't think this should block this patch ATM.


#ifdef ARCH_X86&&  HAVE_AVX

Just "#if HAVE_AVX" should be enough.

#define ALIGNMENT 32
#else
#define ALIGNMENT 16
#endif

That's not so much work, right?

Up to this point, yes, but if I send such a patch someone will complain (and rightly so) that this should be done not only in mem.c, but in all codecs that use DECLARE_ALIGNED(...). Moreover, since we are doing this, we should do

#if HAVE_AVX
#define ALIGNMENT 32
#else if HAVE_SSE || HAVE_ALTIVEC || HAVE_NEON
#define ALIGNMENT 16
#else if 0 /* FIXME: how to know if arch have 64-bit soft emulation? */
#define ALIGNMENT 4
#else
#define ALIGNMENT 8
#endif

At last, there is also the issue that AVX only need 32-byte alignment for float, since it doesn't support any 258-bit operation on integers ("#define ALIGNMENT_FLOAT 32" ?).

But this is a very ugly arch-specific mess that should be handled by the build system and has no place in mem.h...

My point is just that this will go into a discussion that is mostly unrelated to my patchset and should be discussed independently...

-Vitor
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to