Fetch TORCH_SRCS from build_variables.bzl#36737
Fetch TORCH_SRCS from build_variables.bzl#36737malfet wants to merge 1 commit intopytorch:masterfrom
build_variables.bzl#36737Conversation
💊 Build failures summary and remediationsAs of commit 7446cc7 (more details on the Dr. CI page):
XLA failureJob pytorch_xla_linux_bionic_py3_6_clang9_build is failing. Please create an issue with title prefixed by 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. This comment has been revised 8 times. |
Mimic `.bzl` parsing logic from pytorch/FBGEMM#344 Generate `libtorch_cmake_sources` by running following script: ``` def read_file(path): with open(path) as f: return f.read() def get_cmake_torch_srcs(): caffe2_cmake = read_file("caffe2/CMakeLists.txt") start = caffe2_cmake.find("set(TORCH_SRCS") end = caffe2_cmake.find(")", start) return caffe2_cmake[start:end+1] def get_cmake_torch_srcs_list(): caffe2_torch_srcs = get_cmake_torch_srcs() unfiltered_list = [x.strip() for x in get_cmake_torch_srcs().split("\n") if len(x.strip())>0] return [x.replace("${TORCH_SRC_DIR}/","torch/") for x in unfiltered_list if 'TORCH_SRC_DIR' in x] import imp build_variables = imp.load_source('build_variables', 'tools/build_variables.bzl') libtorch_core_sources = set(build_variables.libtorch_core_sources) caffe2_torch_srcs = set(get_cmake_torch_srcs_list()) if not libtorch_core_sources.issubset(caffe2_torch_srcs): print("libtorch_core_sources must be a subset of caffe2_torch_srcs") print(sorted(caffe2_torch_srcs.difference(libtorch_core_sources))) ``` Move common files between `libtorch_cmake_sources` and `libtorch_extra_sources` to `libtorch_jit_core_sources` Test Plan: CI
94524dd to
7446cc7
Compare
facebook-github-bot
left a comment
There was a problem hiding this comment.
@malfet is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@malfet - maybe I missed it, but don't you need |
|
@dzhulgakov you are absolutely right. Addressed in #36809 |
| ${TORCH_SRC_DIR}/csrc/jit/api/function_impl.cpp | ||
| ${TORCH_SRC_DIR}/csrc/jit/runtime/vararg_functions.cpp | ||
|
|
||
| ${TORCH_SRC_DIR}/csrc/jit/tensorexpr/bounds_inference.cpp |
There was a problem hiding this comment.
@malfet do you have plan to read other lists (those gated by USE_DISTRIBUTED / USE_CUDA / etc) from build_variables.bzl as well?
I'm asking because I plan to remove 'tensorexpr/' from mobile build to reduce binary size. My plan is to create a separate list in build_variables.bzl and move tensorexpr/ related stuff from "libtorch_cmake_sources" into it. I'd like to make sure it's aligned with your long term plan before making the change.
There was a problem hiding this comment.
Yes, that aligns with the longer term plan.
Please go ahead and create a list in build_variables.bzl and read it in caffe2/CmakeLists.txt using get_filelist() macro. And feel free to expand it to append_filelist, if it'll make more sense.
Summary: Mimic `.bzl` parsing logic from pytorch/FBGEMM#344 Generate `libtorch_cmake_sources` by running following script: ``` def read_file(path): with open(path) as f: return f.read() def get_cmake_torch_srcs(): caffe2_cmake = read_file("caffe2/CMakeLists.txt") start = caffe2_cmake.find("set(TORCH_SRCS") end = caffe2_cmake.find(")", start) return caffe2_cmake[start:end+1] def get_cmake_torch_srcs_list(): caffe2_torch_srcs = get_cmake_torch_srcs() unfiltered_list = [x.strip() for x in get_cmake_torch_srcs().split("\n") if len(x.strip())>0] return [x.replace("${TORCH_SRC_DIR}/","torch/") for x in unfiltered_list if 'TORCH_SRC_DIR' in x] import imp build_variables = imp.load_source('build_variables', 'tools/build_variables.bzl') libtorch_core_sources = set(build_variables.libtorch_core_sources) caffe2_torch_srcs = set(get_cmake_torch_srcs_list()) if not libtorch_core_sources.issubset(caffe2_torch_srcs): print("libtorch_core_sources must be a subset of caffe2_torch_srcs") print(sorted(caffe2_torch_srcs.difference(libtorch_core_sources))) ``` Move common files between `libtorch_cmake_sources` and `libtorch_extra_sources` to `libtorch_jit_core_sources` Pull Request resolved: pytorch#36737 Test Plan: CI Differential Revision: D21078753 Pulled By: malfet fbshipit-source-id: f46ca48d48aa122188f028136c14687ff52629ed
Mimic
.bzlparsing logic from pytorch/FBGEMM#344Generate
libtorch_cmake_sourcesby running following script:Move common files between
libtorch_cmake_sourcesandlibtorch_extra_sourcestolibtorch_jit_core_sourcesTest Plan: CI