Skip to content

Commit 44ac44b

Browse files
authored
Merge branch 'master' into skyw/fake_quant_per_channel_onnx_export
2 parents b8126e5 + c112e89 commit 44ac44b

File tree

484 files changed

+14154
-7714
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

484 files changed

+14154
-7714
lines changed

.circleci/cimodel/data/pytorch_build_definitions.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import cimodel.lib.conf_tree as conf_tree
77
import cimodel.lib.miniutils as miniutils
88
from cimodel.data.pytorch_build_data import CONFIG_TREE_DATA, TopLevelNode
9-
from cimodel.data.simple.util.branch_filters import gen_filter_dict
9+
from cimodel.data.simple.util.branch_filters import gen_filter_dict, RC_PATTERN
1010
from cimodel.data.simple.util.docker_constants import gen_docker_image
1111

1212

@@ -110,6 +110,8 @@ def gen_workflow_params(self, phase):
110110
parameters["resource_class"] = resource_class
111111
if phase == "build" and self.rocm_version is not None:
112112
parameters["resource_class"] = "xlarge"
113+
if hasattr(self, 'filters'):
114+
parameters['filters'] = self.filters
113115
return parameters
114116

115117
def gen_workflow_job(self, phase):
@@ -139,14 +141,16 @@ def gen_workflow_job(self, phase):
139141

140142
# TODO This is a hack to special case some configs just for the workflow list
141143
class HiddenConf(object):
142-
def __init__(self, name, parent_build=None):
144+
def __init__(self, name, parent_build=None, filters=None):
143145
self.name = name
144146
self.parent_build = parent_build
147+
self.filters = filters
145148

146149
def gen_workflow_job(self, phase):
147150
return {
148151
self.gen_build_name(phase): {
149-
"requires": [self.parent_build.gen_build_name("build")]
152+
"requires": [self.parent_build.gen_build_name("build")],
153+
"filters": self.filters,
150154
}
151155
}
152156

@@ -166,7 +170,8 @@ def gen_workflow_job(self, phase):
166170
"branch": self.branch,
167171
"requires": [self.parent_build],
168172
"context": "org-member",
169-
"filters": gen_filter_dict(branches_list=["nightly"])
173+
"filters": gen_filter_dict(branches_list=["nightly"],
174+
tags_list=RC_PATTERN)
170175
}
171176
}
172177

@@ -205,7 +210,9 @@ def gen_docs_configs(xenial_parent_config):
205210
configs.append(
206211
HiddenConf(
207212
"pytorch_python_doc_build",
208-
parent_build=xenial_parent_config
213+
parent_build=xenial_parent_config,
214+
filters=gen_filter_dict(branches_list=r"/.*/",
215+
tags_list=RC_PATTERN),
209216
)
210217
)
211218
configs.append(
@@ -219,7 +226,9 @@ def gen_docs_configs(xenial_parent_config):
219226
configs.append(
220227
HiddenConf(
221228
"pytorch_cpp_doc_build",
222-
parent_build=xenial_parent_config
229+
parent_build=xenial_parent_config,
230+
filters=gen_filter_dict(branches_list=r"/.*/",
231+
tags_list=RC_PATTERN),
223232
)
224233
)
225234
configs.append(
@@ -348,6 +357,8 @@ def instantiate_configs():
348357

349358
# run docs builds on "pytorch-linux-xenial-py3.6-gcc5.4". Docs builds
350359
# should run on a CPU-only build that runs on all PRs.
360+
# XXX should this be updated to a more modern build? Projects are
361+
# beginning to drop python3.6
351362
if (
352363
distro_name == "xenial"
353364
and fc.find_prop("pyver") == "3.6"
@@ -358,6 +369,8 @@ def instantiate_configs():
358369
and compiler_name == "gcc"
359370
and fc.find_prop("compiler_version") == "5.4"
360371
):
372+
c.filters = gen_filter_dict(branches_list=r"/.*/",
373+
tags_list=RC_PATTERN)
361374
c.dependent_tests = gen_docs_configs(c)
362375

363376
if cuda_version == "10.2" and python_version == "3.6" and not is_libtorch:

.circleci/cimodel/data/simple/docker_definitions.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from collections import OrderedDict
22

33
from cimodel.lib.miniutils import quote
4+
from cimodel.data.simple.util.branch_filters import gen_filter_dict, RC_PATTERN
45

56

67
# TODO: make this generated from a matrix rather than just a static list
@@ -24,7 +25,7 @@
2425
"pytorch-linux-xenial-py3.8",
2526
"pytorch-linux-xenial-py3.6-clang7",
2627
"pytorch-linux-xenial-py3.6-gcc4.8",
27-
"pytorch-linux-xenial-py3.6-gcc5.4",
28+
"pytorch-linux-xenial-py3.6-gcc5.4", # this one is used in doc builds
2829
"pytorch-linux-xenial-py3.6-gcc7.2",
2930
"pytorch-linux-xenial-py3.6-gcc7",
3031
"pytorch-linux-bionic-rocm3.7-py3.6",
@@ -34,16 +35,20 @@
3435

3536
def get_workflow_jobs():
3637
"""Generates a list of docker image build definitions"""
37-
return [
38-
OrderedDict(
38+
ret = []
39+
for image_name in IMAGE_NAMES:
40+
parameters = OrderedDict({
41+
"name": quote(f"docker-{image_name}"),
42+
"image_name": quote(image_name),
43+
})
44+
if image_name == "pytorch-linux-xenial-py3.6-gcc5.4":
45+
# pushing documentation on tags requires CircleCI to also
46+
# build all the dependencies on tags, including this docker image
47+
parameters['filters'] = gen_filter_dict(branches_list=r"/.*/",
48+
tags_list=RC_PATTERN)
49+
ret.append(OrderedDict(
3950
{
40-
"docker_build_job": OrderedDict(
41-
{
42-
"name": quote(f"docker-{image_name}"),
43-
"image_name": quote(image_name),
44-
}
45-
)
51+
"docker_build_job": parameters
4652
}
47-
)
48-
for image_name in IMAGE_NAMES
49-
]
53+
))
54+
return ret

.circleci/config.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ jobs:
640640
export CIRCLE_SHA1="$CIRCLE_SHA1"
641641
export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-}"
642642
export CIRCLE_BRANCH="$CIRCLE_BRANCH"
643+
export CIRCLE_JOB="$CIRCLE_JOB"
643644
cd workspace
644645
python test/print_test_stats.py test
645646
EOL
@@ -1187,10 +1188,13 @@ jobs:
11871188
set -ex
11881189
export COMMIT_DOCKER_IMAGE=${DOCKER_IMAGE}:${DOCKER_TAG}-${CIRCLE_SHA1}
11891190
echo "DOCKER_IMAGE: "${COMMIT_DOCKER_IMAGE}
1191+
tag=${CIRCLE_TAG:1:5}
1192+
target=${tag:-master}
1193+
echo "building for ${target}"
11901194
time docker pull ${COMMIT_DOCKER_IMAGE} >/dev/null
11911195
export id=$(docker run --env-file "${BASH_ENV}" --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -t -d -w /var/lib/jenkins ${COMMIT_DOCKER_IMAGE})
11921196
1193-
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && . ./.circleci/scripts/python_doc_push_script.sh docs/master master site") | docker exec -u jenkins -i "$id" bash) 2>&1'
1197+
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && . ./.circleci/scripts/python_doc_push_script.sh docs/'$target' master site") | docker exec -u jenkins -i "$id" bash) 2>&1'
11941198
11951199
echo ${COMMAND} > ./command.sh && unbuffer bash ./command.sh | ts
11961200
@@ -1229,10 +1233,13 @@ jobs:
12291233
set -ex
12301234
export COMMIT_DOCKER_IMAGE=${DOCKER_IMAGE}:${DOCKER_TAG}-${CIRCLE_SHA1}
12311235
echo "DOCKER_IMAGE: "${COMMIT_DOCKER_IMAGE}
1236+
tag=${CIRCLE_TAG:1:5}
1237+
target=${tag:-master}
1238+
echo "building for ${target}"
12321239
time docker pull ${COMMIT_DOCKER_IMAGE} >/dev/null
12331240
export id=$(docker run --env-file "${BASH_ENV}" --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -t -d -w /var/lib/jenkins ${COMMIT_DOCKER_IMAGE})
12341241
1235-
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && . ./.circleci/scripts/cpp_doc_push_script.sh docs/master master") | docker exec -u jenkins -i "$id" bash) 2>&1'
1242+
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && . ./.circleci/scripts/cpp_doc_push_script.sh docs/"$target" master") | docker exec -u jenkins -i "$id" bash) 2>&1'
12361243
12371244
echo ${COMMAND} > ./command.sh && unbuffer bash ./command.sh | ts
12381245
@@ -6431,6 +6438,11 @@ workflows:
64316438
- docker_build_job:
64326439
name: "docker-pytorch-linux-xenial-py3.6-gcc5.4"
64336440
image_name: "pytorch-linux-xenial-py3.6-gcc5.4"
6441+
filters:
6442+
branches:
6443+
only: /.*/
6444+
tags:
6445+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
64346446
- docker_build_job:
64356447
name: "docker-pytorch-linux-xenial-py3.6-gcc7.2"
64366448
image_name: "pytorch-linux-xenial-py3.6-gcc7.2"
@@ -6449,14 +6461,29 @@ workflows:
64496461
- "docker-pytorch-linux-xenial-py3.6-gcc5.4"
64506462
build_environment: "pytorch-linux-xenial-py3.6-gcc5.4-build"
64516463
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.6-gcc5.4"
6464+
filters:
6465+
branches:
6466+
only: /.*/
6467+
tags:
6468+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
64526469
- pytorch_linux_test:
64536470
name: pytorch_linux_xenial_py3_6_gcc5_4_test
64546471
requires:
64556472
- pytorch_linux_xenial_py3_6_gcc5_4_build
64566473
build_environment: "pytorch-linux-xenial-py3.6-gcc5.4-test"
64576474
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.6-gcc5.4"
64586475
resource_class: large
6476+
filters:
6477+
branches:
6478+
only: /.*/
6479+
tags:
6480+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
64596481
- pytorch_python_doc_build:
6482+
filters:
6483+
branches:
6484+
only: /.*/
6485+
tags:
6486+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
64606487
requires:
64616488
- pytorch_linux_xenial_py3_6_gcc5_4_build
64626489
- pytorch_doc_push:
@@ -6466,10 +6493,17 @@ workflows:
64666493
branches:
64676494
only:
64686495
- nightly
6496+
tags:
6497+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
64696498
name: pytorch_python_doc_push
64706499
requires:
64716500
- pytorch_python_doc_build
64726501
- pytorch_cpp_doc_build:
6502+
filters:
6503+
branches:
6504+
only: /.*/
6505+
tags:
6506+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
64736507
requires:
64746508
- pytorch_linux_xenial_py3_6_gcc5_4_build
64756509
- pytorch_doc_push:
@@ -6479,6 +6513,8 @@ workflows:
64796513
branches:
64806514
only:
64816515
- nightly
6516+
tags:
6517+
only: /v[0-9]+(\.[0-9]+)*-rc[0-9]+/
64826518
name: pytorch_cpp_doc_push
64836519
requires:
64846520
- pytorch_cpp_doc_build

.circleci/verbatim-sources/job-specs/job-specs-custom.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@
4343
set -ex
4444
export COMMIT_DOCKER_IMAGE=${DOCKER_IMAGE}:${DOCKER_TAG}-${CIRCLE_SHA1}
4545
echo "DOCKER_IMAGE: "${COMMIT_DOCKER_IMAGE}
46+
tag=${CIRCLE_TAG:1:5}
47+
target=${tag:-master}
48+
echo "building for ${target}"
4649
time docker pull ${COMMIT_DOCKER_IMAGE} >/dev/null
4750
export id=$(docker run --env-file "${BASH_ENV}" --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -t -d -w /var/lib/jenkins ${COMMIT_DOCKER_IMAGE})
4851
49-
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && . ./.circleci/scripts/python_doc_push_script.sh docs/master master site") | docker exec -u jenkins -i "$id" bash) 2>&1'
52+
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && . ./.circleci/scripts/python_doc_push_script.sh docs/'$target' master site") | docker exec -u jenkins -i "$id" bash) 2>&1'
5053
5154
echo ${COMMAND} > ./command.sh && unbuffer bash ./command.sh | ts
5255
@@ -85,10 +88,13 @@
8588
set -ex
8689
export COMMIT_DOCKER_IMAGE=${DOCKER_IMAGE}:${DOCKER_TAG}-${CIRCLE_SHA1}
8790
echo "DOCKER_IMAGE: "${COMMIT_DOCKER_IMAGE}
91+
tag=${CIRCLE_TAG:1:5}
92+
target=${tag:-master}
93+
echo "building for ${target}"
8894
time docker pull ${COMMIT_DOCKER_IMAGE} >/dev/null
8995
export id=$(docker run --env-file "${BASH_ENV}" --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -t -d -w /var/lib/jenkins ${COMMIT_DOCKER_IMAGE})
9096
91-
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && . ./.circleci/scripts/cpp_doc_push_script.sh docs/master master") | docker exec -u jenkins -i "$id" bash) 2>&1'
97+
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && . ./.circleci/scripts/cpp_doc_push_script.sh docs/"$target" master") | docker exec -u jenkins -i "$id" bash) 2>&1'
9298
9399
echo ${COMMAND} > ./command.sh && unbuffer bash ./command.sh | ts
94100

.circleci/verbatim-sources/job-specs/pytorch-job-specs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ jobs:
206206
export CIRCLE_SHA1="$CIRCLE_SHA1"
207207
export CIRCLE_PR_NUMBER="${CIRCLE_PR_NUMBER:-}"
208208
export CIRCLE_BRANCH="$CIRCLE_BRANCH"
209+
export CIRCLE_JOB="$CIRCLE_JOB"
209210
cd workspace
210211
python test/print_test_stats.py test
211212
EOL

.jenkins/pytorch/test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,8 @@ test_benchmarks() {
338338
pip_install --user "requests"
339339
BENCHMARK_DATA="benchmarks/.data"
340340
mkdir -p ${BENCHMARK_DATA}
341+
pytest benchmarks/fastrnns/test_bench.py --benchmark-sort=Name --benchmark-json=${BENCHMARK_DATA}/fastrnns_default.json --fuser=default --executor=default
342+
python benchmarks/upload_scribe.py --pytest_bench_json ${BENCHMARK_DATA}/fastrnns_default.json
341343
pytest benchmarks/fastrnns/test_bench.py --benchmark-sort=Name --benchmark-json=${BENCHMARK_DATA}/fastrnns_legacy_old.json --fuser=old --executor=legacy
342344
python benchmarks/upload_scribe.py --pytest_bench_json ${BENCHMARK_DATA}/fastrnns_legacy_old.json
343345
pytest benchmarks/fastrnns/test_bench.py --benchmark-sort=Name --benchmark-json=${BENCHMARK_DATA}/fastrnns_profiling_te.json --fuser=te --executor=profiling

.jenkins/pytorch/win-test-helpers/installation-helpers/install_miniconda3.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,11 @@ call %CONDA_PARENT_DIR%\Miniconda3\Scripts\activate.bat %CONDA_PARENT_DIR%\Minic
1212
if "%REBUILD%"=="" (
1313
call conda install -y -q python=%PYTHON_VERSION% numpy cffi pyyaml boto3
1414
call conda install -y -q -c conda-forge cmake
15+
call conda install -y -q -c rdonnelly libuv
1516
)
17+
18+
:: Get installed libuv path
19+
@echo off
20+
set libuv_ROOT=%CONDA_PARENT_DIR%\Miniconda3\Library
21+
@echo on
22+
echo libuv_ROOT=%libuv_ROOT%

BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ cc_library(
5555
"c10/cuda/*.h",
5656
"c10/cuda/impl/*.h",
5757
"c10/macros/*.h",
58+
"c10/mobile/*.h",
5859
"c10/util/*.h",
5960
"c10/util/*.hpp",
6061
]),
@@ -71,6 +72,7 @@ cc_library(
7172
srcs = glob([
7273
"c10/core/*.cpp",
7374
"c10/core/impl/*.cpp",
75+
"c10/mobile/*.cpp",
7476
"c10/util/*.cpp",
7577
]) + if_cuda(
7678
glob([

CMakeLists.txt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ endif()
103103

104104
# For non-supported platforms, turn USE_DISTRIBUTED off by default.
105105
# It is not tested and likely won't work without additional changes.
106-
if(NOT LINUX)
106+
if(NOT LINUX AND NOT WIN32)
107107
set(USE_DISTRIBUTED OFF CACHE STRING "Use distributed")
108108
# On macOS, if USE_DISTRIBUTED is enabled (specified by the user),
109109
# then make Gloo build with the libuv transport.
@@ -226,6 +226,12 @@ option(USE_TBB "Use TBB" OFF)
226226
option(ONNX_ML "Enable traditional ONNX ML API." ON)
227227
option(HAVE_SOVERSION "Whether to add SOVERSION to the shared objects" OFF)
228228

229+
# Since TensorPipe does not support Windows, set it to OFF when WIN32 detected
230+
if(WIN32)
231+
set(USE_TENSORPIPE OFF)
232+
message(WARNING "TensorPipe cannot be used on Windows. Set it to OFF")
233+
endif()
234+
229235
# Linux distributions do not want too many embedded sources, in that sense we
230236
# need to be able to build pytorch with an (almost) empty third_party
231237
# directory.
@@ -286,6 +292,12 @@ if(LINUX)
286292
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed")
287293
endif()
288294

295+
if(WIN32 AND USE_DISTRIBUTED)
296+
if(NOT DEFINED ENV{libuv_ROOT})
297+
set(ENV{libuv_ROOT} $ENV{CONDA_PREFIX}\\Library)
298+
endif()
299+
endif()
300+
289301
if(MSVC)
290302
foreach(flag_var
291303
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# For reference:
99
# https://docs.docker.com/develop/develop-images/build_enhancements/
1010
ARG BASE_IMAGE=ubuntu:18.04
11-
ARG PYTHON_VERSION=3.7
11+
ARG PYTHON_VERSION=3.8
1212

1313
FROM ${BASE_IMAGE} as dev-base
1414
RUN --mount=type=cache,id=apt-dev,target=/var/cache/apt \
@@ -52,6 +52,7 @@ FROM conda as conda-installs
5252
ARG INSTALL_CHANNEL=pytorch-nightly
5353
RUN /opt/conda/bin/conda install -c "${INSTALL_CHANNEL}" -y pytorch torchvision cudatoolkit=11.0.221 && \
5454
/opt/conda/bin/conda clean -ya
55+
RUN /opt/conda/bin/pip install torchelastic
5556

5657
FROM ${BASE_IMAGE} as official
5758
LABEL com.nvidia.volumes.needed="nvidia_driver"

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,13 @@ On MacOS
184184
conda install pkg-config libuv
185185
```
186186

187+
On Windows
188+
```bash
189+
# Add these packages if torch.distributed is needed.
190+
# Distributed package support on Windows is a prototype feature and is subject to changes.
191+
conda install -c conda-forge libuv=1.39
192+
```
193+
187194
#### Get the PyTorch Source
188195
```bash
189196
git clone --recursive https://github.com/pytorch/pytorch

0 commit comments

Comments
 (0)