[Mobile Tracer] Use unified source file list for BUCK build (#84770)

Currently, the source list `torch_mobile_tracer_sources` in `build_variables.bzl` is used only for OSS build. This resulted in a regression for OSS builds when `TRACING_BASED=1` was used to build the OSS model tracer binary. To prevent this from happening in the future, it makes sense to re-use this list for internal BUCK builds as well. This change does that.

#accept2ship

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

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D39392010/)!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/84770
Approved by: https://github.com/cccclai
This commit is contained in:
Dhruv Matani 2022-09-09 12:16:52 -07:00 committed by PyTorch MergeBot
parent 1dabb51a16
commit c4a5255df7

View File

@ -22,6 +22,7 @@ load(
"jit_core_headers",
"jit_core_sources",
"libtorch_profiler_sources",
"torch_mobile_tracer_sources",
)
load(
":pt_ops.bzl",
@ -507,6 +508,16 @@ def copy_template_registration_files(name, apple_sdks = None):
apple_sdks = apple_sdks,
)
def get_feature_tracer_source_list():
"""
Return just the Feature specific handlers used in the model tracer.
"""
sources = []
for s in torch_mobile_tracer_sources:
if s.endswith("Tracer.cpp"):
sources.append(s)
return sources
def pt_operator_query_codegen(
name,
deps = [],
@ -1254,12 +1265,8 @@ def define_buck_targets(
pt_xplat_cxx_library(
name = "torch_model_tracer",
srcs = [
"torch/csrc/jit/mobile/model_tracer/BuildFeatureTracer.cpp",
"torch/csrc/jit/mobile/model_tracer/CustomClassTracer.cpp",
"torch/csrc/jit/mobile/model_tracer/KernelDTypeTracer.cpp",
"torch/csrc/jit/mobile/model_tracer/OperatorCallTracer.cpp",
"torch/csrc/jit/mobile/model_tracer/TracerRunner.cpp",
],
] + get_feature_tracer_source_list(),
header_namespace = "",
compiler_flags = get_pt_compiler_flags(),
exported_preprocessor_flags = get_pt_preprocessor_flags() + (["-DSYMBOLICATE_MOBILE_DEBUG_HANDLE"] if get_enable_eager_symbolication() else []),