Skip to content

[iOS] Add watchOS support #33318

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

Closed
wants to merge 3 commits into from
Closed

[iOS] Add watchOS support #33318

wants to merge 3 commits into from

Conversation

xta0
Copy link
Contributor

@xta0 xta0 commented Feb 13, 2020

Stack from ghstack:

Summary

Recently, we have a discussion in the forum about watchOS. This PR adds the support for building watchOS libraries.

Test Plan

  • BUILD_PYTORCH_MOBILE=1 IOS_PLATFORM=WATCHOS ./scripts/build_ios.sh

Differential Revision: D19896534

[ghstack-poisoned]
xta0 added a commit that referenced this pull request Feb 13, 2020
ghstack-source-id: 3ac8287
Pull Request resolved: #33318
CMakeLists.txt Outdated
@@ -343,7 +343,9 @@ if (INTERN_BUILD_MOBILE AND NOT BUILD_CAFFE2_MOBILE)
set(FEATURE_TORCH_MOBILE ON)
set(NO_API ON)
set(USE_FBGEMM OFF)
set(USE_PYTORCH_QNNPACK ON)
if (NOT USE_PYTORCH_QNNPACK)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add this if?

Copy link
Contributor Author

@xta0 xta0 Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because it'll overwrite this param in iOS build script. See the change in build_ios.sh down below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there is a way to differentiate unset variable v.s. OFF variable in cmake. I think even if you explicitly set USE_PYTORCH_QNNPACK to OFF below, "NOT USE_PYTORCH_QNNPACK" will evaluate to TRUE and it will be set to ON again. I haven't tested, though.
I was thinking of not exposing this USE_PYTORCH_QNNPACK flag to external developer to reduce complexity, as it is always ON for mobile builds. But if there is legit reason to disable it for certain mobile devices, maybe we should just remove set(USE_PYTORCH_QNNPACK ON) here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljk53 should be if(NOT DEFINED USE_PYTORCH_QNNPACK). My mistake.

### Summary

Recently, we have a [discussion](https://discuss.pytorch.org/t/libtorch-on-watchos/69073/14) in the forum about watchOS. This PR adds the support for building watchOS  libraries.

### Test Plan

- `BUILD_PYTORCH_MOBILE=1 IOS_PLATFORM=WATCHOS ./scripts/build_ios.sh`

Differential Revision: [D19896534](https://our.internmc.facebook.com/intern/diff/D19896534)

[ghstack-poisoned]
xta0 added a commit that referenced this pull request Feb 14, 2020
ghstack-source-id: cc5f13c
Pull Request resolved: #33318
CMakeLists.txt Outdated
@@ -343,7 +343,9 @@ if (INTERN_BUILD_MOBILE AND NOT BUILD_CAFFE2_MOBILE)
set(FEATURE_TORCH_MOBILE ON)
set(NO_API ON)
set(USE_FBGEMM OFF)
set(USE_PYTORCH_QNNPACK ON)
if (NOT DEFINED USE_PYTORCH_QNNPACK)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we set default value for "USE_PYTORCH_QNNPACK" on Line 181 - will NOT DEFINED ever become true?
I think we should simply removed "set(USE_PYTORCH_QNNPACK ON)" here as we already have default value set to ON for it. I cannot remember why I set this in the first place, maybe was trying to enforce using it everywhere for mobile.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the best way to do it.

### Summary

Recently, we have a [discussion](https://discuss.pytorch.org/t/libtorch-on-watchos/69073/14) in the forum about watchOS. This PR adds the support for building watchOS  libraries.

### Test Plan

- `BUILD_PYTORCH_MOBILE=1 IOS_PLATFORM=WATCHOS ./scripts/build_ios.sh`

Differential Revision: [D19896534](https://our.internmc.facebook.com/intern/diff/D19896534)

[ghstack-poisoned]
xta0 added a commit that referenced this pull request Feb 14, 2020
ghstack-source-id: 5521b84
Pull Request resolved: #33318
@@ -343,7 +343,6 @@ if (INTERN_BUILD_MOBILE AND NOT BUILD_CAFFE2_MOBILE)
set(FEATURE_TORCH_MOBILE ON)
set(NO_API ON)
set(USE_FBGEMM OFF)
set(USE_PYTORCH_QNNPACK ON)
set(USE_QNNPACK OFF)
Copy link
Contributor

@ljk53 ljk53 Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think I remember why I added the line above - because I turned USE_QNNPACK OFF and turned USE_PYTORCH_QNNPACK ON - I want to pair them up. i.e. the reason we turned off USE_QNNPACK here is because we turned on better alternative. (just comment, no action needed)

Comment on lines 124 to +125
message(STATUS " USE_QNNPACK : ${USE_QNNPACK}")
message(STATUS " USE_PYTORCH_QNNPACK : ${USE_PYTORCH_QNNPACK}")
Copy link
Contributor

@ljk53 ljk53 Feb 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really hope we can consolidate these two one day :) (again, just comment)

@dr-ci
Copy link

dr-ci bot commented Feb 14, 2020

💊 CircleCI build failures summary and remediations

As of commit ac4663f:

  • 1/1 failures introduced in this PR

Detailed failure analysis

One may explore the probable reasons each build failed interactively on the Dr. CI website.

1 failure not recognized by patterns:

Job Step Status
CircleCI pytorch_macos_10_13_py3_test Test New in PR

This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker.

@facebook-github-bot
Copy link
Contributor

@xta0 merged this pull request in 9c0625b.

@facebook-github-bot facebook-github-bot deleted the gh/xta0/52/head branch February 18, 2020 15:18
ttumiel pushed a commit to ttumiel/pytorch that referenced this pull request Mar 4, 2020
Summary:
Pull Request resolved: pytorch#33318

### Summary

Recently, we have a [discussion](https://discuss.pytorch.org/t/libtorch-on-watchos/69073/14) in the forum about watchOS. This PR adds the support for building watchOS  libraries.

### Test Plan

- `BUILD_PYTORCH_MOBILE=1 IOS_PLATFORM=WATCHOS ./scripts/build_ios.sh`

Test Plan: Imported from OSS

Differential Revision: D19896534

Pulled By: xta0

fbshipit-source-id: 7b9286475e895d9fefd998246e7090ac92c4c9b6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants