Skip to content

Commit

Permalink
[4] move pt_operator_library to shared BUCK file (#80170)
Browse files Browse the repository at this point in the history
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: #80170
Approved by: https://github.com/JacobSzwejbka
  • Loading branch information
linbinyu authored and pytorchmergebot committed Jun 24, 2022
1 parent bda04e9 commit e98e7fe
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 208 deletions.
18 changes: 3 additions & 15 deletions .github/workflows/_buck-build-test.yml
Expand Up @@ -62,29 +62,17 @@ jobs:
command: |
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
buck build aten/src/ATen/native/quantized/cpu/qnnpack:pytorch_qnnpack
- name: Build aten_cpu
run: |
Expand All @@ -94,9 +82,9 @@ jobs:
run: |
buck build :torch_mobile_core
- name: Build torch_mobile_all_ops
- name: Build pt_ops_full
run: |
buck build :torch_mobile_all_ops
buck build :pt_ops_full
- name: Build mobile benchmark
run: |
Expand Down
18 changes: 8 additions & 10 deletions BUCK.oss
@@ -1,15 +1,17 @@
load("//tools/build_defs:glob_defs.bzl", "subdir_glob")
load(
":pt_defs.oss.bzl",
":pt_ops.bzl",
"pt_operator_library",
"get_pt_ops_deps",
)
load(":buckbuild.bzl",
"define_buck_targets",
"get_pt_operator_registry_dict",
)

# define shared buck targets
define_buck_targets()

# define OSS only targets
cxx_library(
name = "pthreadpool",
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'],
Expand Down Expand Up @@ -76,21 +78,17 @@ cxx_library(

pt_operator_library(
name = "torch_mobile_ops_full_dev",
check_decl = False,
include_all_operators = True,
)

cxx_library(
name = "torch_mobile_all_ops",
visibility = ["PUBLIC"],
deps = get_pt_ops_deps(
name = "pt_ops_full",
**get_pt_operator_registry_dict(
name = "pt_ops_full",
train = False,
deps = [
":torch_mobile_ops_full_dev",
],
enable_flatbuffer = False,
),
)
)

cxx_binary(
Expand Down Expand Up @@ -118,7 +116,7 @@ cxx_binary(
],
deps = [
":torch_mobile_core",
":torch_mobile_all_ops",
":pt_ops_full",
"//c10:c10",
],
)
10 changes: 4 additions & 6 deletions buckbuild.bzl
Expand Up @@ -25,6 +25,10 @@ load(
"jit_core_sources",
"libtorch_profiler_sources",
)
load(
":pt_ops.bzl",
"USED_PT_BACKENDS",
)
load(
":pt_template_srcs.bzl",
"METAL_MASKRCNN_SOURCE_LIST",
Expand Down Expand Up @@ -235,12 +239,6 @@ def get_pt_preprocessor_flags():
PT_PREPROCESSOR_FLAGS.append("-DENABLE_PYTORCH_NON_PRODUCTION_BUILDS")
return PT_PREPROCESSOR_FLAGS

USED_PT_BACKENDS = [
"CPU",
"QuantizedCPU",
"SparseCPU", # brings ~20 kb size regression
]

# This needs to be kept in sync with https://github.com/pytorch/pytorch/blob/release/1.9/torchgen/gen.py#L892
PT_BACKEND_HEADERS = [
"CPU",
Expand Down
177 changes: 0 additions & 177 deletions pt_defs.oss.bzl

This file was deleted.

0 comments on commit e98e7fe

Please sign in to comment.