Skip to content

Commit

Permalink
Manual changes for moving dynamo to core (pytorch#86621)
Browse files Browse the repository at this point in the history
This is the subset of the changes in pytorch#86461 not auto-generated by `copy_to_core.sh`.
Pull Request resolved: pytorch#86621
Approved by: https://github.com/albanD
  • Loading branch information
jansel authored and pytorchmergebot committed Oct 11, 2022
1 parent 09364f4 commit f1fdb6e
Show file tree
Hide file tree
Showing 14 changed files with 1,080 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ torch/test/
torch/utils/benchmark/utils/valgrind_wrapper/callgrind.h
torch/utils/benchmark/utils/valgrind_wrapper/valgrind.h
torch/version.py
minifier_launcher.py
# Root level file used in CI to specify certain env configs.
# E.g., see .circleci/config.yaml
env
Expand Down
7 changes: 7 additions & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ include_patterns = [
exclude_patterns = [
'torch/include/**',
'torch/csrc/**',
'torch/_dynamo/**/*.py',
'torch/_inductor/**/*.py',
'torch/distributed/elastic/agent/server/api.py',
'torch/testing/_internal/**',
'torch/distributed/fsdp/fully_sharded_data_parallel.py',
Expand Down Expand Up @@ -703,6 +705,11 @@ include_patterns = [
'test/onnx/**/*.py',
'test/test_dynamo_cudagraphs.py',
'tools/**/*.py',
'torch/_dynamo/**/*.py',
'test/dynamo/**/*.py',
'benchmarks/dynamo/**/*.py',
'torch/_inductor/**/*.py',
'test/inductor/**/*.py',
'torch/onnx/**/*.py',
'torch/package/**/*.py',
'torch/_decomp/**/*.py',
Expand Down
8 changes: 8 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,11 @@ torch/csrc/autograd/profiler* @robieta
torch/autograd/profiler* @robieta
torch/csrc/profiler/ @robieta
torch/profiler/ @robieta

# TorchDynamo
benchmarks/dynamo @jansel
test/dynamo @jansel
test/inductor @jansel
torch/csrc/dynamo @jansel
torch/_dynamo @jansel
torch/_inductor @jansel
3 changes: 3 additions & 0 deletions build_variables.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,9 @@ libtorch_python_core_sources = [
"torch/csrc/autograd/python_torch_functions_manual.cpp",
"torch/csrc/autograd/python_variable.cpp",
"torch/csrc/autograd/python_variable_indexing.cpp",
"torch/csrc/dynamo/eval_frame.c",
"torch/csrc/dynamo/guards.cpp",
"torch/csrc/dynamo/init.cpp",
"torch/csrc/functorch/init.cpp",
"torch/csrc/jit/backends/backend_init.cpp",
"torch/csrc/jit/codegen/cuda/python_frontend/python_bindings.cpp",
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,8 @@ def main():
'include/THH/*.cuh',
'include/THH/*.h*',
'include/THH/generic/*.h',
"_inductor/codegen/*.h",
"_inductor/codegen/*.j2",
'share/cmake/ATen/*.cmake',
'share/cmake/Caffe2/*.cmake',
'share/cmake/Caffe2/public/*.cmake',
Expand Down
16 changes: 16 additions & 0 deletions test/test_public_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
import os
import unittest


# TODO(jansel): we should remove this workaround once this is fixed:
# https://github.com/pytorch/pytorch/issues/86619
NOT_IMPORTED_WHEN_TEST_WRITTEN = {
"torch.fx.experimental.normalize",
"torch.fx.experimental.proxy_tensor",
"torch.fx.experimental.schema_type_annotation",
"torch.fx.experimental.symbolic_shapes",
"torch.fx.passes.backends.cudagraphs",
"torch.fx.passes.infra.partitioner",
"torch.fx.passes.utils.fuser_utils",
}


class TestPublicBindings(TestCase):
def test_no_new_bindings(self):
"""
Expand Down Expand Up @@ -320,6 +334,8 @@ def check_one_element(elem, modname, mod, *, is_public, is_all):
why_not_looks_public = f"because it starts with `_` (`{elem}`)"

if is_public != looks_public:
if modname in NOT_IMPORTED_WHEN_TEST_WRITTEN:
return
if modname in allow_dict and elem in allow_dict[modname]:
return

Expand Down
2 changes: 2 additions & 0 deletions torch/csrc/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#include <torch/csrc/autograd/python_sparse_functions.h>
#include <torch/csrc/autograd/python_special_functions.h>
#include <torch/csrc/autograd/python_variable.h>
#include <torch/csrc/dynamo/init.h>
#include <torch/csrc/functorch/init.h>
#include <torch/csrc/jit/python/init.h>
#include <torch/csrc/jit/python/python_ir.h>
Expand Down Expand Up @@ -1132,6 +1133,7 @@ PyObject* initModule() {
torch::jit::initJITBindings(module);
torch::monitor::initMonitorBindings(module);
torch::impl::dispatch::initDispatchBindings(module);
torch::dynamo::initDynamoBindings(module);
torch::functorch::impl::initFuncTorchBindings(module);
torch::throughput_benchmark::initThroughputBenchmarkBindings(module);
torch::autograd::initReturnTypes(module);
Expand Down
Loading

0 comments on commit f1fdb6e

Please sign in to comment.