ARM-software / ComputeLibrary

The Compute Library is a set of computer vision and machine learning functions optimised for both Arm CPUs and GPUs using SIMD technologies.
MIT License
2.76k stars 767 forks source link

Prebuilt packages for Apple M1 / M2 #1001

Open ilya-lavrenov opened 1 year ago

ilya-lavrenov commented 1 year ago

Could you please start to provide prebuilt releases for Apple Silicon? Currently, I see that only linux binaries are provided.

morgolock commented 1 year ago

Hi @ilya-lavrenov

Thanks, we are considering this request.

ilya-lavrenov commented 1 year ago

Could you please provide a reference where I can find prebuilt binaries? I don't see them there https://github.com/ARM-software/ComputeLibrary/releases/tag/v22.11

morgolock commented 1 year ago

Hi @ilya-lavrenov

We are planning to do it for the next release: 23.02

Hope this helps,

ilya-lavrenov commented 1 year ago

We are planning to do it for the next release: 23.02

Looks like it's not implemented.

BuildBackBuehler commented 2 months ago

Seems this is still the case? :/

morgolock commented 2 months ago

I'll discuss this with the team and see if we can release these binaries.

BuildBackBuehler commented 2 months ago

Definitely would be nice to have a boilerplate config for the build to go off of. Just even that would be enough honestly. It's just I have little to no clue what is/isn't within the scope of possibility for MPS/Metal.

Got the new release and getting errors (also wiped my workspace, so maybe I am missing a dependency). Maybe it is because I am taking it too far this time? Thinking that you aren't supposed to go past the build stage? @ "make"...getting this error.

[ 21%] Building CXX object CMakeFiles/arm_compute_sve.dir/src/cpu/kernels/elementwise_binary/generic/sve/fp32.cpp.o
[ 22%] Building CXX object CMakeFiles/arm_compute_sve.dir/src/cpu/kernels/elementwise_binary/generic/sve/impl.cpp.o
PLEASE submit a bug report to https://github.com/Homebrew/homebrew-core/issues and include the crash backtrace, preprocessed source, and associated run script.

Stack dump:
0.      Program arguments: /opt/homebrew/opt/llvm/bin/clang++ -DARM_COMPUTE_CPP_SCHEDULER -DARM_COMPUTE_CPU_ENABLED -DARM_COMPUTE_ENABLE_BF16 -DARM_COMPUTE_ENABLE_FIXED_FORMAT_KERNELS -DARM_COMPUTE_ENABLE_FP16 -DARM_COMPUTE_ENABLE_I8MM -DARM_COMPUTE_ENABLE_NEON -DARM_COMPUTE_ENABLE_SVE -DARM_COMPUTE_ENABLE_SVEF32MM -DARM_COMPUTE_GRAPH_ENABLED -DARM_COMPUTE_OPENMP_SCHEDULER -DENABLE_FP16_KERNELS -DENABLE_FP32_KERNELS -DENABLE_INTEGER_KERNELS -DENABLE_NCHW_KERNELS -DENABLE_NEON -DENABLE_NHWC_KERNELS -DENABLE_QASYMM8_KERNELS -DENABLE_QASYMM8_SIGNED_KERNELS -DENABLE_QSYMM16_KERNELS -DENABLE_SVE -D_GLIBCXX_USE_NANOSLEEP -Darm_compute_sve_EXPORTS -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/include -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04 -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src/core/NEON/kernels/arm_conv -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src/core/NEON/kernels/arm_gemm -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src/core/NEON/kernels/assembly -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src/core/cpu/kernels/assembly -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src/cpu/kernels/assembly -I/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src/core/NEON/kernels/arm_gemm/merges -O3 -std=c++14 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -mmacosx-version-min=14.4 -fPIC -Werror -march=armv8.2-a+sve+fp16+dotprod -fopenmp=libomp -MD -MT CMakeFiles/arm_compute_sve.dir/src/cpu/kernels/elementwise_binary/generic/sve/impl.cpp.o -MF CMakeFiles/arm_compute_sve.dir/src/cpu/kernels/elementwise_binary/generic/sve/impl.cpp.o.d -o CMakeFiles/arm_compute_sve.dir/src/cpu/kernels/elementwise_binary/generic/sve/impl.cpp.o -c /Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src/cpu/kernels/elementwise_binary/generic/sve/impl.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '/Users/zack/.home/gitrepos/LLMLife/backend/misc/ComputeLibrary-24.04/src/cpu/kernels/elementwise_binary/generic/sve/impl.cpp'.
4.      Running pass 'AArch64 Assembly Printer' on function '@_ZN11arm_compute3cpu15elementwise_divIu11__SVInt16_tEET_Ru10__SVBool_tRKS3_S7_'
 #0 0x0000000117771e50 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x4695e50)
 #1 0x0000000113231838 llvm::sys::CleanupOnSignal(unsigned long) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x155838)
 #2 0x00000001177636b8 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x46876b8)
 #3 0x0000000117763794 CrashRecoverySignalHandler(int) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x4687794)
 #4 0x000000018ad9b584 (/usr/lib/system/libsystem_platform.dylib+0x180477584)
 #5 0x0000000113e02fcc llvm::AsmPrinter::emitFunctionHeader() (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0xd26fcc)
 #6 0x0000000113e02fcc llvm::AsmPrinter::emitFunctionHeader() (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0xd26fcc)
 #7 0x0000000113e05fec llvm::AsmPrinter::emitFunctionBody() (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0xd29fec)
 #8 0x0000000115567cc0 (anonymous namespace)::AArch64AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x248bcc0)
 #9 0x0000000113735330 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x659330)
#10 0x00000001133f0338 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x314338)
#11 0x00000001133e4644 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x308644)
#12 0x00000001070166d4 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x15966d4)
#13 0x00000001073bbbd4 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x193bbd4)
#14 0x0000000105c8b708 clang::ParseAST(clang::Sema&, bool, bool) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x20b708)
#15 0x0000000107b1d12c clang::FrontendAction::Execute() (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x209d12c)
#16 0x0000000107a9fe80 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x201fe80)
#17 0x0000000107b6ff40 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x20eff40)
#18 0x0000000100bd2b28 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/homebrew/Cellar/llvm/18.1.5/bin/clang-18+0x100006b28)
#19 0x0000000100bd1218 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) (/opt/homebrew/Cellar/llvm/18.1.5/bin/clang-18+0x100005218)
#20 0x000000010771e128 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const::$_0>(long) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x1c9e128)
#21 0x0000000113168fdc llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libLLVM.dylib+0x8cfdc)
#22 0x000000010771d924 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__1::optional<llvm::StringRef>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, bool*) const (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x1c9d924)
#23 0x00000001076de59c clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x1c5e59c)
#24 0x00000001076ff208 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*>>&) (/opt/homebrew/Cellar/llvm/18.1.5/lib/libclang-cpp.dylib+0x1c7f208)
#25 0x0000000100bcfd44 clang_main(int, char**, llvm::ToolContext const&) (/opt/homebrew/Cellar/llvm/18.1.5/bin/clang-18+0x100003d44)
#26 0x0000000100bdce38 main (/opt/homebrew/Cellar/llvm/18.1.5/bin/clang-18+0x100010e38)
#27 0x000000018a9e20e0
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Homebrew clang version 18.1.5
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin

Or perhaps it is something with clang but I figured its probably because the Mac/Metal platform isn't compatible.

Edit: OIC, I think it tries to compile SVE2 files. Because on the filesdef.json list the following file is sve2 related. Is there a way I can explicitly flag my build to disable SVE2 support? I see "has_sve2()" for the ACL check. Hate to say but I'm a total newbie with my own homeschooling of sorts for the past 2 years. This past week has been my first real dive into the low-level C/C++-type stuff, its a lot to wrap my head around but I'm glad I have been. But just to say, excuse my ignorance, I am trying

Edit2: Seems ChatGPT had the answer, or so we shall see! -mno-sve2

Edit3: Nope. Seems I'm smarter __ARM_FEATURE_SVE2==1 https://developer.arm.com/documentation/102699/0100/Optimizing-with-intrinsics?lang=en

Edit 4: Turns out it doesn't matter, SVE itself isn't supported (at least w/ the Brew LLVM 18.1.5 clang++). Doubt it'll get buildin' now, imagine more things rely on SVE that I'd need to turn off in my build config but that's a guessing game. My other thought was maybe I need to use scons?

BuildBackBuehler commented 1 month ago

I'll discuss this with the team and see if we can release these binaries.

Nooooo -- new release without a mac pack, hope that it was discussed and just slowly in the works...anything but 💀

morgolock commented 1 month ago

Hi @BuildBackBuehler

We are planning to release the macOS prebuilt binaries in the next release: 24.07

Hope this helps

ilya-lavrenov commented 1 month ago

@morgolock Please, ensure you have compiled with higher compatibility among macOS version and use MACOSX_DEPLOYMENT_TARGET to set minimal supported versions.