sox-devel@lists.sourceforge.net unofficial mirror
 help / color / mirror / code / Atom feed
From: "Måns Rullgård" <mans@mansr.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: sox-devel@lists.sourceforge.net
Subject: Re: [PATCH 4/6] Add macros for increasing data alignment
Date: Sun, 20 Dec 2015 13:54:59 +0000	[thread overview]
Message-ID: <yw1x60zt8bt8.fsf@unicorn.mansr.com> (raw)
In-Reply-To: <20151220124130.GA8404@dcvr.yhbt.net> (Eric Wong's message of "Sun, 20 Dec 2015 12:41:30 +0000")

Eric Wong <normalperson@yhbt.net> writes:

> Mans Rullgard <mans@mansr.com> wrote:
>> Also check for the aligned_alloc() function and alias to Microsoft's
>> _aligned_malloc() if necessary.
>
> How much does aligned_alloc help performance for you (and with which
> settings)? 

It's required for the SSE2 and AVX code.  Without proper alignment it
simply crashes (that's how the CPU works).  The speedup of the sdm
filter with SSE2/AVX is substantial.

> I'm on an older system with only memalign and posix_memalign, and
> trying to enable it didn't change performance with "--multi-thread
> --buffer=131072" on a 4-core AMD Phenom II X4 945

That CPU doesn't have AVX so 16-byte alignment is enough, and plain
malloc usually provides that.  It obviously doesn't hurt to add support
for memalign as well even though it is considered obsolete.  If you do
that, you should also take care of #including malloc.h.

> --- a/src/util.h
> +++ b/src/util.h
> @@ -194,8 +194,13 @@
>  #define LSX_ALIGN(n)
>  #endif
>
> +#define HAVE_MEMALIGN
> +
>  #ifdef HAVE_ALIGNED_ALLOC
>    #define aligned_free(p) free(p)
> +#elif defined(HAVE_MEMALIGN)
> +  #define aligned_alloc(a, s) memalign(a, s)
> +  #define aligned_free(p) free(p)
>  #elif defined _MSC_VER
>    #define aligned_alloc(a, s) _aligned_malloc(s, a)
>    #define aligned_free(p) _aligned_free(p)

-- 
Måns Rullgård

------------------------------------------------------------------------------

  reply	other threads:[~2015-12-20 13:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 14:16 [PATCH 1/6] Add SOX_ENCODING_DSD Mans Rullgard
2015-09-16 14:16 ` [PATCH 2/6] Add DSF file support Mans Rullgard
2015-09-16 14:16 ` [PATCH 3/6] Add support for reading DSDIFF files Mans Rullgard
2015-09-16 14:16 ` [PATCH 4/6] Add macros for increasing data alignment Mans Rullgard
2015-12-20 12:41   ` Eric Wong
2015-12-20 13:54     ` Måns Rullgård [this message]
2015-12-21 10:55       ` Eric Wong
2015-12-21 11:37         ` Måns Rullgård
2015-12-21 18:33           ` Eric Wong
2015-12-21 18:37             ` Måns Rullgård
2015-09-16 14:16 ` [PATCH 5/6] Add a sigma-delta modulator for DSD encoding Mans Rullgard
2015-10-03 22:31   ` Eric Wong
2015-10-03 22:39     ` Måns Rullgård
2015-09-16 14:16 ` [PATCH 6/6] Add DSD over PCM (dop) effect Mans Rullgard
2015-12-19 12:09   ` Eric Wong
2015-12-19 12:14     ` Måns Rullgård
2015-12-20  5:04       ` Eric Wong
2015-12-20 13:44         ` Måns Rullgård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.sourceforge.net/lists/listinfo/sox-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yw1x60zt8bt8.fsf@unicorn.mansr.com \
    --to=sox-devel@lists.sourceforge.net \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/sox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).