Skip to content

Built library is ~5x slower on recent Intel Macs #56

Description

@Tomcc

Hi,
I realize that this may be intentional & not a bug, but by default, I found out that the dylib that comes with whisper.unity is 5x slower than one built with the default AVX1=1, AVX2=1 and F16C=1 settings on my MacBook Pro 2019.

I noticed that build_cpp.sh goes out of its way to turn them off, I guess because they aren't supported on ARM Macs.
If that's the case, maybe it could make sense to build each architecture separately and then merge them with lipo?

Eg.

  cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" -DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_EXAMPLES=OFF
  make

  mv "$build_path/libwhisper.dylib" "$build_path/libwhisper.x86_64.dylib"

  cmake -DCMAKE_OSX_ARCHITECTURES="arm64" -DWHISPER_BUILD_TESTS=OFF -DWHISPER_BUILD_EXAMPLES=OFF
  make

  lipo "$build_path/libwhisper.x86_64.dylib" "$build_path/libwhisper.dylib" -create -output "$build_path/libwhisper.dylib"

It's more verbose, but it would use whatever ggerganov thinks are good defaults for each arch.

I'd make a PR, but I don't have access to a ARM Mac to make sure that this code works :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions