Skip to content

Commit e98e7fe

Browse files
linbinyupytorchmergebot
authored andcommitted
[4] move pt_operator_library to shared BUCK file (#80170)
Summary: Move pt_operator_library to pt_ops.bzl and make it shared with OSS BUCK build This will replace D36912042. I will update all load statements in future diffs. Test Plan: sandcaslte, OSS CI Differential Revision: D37390060 Pull Request resolved: pytorch/pytorch#80170 Approved by: https://github.com/JacobSzwejbka
1 parent bda04e9 commit e98e7fe

File tree

5 files changed

+126
-208
lines changed

5 files changed

+126
-208
lines changed

.github/workflows/_buck-build-test.yml

+3-15
Original file line numberDiff line numberDiff line change
@@ -62,29 +62,17 @@ jobs:
6262
command: |
6363
sh scripts/buck_setup.sh
6464
65-
- name: Build glog
66-
run: |
67-
buck build third_party:glog
68-
6965
- name: Build C10
7066
run: |
7167
buck build c10:c10
7268
73-
- name: Build cpuinfo
74-
run: |
75-
buck build third_party:cpuinfo
76-
77-
- name: Build pthreadpool
78-
run: |
79-
buck build third_party:pthreadpool
80-
8169
- name: Build XNNPACK
8270
run: |
8371
buck build third_party:XNNPACK
8472
8573
- name: Build QNNPACK
8674
run: |
87-
buck build aten/src/ATen/native/quantized/cpu/qnnpack/... --keep-going
75+
buck build aten/src/ATen/native/quantized/cpu/qnnpack:pytorch_qnnpack
8876
8977
- name: Build aten_cpu
9078
run: |
@@ -94,9 +82,9 @@ jobs:
9482
run: |
9583
buck build :torch_mobile_core
9684
97-
- name: Build torch_mobile_all_ops
85+
- name: Build pt_ops_full
9886
run: |
99-
buck build :torch_mobile_all_ops
87+
buck build :pt_ops_full
10088
10189
- name: Build mobile benchmark
10290
run: |

BUCK.oss

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
load("//tools/build_defs:glob_defs.bzl", "subdir_glob")
22
load(
3-
":pt_defs.oss.bzl",
3+
":pt_ops.bzl",
44
"pt_operator_library",
5-
"get_pt_ops_deps",
65
)
76
load(":buckbuild.bzl",
87
"define_buck_targets",
8+
"get_pt_operator_registry_dict",
99
)
1010

11+
# define shared buck targets
1112
define_buck_targets()
1213

14+
# define OSS only targets
1315
cxx_library(
1416
name = "pthreadpool",
1517
srcs = ['caffe2/utils/threadpool/pthreadpool.cc', 'caffe2/utils/threadpool/pthreadpool_impl.cc', 'caffe2/utils/threadpool/pthreadpool-cpp.cc', 'caffe2/utils/threadpool/thread_pool_guard.cpp', 'caffe2/utils/threadpool/ThreadPool.cc'],
@@ -76,21 +78,17 @@ cxx_library(
7678

7779
pt_operator_library(
7880
name = "torch_mobile_ops_full_dev",
79-
check_decl = False,
8081
include_all_operators = True,
8182
)
8283

8384
cxx_library(
84-
name = "torch_mobile_all_ops",
85-
visibility = ["PUBLIC"],
86-
deps = get_pt_ops_deps(
85+
name = "pt_ops_full",
86+
**get_pt_operator_registry_dict(
8787
name = "pt_ops_full",
88-
train = False,
8988
deps = [
9089
":torch_mobile_ops_full_dev",
9190
],
92-
enable_flatbuffer = False,
93-
),
91+
)
9492
)
9593

9694
cxx_binary(
@@ -118,7 +116,7 @@ cxx_binary(
118116
],
119117
deps = [
120118
":torch_mobile_core",
121-
":torch_mobile_all_ops",
119+
":pt_ops_full",
122120
"//c10:c10",
123121
],
124122
)

buckbuild.bzl

+4-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ load(
2525
"jit_core_sources",
2626
"libtorch_profiler_sources",
2727
)
28+
load(
29+
":pt_ops.bzl",
30+
"USED_PT_BACKENDS",
31+
)
2832
load(
2933
":pt_template_srcs.bzl",
3034
"METAL_MASKRCNN_SOURCE_LIST",
@@ -235,12 +239,6 @@ def get_pt_preprocessor_flags():
235239
PT_PREPROCESSOR_FLAGS.append("-DENABLE_PYTORCH_NON_PRODUCTION_BUILDS")
236240
return PT_PREPROCESSOR_FLAGS
237241

238-
USED_PT_BACKENDS = [
239-
"CPU",
240-
"QuantizedCPU",
241-
"SparseCPU", # brings ~20 kb size regression
242-
]
243-
244242
# This needs to be kept in sync with https://github.com/pytorch/pytorch/blob/release/1.9/torchgen/gen.py#L892
245243
PT_BACKEND_HEADERS = [
246244
"CPU",

pt_defs.oss.bzl

-177
This file was deleted.

0 commit comments

Comments
 (0)