Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libtorch iOS Build can't be used in unit test target #32040

Closed
mjjimenez opened this issue Jan 10, 2020 · 3 comments
Closed

Libtorch iOS Build can't be used in unit test target #32040

mjjimenez opened this issue Jan 10, 2020 · 3 comments
Assignees
Labels
module: ios Related to iOS support - build, API, Continuous Integration, document oncall: mobile Related to mobile support, including iOS and Android

Comments

@mjjimenez
Copy link

🐛 Bug

The current build for libtorch for iOS installed using cocoapods can't be included in a unit test target.

I've filed a cocoapods issue on this and they discovered that libnnpack.a is not a universal library,
causing the build error.

CocoaPods/CocoaPods#9473

To Reproduce

Steps to reproduce the behavior:

I just cloned your demo app here https://github.com/pytorch/ios-demo-app and added a unit test target to the HelloWorld demo.

I forked the repo and added the unit test target here:

https://github.com/mjjimenez/ios-demo-app

Expected behavior

Environment

   CocoaPods : 1.8.4
        Ruby : ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
    RubyGems : 2.4.6
        Host : Mac OS X 10.14.5 (18F132)
       Xcode : 11.3 (11C29)
         Git : git version 2.8.1
Ruby lib dir : /Users/mjjim2003/.rvm/rubies/ruby-2.2.1/lib
Repositories : master - git - https://github.com/CocoaPods/Specs.git @ 7bb44aaa4557b457f1c13cb1a7e403248a0ef594
               rnapier - git - https://github.com/rnapier/RNCryptor.git @ 5e3bbf44f08bf90049537cb8902d8f4fa911a79a
               trunk - CDN - https://cdn.cocoapods.org/
               twilio - git - https://github.com/twilio/cocoapod-specs @ 9bf659ed7246ba34625b81754031fbd5ac20fe68

Podfile

platform :ios, '12.0'
target 'HelloWorld' do
    pod 'LibTorch', '~> 1.3.0'

    target 'HelloWorldTests' do
      inherit! :search_paths

    end

end
@gchanan gchanan added oncall: mobile Related to mobile support, including iOS and Android module: ios Related to iOS support - build, API, Continuous Integration, document labels Jan 14, 2020
@xta0
Copy link
Contributor

xta0 commented Jan 15, 2020

@mjjimenez As discussed in the forum, this is a known issue, as NNPACK doesn’t support the iOS simulator architecture - https://github.com/Maratyszcza/NNPACK. We've actively working on enabling XNNPACK which will replace NNPACK in the future.

@Jthora
Copy link

Jthora commented Mar 5, 2020

@xta0 What is the ETA on the fix?

The lack of simulator is a blocker for our production team's ability to go next-stage with PyTorch. We have opened discussions to use TensorFlow instead as a result of this blocker, but PyTorch would have been preferred by some elements in our development pipeline.

If you can estimate a time range for when the issue will be resolved: We can create a plan around that as to go with PyTorch instead of TensorFlow.

@xta0
Copy link
Contributor

xta0 commented Jun 5, 2020

@xta0 What is the ETA on the fix?

The lack of simulator is a blocker for our production team's ability to go next-stage with PyTorch. We have opened discussions to use TensorFlow instead as a result of this blocker, but PyTorch would have been preferred by some elements in our development pipeline.

If you can estimate a time range for when the issue will be resolved: We can create a plan around that as to go with PyTorch instead of TensorFlow.

Hey we've already enabled the XNNPACK for our mobile build. The official cocoapods (1.6.0) release will be in July.

@xta0 xta0 self-assigned this Jun 10, 2020
xta0 added a commit that referenced this issue Jun 16, 2020
### 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
    - #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


[ghstack-poisoned]
xta0 added a commit that referenced this issue Jun 17, 2020
### 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
    - #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


[ghstack-poisoned]
facebook-github-bot pushed a commit that referenced this issue Jun 17, 2020
Summary:
Pull Request resolved: #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
    - #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
xwang233 pushed a commit to xwang233/pytorch that referenced this issue Jun 20, 2020
Summary:
Pull Request resolved: pytorch#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
    - pytorch#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
@xta0 xta0 closed this as completed Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: ios Related to iOS support - build, API, Continuous Integration, document oncall: mobile Related to mobile support, including iOS and Android
Projects
None yet
Development

No branches or pull requests

4 participants