You raise excellent questions. I have not been paying attention to Apple's
compiler support for the M1, M1 Pro, and M1 Max.
Do you have the latest compiler from Apple?
Are you sure that -O3 is the best option? I seem to recall that the
'best' has changed over the years.
I also recall that Apple support for SSE was slow to be delivered, at a time
when AltiVec support was highly performant. Could it be possible that
Apple's compiler doesn't support the M1 Max vector instructions as well
as it support SSE? My experience may not be related to the compiler, though,
because I was using the vecLib framework, part of the Accelerate framework.
Initially, Apple provided routines for Intel that were functionally correct, but
not optimized. Later, those routines were optimized, and programs linked against
the framework automatically inherited the improvements. flac does not use these
frameworks, so my example may not be relevant.
For comparison, how long does your test set take when going through emulation?
Brian
On Jul 5, 2022, at 9:48 AM, Scott Brown wrote:>
> Hi everyone,
>
> I've got a question regarding Apple Silicon chips and flac encoding.
I'm not seeing the speed I think I should be seeing
>
> I compiled a universal flac 1.3.4 for Apple Silicon and 64 bit intel like
so:
>
> ./configure -enable-static -disable-shared CFLAGS=" -arch arm64 -arch
x86_64 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
-mmacosx-version-min=10.9 -O3" ; make
>
> Encoding 24/96 wav files to flac level 8 for a fileset i've been
testing takes about 3 minutes and 10 seconds on an M1 Max processor using the
native arm build.
>
> Using the intel build on the M1 Max (which goes through Apple's Rosetta
emulation) takes 1 minute and 50 seconds.
>
> I would expect the native Arm build to be much faster since it's not
going through emulation. What am I missing? Some compilation flag?
>
> Thanks,
> Scott