mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
[iOS] Disable NNPACK on iOS builds (#39868)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/39868 ### Summary why disable NNPACK on iOS - To stay consistency with our internal version - It's currently blocking some external users due to its lack support of x86 architecture - https://github.com/pytorch/pytorch/issues/32040 - https://discuss.pytorch.org/t/undefined-symbols-for-architecture-x86-64-for-libtorch-in-swift-unit-test/84552/6 - NNPACK uses fast convolution algorithms (FFT, winograd) to reduce the computational complexity of convolutions with large kernel size. The algorithmic speedup is limited to specific conv params which are unlikely to appear in mobile networks. - Since XNNPACK has been enabled, it performs much better than NNPACK on depthwise-separable convolutions which is the algorithm being used by most of mobile computer vision networks. ### Test Plan - CI Checks Test Plan: Imported from OSS Differential Revision: D22087365 Pulled By: xta0 fbshipit-source-id: 89a959b0736c1f8703eff10723a8fbd02357fd4a
This commit is contained in:
parent
9d588f7ce2
commit
6de6041585
4 changed files with 5 additions and 9 deletions
|
|
@ -22,8 +22,6 @@ do
|
|||
lipo -create "${libs[@]}" -o ${ZIP_DIR}/install/lib/${lib}
|
||||
fi
|
||||
done
|
||||
# for nnpack, we only support arm64 build
|
||||
cp ${ARTIFACTS_DIR}/arm64/lib/libnnpack.a ./
|
||||
lipo -i ${ZIP_DIR}/install/lib/*.a
|
||||
# copy the umbrella header and license
|
||||
cp ${PROJ_ROOT}/ios/LibTorch.h ${ZIP_DIR}/src/
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ targets.each do |target|
|
|||
target.resources_build_phase.add_file_reference(config_file_ref, true)
|
||||
end
|
||||
puts "Linking static libraries..."
|
||||
libs = ['libc10.a', 'libclog.a', 'libnnpack.a', 'libXNNPACK.a', 'libeigen_blas.a', 'libcpuinfo.a', 'libpytorch_qnnpack.a', 'libtorch_cpu.a', 'libtorch.a']
|
||||
libs = ['libc10.a', 'libclog.a', 'libXNNPACK.a', 'libeigen_blas.a', 'libcpuinfo.a', 'libpytorch_qnnpack.a', 'libtorch_cpu.a', 'libtorch.a']
|
||||
targets.each do |target|
|
||||
target.frameworks_build_phases.clear
|
||||
for lib in libs do
|
||||
|
|
|
|||
|
|
@ -62,11 +62,8 @@ fi
|
|||
|
||||
# IOS_PLATFORM controls type of iOS platform (see ios-cmake)
|
||||
if [ -n "${IOS_PLATFORM:-}" ]; then
|
||||
CMAKE_ARGS+=("-DIOS_PLATFORM=${IOS_PLATFORM}")
|
||||
if [ "${IOS_PLATFORM}" == "SIMULATOR" ]; then
|
||||
# iOS Simulator build is not supported by NNPACK
|
||||
CMAKE_ARGS+=("-DUSE_NNPACK=OFF")
|
||||
elif [ "${IOS_PLATFORM}" == "WATCHOS" ]; then
|
||||
CMAKE_ARGS+=("-DIOS_PLATFORM=${IOS_PLATFORM}")
|
||||
if [ "${IOS_PLATFORM}" == "WATCHOS" ]; then
|
||||
# enable bitcode by default for watchos
|
||||
CMAKE_ARGS+=("-DCMAKE_C_FLAGS=-fembed-bitcode")
|
||||
CMAKE_ARGS+=("-DCMAKE_CXX_FLAGS=-fembed-bitcode")
|
||||
|
|
@ -95,6 +92,7 @@ CMAKE_ARGS+=("-DUSE_LMDB=OFF")
|
|||
CMAKE_ARGS+=("-DUSE_LEVELDB=OFF")
|
||||
CMAKE_ARGS+=("-DUSE_MPI=OFF")
|
||||
CMAKE_ARGS+=("-DUSE_NUMPY=OFF")
|
||||
CMAKE_ARGS+=("-DUSE_NNPACK=OFF")
|
||||
|
||||
# pthreads
|
||||
CMAKE_ARGS+=("-DCMAKE_THREAD_LIBS_INIT=-lpthread")
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ end
|
|||
|
||||
# link static libraries
|
||||
target.frameworks_build_phases.clear
|
||||
libs = ['libc10.a', 'libclog.a', 'libnnpack.a', 'libXNNPACK.a', 'libeigen_blas.a', 'libcpuinfo.a', 'libpytorch_qnnpack.a', 'libtorch_cpu.a', 'libtorch.a']
|
||||
libs = ['libc10.a', 'libclog.a', 'libXNNPACK.a', 'libeigen_blas.a', 'libcpuinfo.a', 'libpytorch_qnnpack.a', 'libtorch_cpu.a', 'libtorch.a']
|
||||
for lib in libs do
|
||||
path = "#{install_path}/lib/#{lib}"
|
||||
if File.exist?(path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue