Skip to content

Commit

Permalink
Update on "[jit][tensorexpr] Added aten::batch_norm into fuser when i…
Browse files Browse the repository at this point in the history
…n inference mode"

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

[ghstack-poisoned]
  • Loading branch information
huiguoo committed Mar 23, 2021
2 parents 7b445fd + a6382dd commit 80161bf
Show file tree
Hide file tree
Showing 216 changed files with 2,511 additions and 1,830 deletions.
2 changes: 0 additions & 2 deletions .circleci/cimodel/data/simple/docker_definitions.py
Expand Up @@ -10,8 +10,6 @@
"pytorch-linux-bionic-py3.6-clang9",
"pytorch-linux-bionic-cuda10.2-cudnn7-py3.6-clang9",
"pytorch-linux-bionic-py3.8-gcc9",
"pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4",
"pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7",
"pytorch-linux-xenial-cuda10-cudnn7-py3-gcc7",
"pytorch-linux-xenial-cuda10.1-cudnn7-py3-gcc7",
"pytorch-linux-xenial-cuda10.2-cudnn7-py3-gcc7",
Expand Down
91 changes: 7 additions & 84 deletions .circleci/config.yml
Expand Up @@ -472,7 +472,7 @@ jobs:
docker cp /home/circleci/project/. $id:/var/lib/jenkins/workspace
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && .jenkins/pytorch/build.sh && find ${BUILD_ROOT} -type f -name "*.a" -or -name "*.o" -delete") | docker exec -u jenkins -i "$id" bash) 2>&1'
export COMMAND='((echo "sudo chown -R jenkins workspace && export CIRCLE_JOB="$CIRCLE_JOB" && cd workspace && .jenkins/pytorch/build.sh && find ${BUILD_ROOT} -type f -name "*.a" -or -name "*.o" -delete") | docker exec -u jenkins -i "$id" bash) 2>&1'
echo ${COMMAND} > ./command.sh && unbuffer bash ./command.sh | ts
Expand Down Expand Up @@ -603,6 +603,7 @@ jobs:
# =================== The following code will be executed inside Docker container ===================
set -ex
export SCRIBE_GRAPHQL_ACCESS_TOKEN="${SCRIBE_GRAPHQL_ACCESS_TOKEN}"
export CIRCLE_JOB="$CIRCLE_JOB"
${PARALLEL_FLAGS}
cd workspace
EOL
Expand Down Expand Up @@ -696,6 +697,11 @@ jobs:
executor: <<parameters.executor>>
steps:
- checkout
- run:
name: _HACK_ Install CUDA compatible cmath
no_output_timeout: 1m
command: |
powershell .circleci/scripts/vs_install_cmath.ps1
- run:
name: Install Cuda
no_output_timeout: 30m
Expand Down Expand Up @@ -6729,12 +6735,6 @@ workflows:
- docker_build_job:
name: "docker-pytorch-linux-bionic-py3.8-gcc9"
image_name: "pytorch-linux-bionic-py3.8-gcc9"
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda10-cudnn7-py3-gcc7"
image_name: "pytorch-linux-xenial-cuda10-cudnn7-py3-gcc7"
Expand Down Expand Up @@ -9143,32 +9143,6 @@ workflows:
vc_product: Community
vc_version: ""
vc_year: "2019"
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
- pytorch_linux_build:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build
requires:
- "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7-build"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
- pytorch_linux_test:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_test
requires:
- pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7-test"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- pytorch_linux_build:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc5_4_build
requires:
- "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4-build"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"

# The following allows these jobs to run on ci-all and release branches
debuggable-scheduled-ci:
Expand Down Expand Up @@ -9266,57 +9240,6 @@ workflows:
only:
- /ci-all\/.*/
- /release\/.*/
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
- pytorch_linux_build:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build
requires:
- "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7-build"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
- pytorch_linux_test:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_test
requires:
- pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7-test"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
- pytorch_linux_build:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc5_4_build
requires:
- "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4-build"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
ecr_gc:
triggers:
- schedule:
Expand Down
18 changes: 0 additions & 18 deletions .circleci/docker/build.sh
Expand Up @@ -101,24 +101,6 @@ case "$image" in
DB=yes
VISION=yes
;;
pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4)
CUDA_VERSION=9.2
CUDNN_VERSION=7
ANACONDA_PYTHON_VERSION=3.6
GCC_VERSION=5
PROTOBUF=yes
DB=yes
VISION=yes
;;
pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7)
CUDA_VERSION=9.2
CUDNN_VERSION=7
ANACONDA_PYTHON_VERSION=3.6
GCC_VERSION=7
PROTOBUF=yes
DB=yes
VISION=yes
;;
pytorch-linux-xenial-cuda10-cudnn7-py3-gcc7)
CUDA_VERSION=10.0
CUDNN_VERSION=7
Expand Down
5 changes: 2 additions & 3 deletions .circleci/docker/common/install_conda.sh
Expand Up @@ -80,9 +80,8 @@ if [ -n "$ANACONDA_PYTHON_VERSION" ]; then
else
conda_install numpy=1.18.5 pyyaml mkl mkl-include setuptools cffi future six dataclasses typing_extensions
fi
if [[ "$CUDA_VERSION" == 9.2* ]]; then
conda_install magma-cuda92 -c pytorch
elif [[ "$CUDA_VERSION" == 10.0* ]]; then

if [[ "$CUDA_VERSION" == 10.0* ]]; then
conda_install magma-cuda100 -c pytorch
elif [[ "$CUDA_VERSION" == 10.1* ]]; then
conda_install magma-cuda101 -c pytorch
Expand Down
2 changes: 1 addition & 1 deletion .circleci/docker/common/install_rocm.sh
Expand Up @@ -9,7 +9,7 @@ install_magma() {
cp make.inc-examples/make.inc.hip-mkl-gcc make.inc
echo 'LIBDIR += -L$(MKLROOT)/lib' >> make.inc
echo 'LIB += -Wl,--enable-new-dtags -Wl,--rpath,/opt/rocm/lib -Wl,--rpath,$(MKLROOT)/lib -Wl,--rpath,/opt/rocm/magma/lib' >> make.inc
echo 'DEVCCFLAGS += --amdgpu-target=gfx803 --amdgpu-target=gfx900 --amdgpu-target=gfx906 --amdgpu-target=gfx908' >> make.inc
echo 'DEVCCFLAGS += --amdgpu-target=gfx803 --amdgpu-target=gfx900 --amdgpu-target=gfx906 --amdgpu-target=gfx908 --gpu-max-threads-per-block=256' >> make.inc
export PATH="${PATH}:/opt/rocm/bin"
make -f make.gen.hipMAGMA -j $(nproc)
make lib/libmagma.so -j $(nproc) MKLROOT=/opt/conda
Expand Down
13 changes: 10 additions & 3 deletions .circleci/regenerate.sh
@@ -1,10 +1,17 @@
#!/bin/bash -xe
#!/bin/bash -e

# Allows this script to be invoked from any directory:
cd "$(dirname "$0")"

OLD_FILE=$(mktemp)
cp config.yml "$OLD_FILE"
UNCOMMIT_CHANGE=$(git status -s | grep -c " config.yml")
if [[ $UNCOMMIT_CHANGE != 0 ]]; then
OLD_FILE=$(mktemp)
cp config.yml "$OLD_FILE"
echo "Uncommitted change detected in .circleci/config.yml"
echo "It has been backed up to $OLD_FILE"
fi

NEW_FILE=$(mktemp)
./generate_config_yml.py > "$NEW_FILE"
cp "$NEW_FILE" config.yml
echo "New config generated in .circleci/config.yml"
5 changes: 5 additions & 0 deletions .circleci/scripts/vs_install_cmath.ps1
@@ -0,0 +1,5 @@
$CMATH_DOWNLOAD_LINK = "https://raw.githubusercontent.com/microsoft/STL/12c684bba78f9b032050526abdebf14f58ca26a3/stl/inc/cmath"
$VC14_28_INSTALL_PATH="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include"

curl.exe --retry 3 -kL $CMATH_DOWNLOAD_LINK --output "$home\cmath"
Move-Item -Path "$home\cmath" -Destination "$VC14_28_INSTALL_PATH" -Force
8 changes: 7 additions & 1 deletion .circleci/verbatim-sources/job-specs/pytorch-job-specs.yml
Expand Up @@ -34,7 +34,7 @@ jobs:
docker cp /home/circleci/project/. $id:/var/lib/jenkins/workspace
export COMMAND='((echo "sudo chown -R jenkins workspace && cd workspace && .jenkins/pytorch/build.sh && find ${BUILD_ROOT} -type f -name "*.a" -or -name "*.o" -delete") | docker exec -u jenkins -i "$id" bash) 2>&1'
export COMMAND='((echo "sudo chown -R jenkins workspace && export CIRCLE_JOB="$CIRCLE_JOB" && cd workspace && .jenkins/pytorch/build.sh && find ${BUILD_ROOT} -type f -name "*.a" -or -name "*.o" -delete") | docker exec -u jenkins -i "$id" bash) 2>&1'
echo ${COMMAND} > ./command.sh && unbuffer bash ./command.sh | ts
Expand Down Expand Up @@ -165,6 +165,7 @@ jobs:
# =================== The following code will be executed inside Docker container ===================
set -ex
export SCRIBE_GRAPHQL_ACCESS_TOKEN="${SCRIBE_GRAPHQL_ACCESS_TOKEN}"
export CIRCLE_JOB="$CIRCLE_JOB"
${PARALLEL_FLAGS}
cd workspace
EOL
Expand Down Expand Up @@ -258,6 +259,11 @@ jobs:
executor: <<parameters.executor>>
steps:
- checkout
- run:
name: _HACK_ Install CUDA compatible cmath
no_output_timeout: 1m
command: |
powershell .circleci/scripts/vs_install_cmath.ps1
- run:
name: Install Cuda
no_output_timeout: 30m
Expand Down
77 changes: 0 additions & 77 deletions .circleci/verbatim-sources/workflows/workflows-scheduled-ci.yml
Expand Up @@ -66,32 +66,6 @@
vc_product: Community
vc_version: ""
vc_year: "2019"
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
- pytorch_linux_build:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build
requires:
- "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7-build"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
- pytorch_linux_test:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_test
requires:
- pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7-test"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
- pytorch_linux_build:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc5_4_build
requires:
- "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4-build"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"

# The following allows these jobs to run on ci-all and release branches
debuggable-scheduled-ci:
Expand Down Expand Up @@ -189,54 +163,3 @@
only:
- /ci-all\/.*/
- /release\/.*/
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
- docker_build_job:
name: "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
image_name: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
- pytorch_linux_build:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build
requires:
- "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7-build"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
- pytorch_linux_test:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_test
requires:
- pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc7_build
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7-test"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc7"
use_cuda_docker_runtime: "1"
resource_class: gpu.medium
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
- pytorch_linux_build:
name: pytorch_linux_xenial_cuda9_2_cudnn7_py3_gcc5_4_build
requires:
- "docker-pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
build_environment: "pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4-build"
docker_image: "308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4"
filters:
branches:
only:
- /ci-all\/.*/
- /release\/.*/
6 changes: 3 additions & 3 deletions .gitmodules
Expand Up @@ -54,7 +54,7 @@
ignore = dirty
path = third_party/zstd
url = https://github.com/facebook/zstd.git
[submodule "third-party/cpuinfo"]
[submodule "third_party/cpuinfo"]
ignore = dirty
path = third_party/cpuinfo
url = https://github.com/pytorch/cpuinfo.git
Expand Down Expand Up @@ -131,5 +131,5 @@
path = third_party/tensorpipe
url = https://github.com/pytorch/tensorpipe.git
[submodule "third_party/kineto"]
path = third_party/kineto
url = https://github.com/pytorch/kineto
path = third_party/kineto
url = https://github.com/pytorch/kineto
1 change: 0 additions & 1 deletion .jenkins/pytorch/build-asan.sh
Expand Up @@ -37,7 +37,6 @@ CC="clang" CXX="clang++" LDSHARED="clang --shared" \
USE_ASAN=1 USE_CUDA=0 USE_MKLDNN=0 \
python setup.py install


# Test building via the sdist source tarball
python setup.py sdist
mkdir -p /tmp/tmp
Expand Down
8 changes: 7 additions & 1 deletion .jenkins/pytorch/build.sh
Expand Up @@ -206,7 +206,7 @@ else
# ppc64le build fails when WERROR=1
# set only when building other architectures
# only use for "python setup.py install" line
if [[ "$BUILD_ENVIRONMENT" != *ppc64le* && "$BUILD_ENVIRONMENT" != *clang* ]]; then
if [[ "$BUILD_ENVIRONMENT" != *ppc64le* && "$BUILD_ENVIRONMENT" != *clang* ]]; then
WERROR=1 python setup.py bdist_wheel
python -mpip install dist/*.whl
else
Expand Down Expand Up @@ -319,3 +319,9 @@ if [[ "${BUILD_ENVIRONMENT}" == *xla* ]]; then
popd
assert_git_not_dirty
fi

if [[ "$BUILD_ENVIRONMENT" != *libtorch* && "$BUILD_ENVIRONMENT" != *bazel* ]]; then
# export test times so that potential sharded tests that'll branch off this build will use consistent data
# don't do this for libtorch as libtorch is C++ only and thus won't have python tests run on its build
python test/run_test.py --export-past-test-times
fi
4 changes: 0 additions & 4 deletions .jenkins/pytorch/test.sh
Expand Up @@ -435,10 +435,6 @@ elif [[ "${BUILD_ENVIRONMENT}" == *vulkan-linux* ]]; then
test_vulkan
elif [[ "${BUILD_ENVIRONMENT}" == *-bazel-* ]]; then
test_bazel
elif [[ "${BUILD_ENVIRONMENT}" == pytorch-linux-xenial-cuda9.2-cudnn7-py3-gcc5.4* ]]; then
# test cpp extension for xenial + cuda 9.2 + gcc 5.4 to make sure
# cpp extension can be built correctly under this old env
test_cpp_extensions
else
install_torchvision
test_python
Expand Down
3 changes: 3 additions & 0 deletions .jenkins/pytorch/win-test-helpers/build_pytorch.bat
Expand Up @@ -117,5 +117,8 @@ python setup.py install --cmake && sccache --show-stats && (
echo NOTE: To run `import torch`, please make sure to activate the conda environment by running `call %CONDA_PARENT_DIR%\Miniconda3\Scripts\activate.bat %CONDA_PARENT_DIR%\Miniconda3` in Command Prompt before running Git Bash.
) else (
7z a %TMP_DIR_WIN%\%IMAGE_COMMIT_TAG%.7z %CONDA_PARENT_DIR%\Miniconda3\Lib\site-packages\torch %CONDA_PARENT_DIR%\Miniconda3\Lib\site-packages\caffe2 && copy /Y "%TMP_DIR_WIN%\%IMAGE_COMMIT_TAG%.7z" "%PYTORCH_FINAL_PACKAGE_DIR%\"

:: export test times so that potential sharded tests that'll branch off this build will use consistent data
python test/run_test.py --export-past-test-times %PYTORCH_FINAL_PACKAGE_DIR%/.pytorch-test-times
)
)

0 comments on commit 80161bf

Please sign in to comment.