Skip to content

Commit

Permalink
[mobile] add buck build for mobile targets (pytorch#76480)
Browse files Browse the repository at this point in the history
Create buck targets to replicate internal BUCK build, including
- XNNPACK
- QNNPACK
- C10
- aten_cpu
- torch_mobile_core
- torch_mobile_all_ops
- ptmobile_benchmark

And able to run mobilenet v2 using ptmobile_benchmark (with all ops).
Pull Request resolved: pytorch#76480
Approved by: https://github.com/seemethere, https://github.com/dreiss
  • Loading branch information
linbinyu authored and pytorchmergebot committed May 15, 2022
1 parent e5a752a commit 168dc70
Show file tree
Hide file tree
Showing 24 changed files with 4,356 additions and 4 deletions.
15 changes: 15 additions & 0 deletions .buckconfig.oss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[buildfile]
name = BUILD.buck

[repositories]
bazel_skylib = third_party/bazel-skylib/

[download]
in_build = true

[cxx]
cxxflags = -std=c++17
should_remap_host_platform = true

[project]
default_flavors_mode=all
53 changes: 50 additions & 3 deletions .github/workflows/buck_build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,54 @@ jobs:
wget https://github.com/facebook/buck/releases/download/v2021.01.12.01/buck.2021.01.12.01_all.deb
sudo apt install ./buck.2021.01.12.01_all.deb
- name: Build Buck target
- name: Download third party libraries and generate wrappers
run: |
echo -e "[buildfile]\n name = BUILD.buck\n" > .buckconfig
buck build --keep-going //third_party:
sh scripts/buck_setup.sh
- name: Build glog
run: |
buck build third_party:glog
- name: Build C10
run: |
buck build c10:c10
- name: Build cpuinfo
run: |
buck build third_party:cpuinfo
- name: Build pthreadpool
run: |
buck build third_party:pthreadpool
- name: Build XNNPACK
run: |
buck build third_party:XNNPACK
- name: Build QNNPACK
run: |
buck build aten/src/ATen/native/quantized/cpu/qnnpack/... --keep-going
- name: Build aten_cpu
run: |
buck build :aten_cpu
- name: Build torch_mobile_core
run: |
buck build :torch_mobile_core
- name: Build torch_mobile_all_ops
run: |
buck build :torch_mobile_all_ops
- name: Build mobile benchmark
run: |
buck build :ptmobile_benchmark
- name: Run lite interpreter model
run: |
buck run :ptmobile_benchmark -- --model=ios/TestApp/models/mobilenet_v2.ptl --input_dims=1,3,224,224 --input_type=float
- name: Build everything
run: |
buck build //... --keep-going
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,7 @@ pr.diff
.lsp-buck-out/
.lsp.buckd/
buck-out/

# Downloaded libraries
third_party/ruy/
third_party/glog/
4 changes: 4 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ include_patterns = [
'torch/utils/benchmark/utils/timer.py',
'torch/utils/benchmark/utils/valgrind_wrapper/**/*.py',
]
exclude_patterns = [
# (linbinyu) copied from internal repo
'tools/code_analyzer/gen_operators_yaml.py',
]
command = [
'python3',
'tools/linter/adapters/mypy_linter.py',
Expand Down
Loading

0 comments on commit 168dc70

Please sign in to comment.