Skip to content

Commit edc5ef1

Browse files
Krovatkinfacebook-github-bot
authored andcommittedApr 29, 2020
run the simple executor for jit tests by default, add profiling jobs … (pytorch#37017)
Summary: …for fusion tests fix flake8 warnings fix ci failures fix test_determination.py Pull Request resolved: pytorch#37017 Differential Revision: D21238446 Pulled By: Krovatkin fbshipit-source-id: 393e6135883dc5ac57bdff580de96c66829d454c
1 parent 6fa76b8 commit edc5ef1

12 files changed

+42
-19
lines changed
 

‎.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2727,11 +2727,11 @@ workflows:
27272727
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.6-gcc5.4:8fcf46ef-4a34-480b-a8ee-b0a30a4d3e59"
27282728
resource_class: large
27292729
- pytorch_linux_test:
2730-
name: pytorch_linux_xenial_py3_6_gcc5_4_ge_config_simple_test
2730+
name: pytorch_linux_xenial_py3_6_gcc5_4_ge_config_profiling_test
27312731
requires:
27322732
- setup
27332733
- pytorch_linux_xenial_py3_6_gcc5_4_build
2734-
build_environment: "pytorch-linux-xenial-py3.6-gcc5.4-ge_config_simple-test"
2734+
build_environment: "pytorch-linux-xenial-py3.6-gcc5.4-ge_config_profiling-test"
27352735
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.6-gcc5.4:8fcf46ef-4a34-480b-a8ee-b0a30a4d3e59"
27362736
resource_class: large
27372737
- pytorch_linux_test:

‎.circleci/verbatim-sources/workflows-pytorch-ge-config-tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.6-gcc5.4:8fcf46ef-4a34-480b-a8ee-b0a30a4d3e59"
88
resource_class: large
99
- pytorch_linux_test:
10-
name: pytorch_linux_xenial_py3_6_gcc5_4_ge_config_simple_test
10+
name: pytorch_linux_xenial_py3_6_gcc5_4_ge_config_profiling_test
1111
requires:
1212
- setup
1313
- pytorch_linux_xenial_py3_6_gcc5_4_build
14-
build_environment: "pytorch-linux-xenial-py3.6-gcc5.4-ge_config_simple-test"
14+
build_environment: "pytorch-linux-xenial-py3.6-gcc5.4-ge_config_profiling-test"
1515
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.6-gcc5.4:8fcf46ef-4a34-480b-a8ee-b0a30a4d3e59"
1616
resource_class: large
1717
- pytorch_linux_test:

‎.jenkins/pytorch/macos-test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test_python_all() {
6363
# Increase default limit on open file handles from 256 to 1024
6464
ulimit -n 1024
6565

66-
python test/run_test.py --verbose --determine-from="$DETERMINE_FROM"
66+
python test/run_test.py --verbose --exclude test_jit_profiling test_jit_legacy test_jit_fuser_legacy test_jit_fuser_profiling test_jit_fuser_te test_tensorexpr --determine-from="$DETERMINE_FROM"
6767

6868
assert_git_not_dirty
6969
}

‎.jenkins/pytorch/test.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ test_python_nn() {
143143
assert_git_not_dirty
144144
}
145145

146-
test_python_ge_config_simple() {
147-
time python test/run_test.py --include test_jit_simple --verbose --determine-from="$DETERMINE_FROM"
146+
test_python_ge_config_profiling() {
147+
time python test/run_test.py --include test_jit_profiling test_jit_fuser_profiling test_jit_fuser_te --verbose --determine-from="$DETERMINE_FROM"
148148
assert_git_not_dirty
149149
}
150150

@@ -154,7 +154,7 @@ test_python_ge_config_legacy() {
154154
}
155155

156156
test_python_all_except_nn() {
157-
time python test/run_test.py --exclude test_nn test_jit_simple test_jit_legacy test_jit_fuser_legacy --verbose --determine-from="$DETERMINE_FROM"
157+
time python test/run_test.py --exclude test_nn test_jit_profiling test_jit_legacy test_jit_fuser_legacy test_jit_fuser_profiling test_jit_fuser_te test_tensorexpr --verbose --determine-from="$DETERMINE_FROM"
158158
assert_git_not_dirty
159159
}
160160

@@ -298,8 +298,8 @@ elif [[ "${BUILD_ENVIRONMENT}" == *xla* || "${JOB_BASE_NAME}" == *xla* ]]; then
298298
test_xla
299299
elif [[ "${BUILD_ENVIRONMENT}" == *ge_config_legacy* || "${JOB_BASE_NAME}" == *ge_config_legacy* ]]; then
300300
test_python_ge_config_legacy
301-
elif [[ "${BUILD_ENVIRONMENT}" == *ge_config_simple* || "${JOB_BASE_NAME}" == *ge_config_simple* ]]; then
302-
test_python_ge_config_simple
301+
elif [[ "${BUILD_ENVIRONMENT}" == *ge_config_profiling* || "${JOB_BASE_NAME}" == *ge_config_profiling* ]]; then
302+
test_python_ge_config_profiling
303303
elif [[ "${BUILD_ENVIRONMENT}" == *libtorch* ]]; then
304304
# TODO: run some C++ tests
305305
echo "no-op at the moment"
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
call %SCRIPT_HELPERS_DIR%\setup_pytorch_env.bat
2-
cd test && python run_test.py --exclude test_nn test_jit_simple test_jit_legacy test_jit_fuser_legacy --verbose --determine-from="%1" && cd ..
2+
cd test && python run_test.py --exclude test_jit_profiling test_jit_legacy test_jit_fuser_legacy test_jit_fuser_profiling test_jit_fuser_te test_tensorexpr --verbose --determine-from="%1" && cd ..
33
if ERRORLEVEL 1 exit /b 1

‎test/run_test.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
'test_type_hints',
5858
'test_utils',
5959
'test_namedtuple_return_api',
60-
'test_jit_fuser',
61-
'test_jit_simple',
60+
'test_jit_profiling',
6261
'test_jit_legacy',
6362
'test_jit_fuser_legacy',
63+
'test_jit_fuser_profiling',
6464
'test_tensorboard',
6565
'test_namedtensor',
6666
'test_type_promotion',
@@ -118,8 +118,9 @@
118118
'test_jit_legacy',
119119
'test_dataloader',
120120
'test_overrides',
121-
'test_jit_simple',
122121
'test_jit',
122+
'test_jit_profiling',
123+
'test_jit_fuser_profiling',
123124
'test_torch',
124125
'distributed/test_distributed',
125126
'distributed/rpc/test_rpc_spawn',

‎test/test_determination.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class DeterminationTest(unittest.TestCase):
1313
# Test determination on a subset of tests
1414
TESTS = [
1515
"test_nn",
16-
"test_jit_simple",
16+
"test_jit_profiling",
1717
"test_jit",
1818
"test_torch",
1919
"distributed/test_distributed",
@@ -61,11 +61,11 @@ def test_cpp_file(self):
6161
def test_test_file(self):
6262
"""Test files trigger themselves and dependent tests"""
6363
self.assertEqual(
64-
self.determined_tests(["test/test_jit.py"]), ["test_jit_simple", "test_jit"]
64+
self.determined_tests(["test/test_jit.py"]), ["test_jit_profiling", "test_jit"]
6565
)
6666
self.assertEqual(
6767
self.determined_tests(["test/jit/test_custom_operators.py"]),
68-
["test_jit_simple", "test_jit"],
68+
["test_jit_profiling", "test_jit"],
6969
)
7070
self.assertEqual(
7171
self.determined_tests(["test/distributed/rpc/test_rpc_spawn.py"]),

‎test/test_jit_fuser_profiling.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys
2+
sys.argv.append("--ge_config=profiling")
3+
from test_jit_fuser import *
4+
5+
if __name__ == '__main__':
6+
run_tests()

‎test/test_jit_fuser_te.py

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
from te_utils import CudaCodeGenExecuted
2323

24+
torch._C._jit_set_profiling_executor(True)
25+
torch._C._jit_set_profiling_mode(True)
26+
2427
FUSION_GROUP = 'tensorexpr::Group'
2528

2629
def strip_profiling_nodes(nodes):

‎test/test_jit_profiling.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import sys
2+
sys.argv.append("--ge_config=profiling")
3+
from test_jit import *
4+
5+
if __name__ == '__main__':
6+
run_tests()
7+
if not PY2:
8+
import test_jit_py3
9+
suite = unittest.findTestCases(test_jit_py3)
10+
unittest.TextTestRunner().run(suite)

‎torch/csrc/jit/runtime/profiling_graph_executor_impl.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ C10_DEFINE_bool(
3232
namespace torch {
3333
namespace jit {
3434

35+
// TODO: keep the else clause for trial runs
3536
#if defined(FBCODE_CAFFE2) || defined(C10_MOBILE)
3637
static std::atomic<bool> executor_mode{true};
3738
static std::atomic<bool> profiling_mode{false};
3839
#else
3940
static std::atomic<bool> executor_mode{true};
40-
static std::atomic<bool> profiling_mode{true};
41+
static std::atomic<bool> profiling_mode{false};
4142
#endif
4243

4344
static std::atomic<size_t> num_profiled_runs{1};

‎torch/testing/_internal/common_utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def prof_meth_call(*args, **kwargs):
105105
args, remaining = parser.parse_known_args()
106106
if args.ge_config == 'legacy':
107107
GRAPH_EXECUTOR = ProfilingMode.LEGACY
108-
elif args.ge_config == 'simple':
108+
elif args.ge_config == 'profiling':
109+
GRAPH_EXECUTOR = ProfilingMode.PROFILING
110+
else:
109111
GRAPH_EXECUTOR = ProfilingMode.SIMPLE
110112

111113
TEST_BAILOUTS = args.test_bailouts

0 commit comments

Comments
 (0)
Please sign in to comment.