Skip to content

Conversation

@ezyang
Copy link
Contributor

@ezyang ezyang commented Aug 3, 2021

Stack from ghstack:

Modeled off of torch_dispatch, this PR demonstrates how to register
Python functions directly to the dispatcher. Unlike torch_dispatch,
this makes it possible to directly override preexisting implementations
of PyTorch operators with alternate implementations, functionality that
maybe of interest to IPEX or Triton.

This is not a complete PR because it doesn't provide a coherent user
facing API for the functionality:

  • We need to design an appropriate Python-side object hierarchy and
    API surface for interacting with the dispatcher. Similarly, we need
    to battle harden the preexisting Python dispatcher API, which was
    previously solely used for testing. Some things that need to be
    improved include file/line number reporting of registrations.

  • For overriding use cases, we need to introduce new alias keys to
    allow for overriding without triggering a warning message that
    overriding is happening.

  • When an override happens, we need a convenient way to call into the
    underlying implementation, in case we have decided we aren't
    interested in overriding the behavior anyway

  • This PR is not compatible with torchdeploy; to handle torchdeploy,
    we must introduce a level of indirection whereby there is a single
    registered kernel for all Python interpreters, but it then determines
    whether or not to fallthrough to the base implementation based on
    whether or not the registration happened from a matching interpreter
    or not

Signed-off-by: Edward Z. Yang ezyang@fb.com

Differential Revision: D30074924

Modeled off of __torch_dispatch__, this PR demonstrates how to register
Python functions directly to the dispatcher.  Unlike __torch_dispatch__,
this makes it possible to directly override preexisting implementations
of PyTorch operators with alternate implementations, functionality that
maybe of interest to IPEX or Triton.

This is not a complete PR because it doesn't provide a coherent user
facing API for the functionality:

- We need to design an appropriate Python-side object hierarchy and
  API surface for interacting with the dispatcher.  Similarly, we need
  to battle harden the preexisting Python dispatcher API, which was
  previously solely used for testing.  Some things that need to be
  improved include file/line number reporting of registrations.

- For overriding use cases, we need to introduce new alias keys to
  allow for overriding without triggering a warning message that
  overriding is happening.

- When an override happens, we need a convenient way to call into the
  underlying implementation, in case we have decided we aren't
  interested in overriding the behavior anyway

- This PR is not compatible with torchdeploy; to handle torchdeploy,
  we must introduce a level of indirection whereby there is a single
  registered kernel for all Python interpreters, but it then determines
  whether or not to fallthrough to the base implementation based on
  whether or not the registration happened from a matching interpreter
  or not

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

[ghstack-poisoned]
ezyang added a commit that referenced this pull request Aug 3, 2021
Modeled off of __torch_dispatch__, this PR demonstrates how to register
Python functions directly to the dispatcher.  Unlike __torch_dispatch__,
this makes it possible to directly override preexisting implementations
of PyTorch operators with alternate implementations, functionality that
maybe of interest to IPEX or Triton.

This is not a complete PR because it doesn't provide a coherent user
facing API for the functionality:

- We need to design an appropriate Python-side object hierarchy and
  API surface for interacting with the dispatcher.  Similarly, we need
  to battle harden the preexisting Python dispatcher API, which was
  previously solely used for testing.  Some things that need to be
  improved include file/line number reporting of registrations.

- For overriding use cases, we need to introduce new alias keys to
  allow for overriding without triggering a warning message that
  overriding is happening.

- When an override happens, we need a convenient way to call into the
  underlying implementation, in case we have decided we aren't
  interested in overriding the behavior anyway

- This PR is not compatible with torchdeploy; to handle torchdeploy,
  we must introduce a level of indirection whereby there is a single
  registered kernel for all Python interpreters, but it then determines
  whether or not to fallthrough to the base implementation based on
  whether or not the registration happened from a matching interpreter
  or not

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

ghstack-source-id: 5d3fac0
Pull Request resolved: #62660
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Aug 3, 2021

🔗 Helpful links

💊 CI failures summary and remediations

As of commit dbd9fd5 (more details on the Dr. CI page):


  • 15/15 failures introduced in this PR

🕵️ 15 new failures recognized by patterns

The following CI failures do not appear to be due to upstream breakages

See GitHub Actions build pull / linux-bionic-py3.7-clang9 / build (1/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:16.0395404Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:16.0392530Z �[36;1mfi�[0m
2022-04-04T18:22:16.0392760Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:16.0393107Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:16.0393436Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:16.0393770Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:16.0394058Z �[36;1m  exit 1�[0m
2022-04-04T18:22:16.0394228Z �[36;1mfi�[0m
2022-04-04T18:22:16.0394448Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:16.0394773Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:16.0395077Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:16.0395404Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:16.0395732Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:16.0395963Z �[36;1m  exit 1�[0m
2022-04-04T18:22:16.0396184Z �[36;1mfi�[0m
2022-04-04T18:22:16.0396375Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:16.0406988Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:16.0407212Z env:
2022-04-04T18:22:16.0407358Z   IN_CI: 1
2022-04-04T18:22:16.0407521Z   IS_GHA: 1
2022-04-04T18:22:16.0407734Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:16.0408114Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-bionic-py3.7-clang9:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / deploy-linux-xenial-cuda11.3-py3.7-gcc7 / build (2/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:24.0601918Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:24.0599055Z �[36;1mfi�[0m
2022-04-04T18:22:24.0599283Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:24.0599629Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:24.0599942Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:24.0600285Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:24.0600564Z �[36;1m  exit 1�[0m
2022-04-04T18:22:24.0600730Z �[36;1mfi�[0m
2022-04-04T18:22:24.0600953Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:24.0601284Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:24.0601588Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:24.0601918Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:24.0602247Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:24.0602560Z �[36;1m  exit 1�[0m
2022-04-04T18:22:24.0602726Z �[36;1mfi�[0m
2022-04-04T18:22:24.0602909Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:24.0614313Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:24.0614534Z env:
2022-04-04T18:22:24.0614679Z   IN_CI: 1
2022-04-04T18:22:24.0614842Z   IS_GHA: 1
2022-04-04T18:22:24.0615051Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:24.0615444Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda11.3-cudnn8-py3-gcc7:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / linux-xenial-py3.7-gcc7 / build (3/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:09.4739503Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:09.4736659Z �[36;1mfi�[0m
2022-04-04T18:22:09.4736887Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:09.4737224Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:09.4737536Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:09.4737877Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:09.4738160Z �[36;1m  exit 1�[0m
2022-04-04T18:22:09.4738325Z �[36;1mfi�[0m
2022-04-04T18:22:09.4738545Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:09.4738873Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:09.4739174Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:09.4739503Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:09.4739832Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:09.4740064Z �[36;1m  exit 1�[0m
2022-04-04T18:22:09.4740294Z �[36;1mfi�[0m
2022-04-04T18:22:09.4740480Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:09.4751716Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:09.4751940Z env:
2022-04-04T18:22:09.4752091Z   IN_CI: 1
2022-04-04T18:22:09.4752251Z   IS_GHA: 1
2022-04-04T18:22:09.4752466Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:09.4752993Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.7-gcc7:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / linux-xenial-cuda11.3-py3.7-gcc7 / build (4/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:16.1604493Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:16.1601660Z �[36;1mfi�[0m
2022-04-04T18:22:16.1601883Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:16.1602222Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:16.1602534Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:16.1602871Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:16.1603146Z �[36;1m  exit 1�[0m
2022-04-04T18:22:16.1603307Z �[36;1mfi�[0m
2022-04-04T18:22:16.1603527Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:16.1603855Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:16.1604163Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:16.1604493Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:16.1604821Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:16.1605108Z �[36;1m  exit 1�[0m
2022-04-04T18:22:16.1605271Z �[36;1mfi�[0m
2022-04-04T18:22:16.1605452Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:16.1616099Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:16.1616316Z env:
2022-04-04T18:22:16.1616460Z   IN_CI: 1
2022-04-04T18:22:16.1616619Z   IS_GHA: 1
2022-04-04T18:22:16.1616831Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:16.1617224Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-cuda11.3-cudnn8-py3-gcc7:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / win-vs2019-cuda11.3-py3 / build (5/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:57:21.0761872Z C:\actions-runner\... error C2143: syntax error: missing ';' before '}'
2022-04-04T18:57:21.0753137Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2022-04-04T18:57:21.0753940Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2086: 'int torch::impl::dispatch::m': redefinition
2022-04-04T18:57:21.0754895Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(208): note: see declaration of 'torch::impl::dispatch::m'
2022-04-04T18:57:21.0755799Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2146: syntax error: missing ';' before identifier 'def'
2022-04-04T18:57:21.0756675Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2143: syntax error: missing ';' before '{'
2022-04-04T18:57:21.0757547Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2143: syntax error: missing ')' before ';'
2022-04-04T18:57:21.0758585Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2447: '{': missing function header (old-style formal list?)
2022-04-04T18:57:21.0759463Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(269): error C2059: syntax error: ','
2022-04-04T18:57:21.0760266Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(269): error C2059: syntax error: ')'
2022-04-04T18:57:21.0761009Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(272): error C2059: syntax error: '}'
2022-04-04T18:57:21.0761872Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(272): error C2143: syntax error: missing ';' before '}'
2022-04-04T18:57:21.0762553Z Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
2022-04-04T18:57:21.0763035Z Copyright (C) Microsoft Corporation.  All rights reserved.
2022-04-04T18:57:21.0763336Z 
2022-04-04T18:57:21.2049100Z [6187/6273] C:\actions-runner\_work\pytorch\pytorch\build\win_tmp\bin\sccache-cl.exe   /TP -DAT_PER_OPERATOR_HEADERS -DBUILDING_TESTS -DBUILD_CAFFE2 -DFMT_HEADER_ONLY=1 -DIDEEP_USE_MKL -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTHP_BUILD_MAIN_LIB -DUSE_C10D -DUSE_C10D_GLOO -DUSE_CUDA -DUSE_CUDNN -DUSE_DISTRIBUTED -DUSE_EXTERNAL_MZCRC -DUSE_NUMPY -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -D_OPENMP_NOFORCE_MANIFEST -Dtorch_python_EXPORTS -IC:\actions-runner\_work\pytorch\pytorch\build\aten\src -IC:\actions-runner\_work\pytorch\pytorch\aten\src -IC:\actions-runner\_work\pytorch\pytorch\build -IC:\actions-runner\_work\pytorch\pytorch -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\benchmark\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\cudnn_frontend\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\third_party\foxi -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\foxi -IC:\actions-runner\_work\pytorch\pytorch\torch\.. -IC:\actions-runner\_work\pytorch\pytorch\torch\..\aten\src -IC:\actions-runner\_work\pytorch\pytorch\torch\..\aten\src\TH -IC:\actions-runner\_work\pytorch\pytorch\build\caffe2\aten\src -IC:\actions-runner\_work\pytorch\pytorch\build\third_party -IC:\actions-runner\_work\pytorch\pytorch\torch\..\third_party\valgrind-headers -IC:\actions-runner\_work\pytorch\pytorch\torch\..\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\torch\..\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\torch\..\third_party\flatbuffers\include -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\api\include -IC:\actions-runner\_work\pytorch\pytorch\torch\lib -IC:\actions-runner\_work\pytorch\pytorch\torch\lib\libshm_windows -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\distributed -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\api -IC:\actions-runner\_work\pytorch\pytorch\c10\.. -IC:\actions-runner\_work\pytorch\pytorch\c10\cuda\..\.. -IC:\actions-runner\_work\pytorch\pytorch\third_party\fmt\include -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\googletest\googlemock\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\googletest\googletest\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\protobuf\src -IC:\actions-runner\_work\pytorch\pytorch\build\win_tmp\mkl\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\XNNPACK\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\eigen -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -IC:\actions-runner\_work\pytorch\pytorch\third_party\ideep\mkl-dnn\third_party\oneDNN\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\ideep\include -IC:\Jenkins\Miniconda3\include -IC:\Jenkins\Miniconda3\lib\site-packages\numpy\core\include -I"C:\Program Files\NVIDIA Corporation\NvToolsExt\include" -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\pybind11\include /DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/actions-runner/_work/pytorch/pytorch/build/win_tmp/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /MD /O2 /Ob2 /DNDEBUG /w /bigobj -DNDEBUG -DCAFFE2_USE_GLOO -DTH_HAVE_THREAD /EHsc /DNOMINMAX /wd4267 /wd4251 /wd4522 /wd4838 /wd4305 /wd4244 /wd4190 /wd4101 /wd4996 /wd4275 /bigobj -std:c++14 /showIncludes /Focaffe2\torch\CMakeFiles\torch_python.dir\csrc\distributed\c10d\init.cpp.obj /Fdcaffe2\torch\CMakeFiles\torch_python.dir\ /FS -c C:\actions-runner\_work\pytorch\pytorch\torch\csrc\distributed\c10d\init.cpp
2022-04-04T18:57:21.2057802Z Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
2022-04-04T18:57:21.2058372Z Copyright (C) Microsoft Corporation.  All rights reserved.
2022-04-04T18:57:21.2058704Z 
2022-04-04T18:57:21.3765936Z [6188/6273] cmd.exe /C "cd . && C:\Jenkins\Miniconda3\Library\bin\cmake.exe -E vs_link_exe --intdir=nvfuser_bench\CMakeFiles\nvfuser_bench.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100190~1.0\x64\mt.exe --manifests  -- C:\PROGRA~2\MICROS~2\2019\BUILDT~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\link.exe  nvfuser_bench\CMakeFiles\nvfuser_bench.dir\batch_norm.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\batch_norm_backward.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\bert.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\broadcast.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\gelu_backward.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\heuristic_lookup.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\shape_inference.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\instance_norm.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\layer_norm.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\layer_norm_backward.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\rms_norm.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\rms_norm_backward.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\lstm_cell.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\reduction.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\softmax.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\softmax_backward.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\scale_bias_relu.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\utils.cpp.obj nvfuser_bench\CMakeFiles\nvfuser_bench.dir\main.cpp.obj  /out:bin\nvfuser_bench.exe /implib:lib\nvfuser_bench.lib /pdb:bin\nvfuser_bench.pdb /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO /subsystem:console  lib\benchmark.lib  lib\torch.lib  lib\torch_cuda.lib  lib\torch_cuda_cu.lib  lib\torch_cuda_cpp.lib  lib\torch_cpu.lib  lib\libprotobuf.lib  win_tmp\mkl\lib\mkl_intel_lp64.lib  win_tmp\mkl\lib\mkl_intel_thread.lib  win_tmp\mkl\lib\mkl_core.lib  win_tmp\mkl\lib\libiomp5md.lib  -INCLUDE:?warp_size@cuda@at@@YAHXZ  lib\c10_cuda.lib  lib\c10.lib  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\lib\x64\cudart_static.lib"  "C:\Program Files\NVIDIA Corporation\NvToolsExt\lib\x64\nvToolsExt64_1.lib"  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\lib\x64\cufft.lib"  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\lib\x64\curand.lib"  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\lib\x64\cublas.lib"  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\lib\x64\cudnn.lib"  -INCLUDE:?_torch_cuda_cu_linker_symbol_op_cuda@native@at@@YA?AVTensor@2@AEBV32@@Z  shlwapi.lib  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
2022-04-04T18:57:21.4368515Z [6189/6273] C:\actions-runner\_work\pytorch\pytorch\build\win_tmp\bin\sccache-cl.exe   /TP -DAT_PER_OPERATOR_HEADERS -DBUILDING_TESTS -DBUILD_CAFFE2 -DFMT_HEADER_ONLY=1 -DIDEEP_USE_MKL -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTHP_BUILD_MAIN_LIB -DUSE_C10D -DUSE_C10D_GLOO -DUSE_CUDA -DUSE_CUDNN -DUSE_DISTRIBUTED -DUSE_EXTERNAL_MZCRC -DUSE_NUMPY -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -D_OPENMP_NOFORCE_MANIFEST -Dtorch_python_EXPORTS -IC:\actions-runner\_work\pytorch\pytorch\build\aten\src -IC:\actions-runner\_work\pytorch\pytorch\aten\src -IC:\actions-runner\_work\pytorch\pytorch\build -IC:\actions-runner\_work\pytorch\pytorch -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\benchmark\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\cudnn_frontend\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\third_party\foxi -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\foxi -IC:\actions-runner\_work\pytorch\pytorch\torch\.. -IC:\actions-runner\_work\pytorch\pytorch\torch\..\aten\src -IC:\actions-runner\_work\pytorch\pytorch\torch\..\aten\src\TH -IC:\actions-runner\_work\pytorch\pytorch\build\caffe2\aten\src -IC:\actions-runner\_work\pytorch\pytorch\build\third_party -IC:\actions-runner\_work\pytorch\pytorch\torch\..\third_party\valgrind-headers -IC:\actions-runner\_work\pytorch\pytorch\torch\..\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\torch\..\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\torch\..\third_party\flatbuffers\include -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\api\include -IC:\actions-runner\_work\pytorch\pytorch\torch\lib -IC:\actions-runner\_work\pytorch\pytorch\torch\lib\libshm_windows -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\distributed -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\api -IC:\actions-runner\_work\pytorch\pytorch\c10\.. -IC:\actions-runner\_work\pytorch\pytorch\c10\cuda\..\.. -IC:\actions-runner\_work\pytorch\pytorch\third_party\fmt\include -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\googletest\googlemock\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\googletest\googletest\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\protobuf\src -IC:\actions-runner\_work\pytorch\pytorch\build\win_tmp\mkl\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\XNNPACK\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\eigen -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\include" -IC:\actions-runner\_work\pytorch\pytorch\third_party\ideep\mkl-dnn\third_party\oneDNN\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\ideep\include -IC:\Jenkins\Miniconda3\include -IC:\Jenkins\Miniconda3\lib\site-packages\numpy\core\include -I"C:\Program Files\NVIDIA Corporation\NvToolsExt\include" -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\pybind11\include /DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/actions-runner/_work/pytorch/pytorch/build/win_tmp/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /MD /O2 /Ob2 /DNDEBUG /w /bigobj -DNDEBUG -DCAFFE2_USE_GLOO -DTH_HAVE_THREAD /EHsc /DNOMINMAX /wd4267 /wd4251 /wd4522 /wd4838 /wd4305 /wd4244 /wd4190 /wd4101 /wd4996 /wd4275 /bigobj -std:c++14 /showIncludes /Focaffe2\torch\CMakeFiles\torch_python.dir\csrc\Size.cpp.obj /Fdcaffe2\torch\CMakeFiles\torch_python.dir\ /FS -c C:\actions-runner\_work\pytorch\pytorch\torch\csrc\Size.cpp
2022-04-04T18:57:21.4374098Z Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64

See GitHub Actions build pull / linux-bionic-rocm5.0-py3.7 / build (6/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:17.6817621Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:17.6814527Z �[36;1mfi�[0m
2022-04-04T18:22:17.6814865Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:17.6815224Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:17.6815556Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:17.6815914Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:17.6816212Z �[36;1m  exit 1�[0m
2022-04-04T18:22:17.6816384Z �[36;1mfi�[0m
2022-04-04T18:22:17.6816617Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:17.6816961Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:17.6817278Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:17.6817621Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:17.6817966Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:17.6818208Z �[36;1m  exit 1�[0m
2022-04-04T18:22:17.6818441Z �[36;1mfi�[0m
2022-04-04T18:22:17.6818636Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:17.6829194Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:17.6829429Z env:
2022-04-04T18:22:17.6829588Z   IN_CI: 1
2022-04-04T18:22:17.6829742Z   IS_GHA: 1
2022-04-04T18:22:17.6829960Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:17.6830358Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-bionic-rocm5.0-py3.7:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / linux-xenial-py3.7-clang7-onnx / build (7/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:19.9759998Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:19.9757160Z �[36;1mfi�[0m
2022-04-04T18:22:19.9757388Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:19.9757729Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:19.9758037Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:19.9758376Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:19.9758652Z �[36;1m  exit 1�[0m
2022-04-04T18:22:19.9758814Z �[36;1mfi�[0m
2022-04-04T18:22:19.9759035Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:19.9759361Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:19.9759667Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:19.9759998Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:19.9760324Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:19.9760556Z �[36;1m  exit 1�[0m
2022-04-04T18:22:19.9760772Z �[36;1mfi�[0m
2022-04-04T18:22:19.9760957Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:19.9771523Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:19.9771884Z env:
2022-04-04T18:22:19.9772035Z   IN_CI: 1
2022-04-04T18:22:19.9772195Z   IS_GHA: 1
2022-04-04T18:22:19.9772405Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:19.9772778Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3-clang7-onnx:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / linux-xenial-cuda11.3-py3.7-gcc7-bazel-test / build-and-test (8/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:16.7603493Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:16.7600670Z �[36;1mfi�[0m
2022-04-04T18:22:16.7600892Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:16.7601232Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:16.7601541Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:16.7601881Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:16.7602161Z �[36;1m  exit 1�[0m
2022-04-04T18:22:16.7602322Z �[36;1mfi�[0m
2022-04-04T18:22:16.7602541Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:16.7602869Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:16.7603169Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:16.7603493Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:16.7603877Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:16.7604108Z �[36;1m  exit 1�[0m
2022-04-04T18:22:16.7604266Z �[36;1mfi�[0m
2022-04-04T18:22:16.7604448Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:16.7614819Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:16.7615033Z env:
2022-04-04T18:22:16.7615176Z   IN_CI: 1
2022-04-04T18:22:16.7615333Z   IS_GHA: 1
2022-04-04T18:22:16.7615509Z   GIT_DEFAULT_BRANCH: master
2022-04-04T18:22:16.7615720Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212

See GitHub Actions build pull / linux-xenial-py3.7-gcc7-no-ops / build (9/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:15.9637340Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:15.9634528Z �[36;1mfi�[0m
2022-04-04T18:22:15.9634752Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:15.9635089Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:15.9635399Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:15.9635734Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:15.9636011Z �[36;1m  exit 1�[0m
2022-04-04T18:22:15.9636172Z �[36;1mfi�[0m
2022-04-04T18:22:15.9636390Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:15.9636713Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:15.9637011Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:15.9637340Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:15.9637664Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:15.9637891Z �[36;1m  exit 1�[0m
2022-04-04T18:22:15.9638113Z �[36;1mfi�[0m
2022-04-04T18:22:15.9638298Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:15.9649159Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:15.9649376Z env:
2022-04-04T18:22:15.9649517Z   IN_CI: 1
2022-04-04T18:22:15.9649675Z   IS_GHA: 1
2022-04-04T18:22:15.9649878Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:15.9650236Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.7-gcc7:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / linux-xenial-py3.7-gcc5.4 / build (10/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:19.8785532Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:19.8782558Z �[36;1mfi�[0m
2022-04-04T18:22:19.8782798Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:19.8783151Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:19.8783479Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:19.8783839Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:19.8784135Z �[36;1m  exit 1�[0m
2022-04-04T18:22:19.8784305Z �[36;1mfi�[0m
2022-04-04T18:22:19.8784536Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:19.8784883Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:19.8785200Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:19.8785532Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:19.8785887Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:19.8786132Z �[36;1m  exit 1�[0m
2022-04-04T18:22:19.8786359Z �[36;1mfi�[0m
2022-04-04T18:22:19.8786554Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:19.8797012Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:19.8797243Z env:
2022-04-04T18:22:19.8797398Z   IN_CI: 1
2022-04-04T18:22:19.8797562Z   IS_GHA: 1
2022-04-04T18:22:19.8797778Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:19.8798329Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3.7-gcc5.4:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / linux-vulkan-bionic-py3.7-clang9 / build (11/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:17.7325223Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:17.7322054Z �[36;1mfi�[0m
2022-04-04T18:22:17.7322370Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:17.7322721Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:17.7323072Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:17.7323441Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:17.7323749Z �[36;1m  exit 1�[0m
2022-04-04T18:22:17.7323932Z �[36;1mfi�[0m
2022-04-04T18:22:17.7324195Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:17.7324550Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:17.7324880Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:17.7325223Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:17.7325597Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:17.7325856Z �[36;1m  exit 1�[0m
2022-04-04T18:22:17.7326087Z �[36;1mfi�[0m
2022-04-04T18:22:17.7326316Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:17.7337334Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:17.7337571Z env:
2022-04-04T18:22:17.7337760Z   IN_CI: 1
2022-04-04T18:22:17.7337954Z   IS_GHA: 1
2022-04-04T18:22:17.7338182Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:17.7338589Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-bionic-py3.7-clang9:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / linux-xenial-py3.7-clang7-asan / build (12/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:10.5455266Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:10.5452350Z �[36;1mfi�[0m
2022-04-04T18:22:10.5452647Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:10.5452989Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:10.5453299Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:10.5453640Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:10.5453918Z �[36;1m  exit 1�[0m
2022-04-04T18:22:10.5454085Z �[36;1mfi�[0m
2022-04-04T18:22:10.5454304Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:10.5454635Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:10.5454939Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:10.5455266Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:10.5455595Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:10.5455824Z �[36;1m  exit 1�[0m
2022-04-04T18:22:10.5456053Z �[36;1mfi�[0m
2022-04-04T18:22:10.5456237Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:10.5466773Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:10.5466993Z env:
2022-04-04T18:22:10.5467137Z   IN_CI: 1
2022-04-04T18:22:10.5467300Z   IS_GHA: 1
2022-04-04T18:22:10.5467508Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:10.5467879Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/pytorch-linux-xenial-py3-clang7-asan:3c8505af7f950e5107f15c680d2fb85c7eb425ef

See GitHub Actions build pull / win-vs2019-cpu-py3 / build (13/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:40:48.8537841Z C:\actions-runner\... error C2143: syntax error: missing ';' before '}'
2022-04-04T18:40:48.8532943Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
2022-04-04T18:40:48.8533486Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2086: 'int torch::impl::dispatch::m': redefinition
2022-04-04T18:40:48.8533969Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(208): note: see declaration of 'torch::impl::dispatch::m'
2022-04-04T18:40:48.8534487Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2146: syntax error: missing ';' before identifier 'def'
2022-04-04T18:40:48.8534986Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2143: syntax error: missing ';' before '{'
2022-04-04T18:40:48.8535530Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2143: syntax error: missing ')' before ';'
2022-04-04T18:40:48.8536017Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(263): error C2447: '{': missing function header (old-style formal list?)
2022-04-04T18:40:48.8536497Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(269): error C2059: syntax error: ','
2022-04-04T18:40:48.8536946Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(269): error C2059: syntax error: ')'
2022-04-04T18:40:48.8537392Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(272): error C2059: syntax error: '}'
2022-04-04T18:40:48.8537841Z C:\actions-runner\_work\pytorch\pytorch\torch\csrc\utils\python_dispatch.cpp(272): error C2143: syntax error: missing ';' before '}'
2022-04-04T18:40:48.8538229Z Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
2022-04-04T18:40:48.8538534Z Copyright (C) Microsoft Corporation.  All rights reserved.
2022-04-04T18:40:48.8538711Z 
2022-04-04T18:40:49.0780234Z [5707/5834] C:\actions-runner\_work\pytorch\pytorch\build\win_tmp\bin\sccache-cl.exe   /TP -DIDEEP_USE_MKL -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DUSE_C10D_GLOO -DUSE_DISTRIBUTED -DUSE_EXTERNAL_MZCRC -DUSE_GTEST -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -D_OPENMP_NOFORCE_MANIFEST -IC:\actions-runner\_work\pytorch\pytorch\build\aten\src -IC:\actions-runner\_work\pytorch\pytorch\aten\src -IC:\actions-runner\_work\pytorch\pytorch\build -IC:\actions-runner\_work\pytorch\pytorch -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\benchmark\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\third_party\foxi -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\foxi -IC:\actions-runner\_work\pytorch\pytorch\build\caffe2\..\aten\src -IC:\actions-runner\_work\pytorch\pytorch\third_party\flatbuffers\include -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\api -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\api\include -IC:\actions-runner\_work\pytorch\pytorch\c10\.. -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\googletest\googlemock\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\googletest\googletest\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\protobuf\src -IC:\actions-runner\_work\pytorch\pytorch\build\win_tmp\mkl\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\XNNPACK\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\eigen -IC:\actions-runner\_work\pytorch\pytorch\third_party\ideep\mkl-dnn\third_party\oneDNN\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\ideep\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\googletest\googletest\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\googletest\googletest /DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/actions-runner/_work/pytorch/pytorch/build/win_tmp/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /MD /O2 /Ob2 /DNDEBUG /w /bigobj -DNDEBUG -DCAFFE2_USE_GLOO -DTH_HAVE_THREAD /EHsc /DNOMINMAX /wd4267 /wd4251 /wd4522 /wd4838 /wd4305 /wd4244 /wd4190 /wd4101 /wd4996 /wd4275 /bigobj -std:c++14 /showIncludes /Fotest_jit\CMakeFiles\test_jit.dir\test_upgrader_utils.cpp.obj /Fdtest_jit\CMakeFiles\test_jit.dir\ /FS -c C:\actions-runner\_work\pytorch\pytorch\test\cpp\jit\test_upgrader_utils.cpp
2022-04-04T18:40:49.0784516Z Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
2022-04-04T18:40:49.0784822Z Copyright (C) Microsoft Corporation.  All rights reserved.
2022-04-04T18:40:49.0785089Z 
2022-04-04T18:40:49.2543193Z [5708/5834] C:\actions-runner\_work\pytorch\pytorch\build\win_tmp\bin\sccache-cl.exe   /TP -DIDEEP_USE_MKL -DMINIZ_DISABLE_ZIP_READER_CRC32_CHECKS -DONNXIFI_ENABLE_EXT=1 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DUSE_C10D_GLOO -DUSE_DISTRIBUTED -DUSE_EXTERNAL_MZCRC -DUSE_GTEST -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -D_OPENMP_NOFORCE_MANIFEST -IC:\actions-runner\_work\pytorch\pytorch\build\aten\src -IC:\actions-runner\_work\pytorch\pytorch\aten\src -IC:\actions-runner\_work\pytorch\pytorch\build -IC:\actions-runner\_work\pytorch\pytorch -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\benchmark\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\onnx -IC:\actions-runner\_work\pytorch\pytorch\third_party\foxi -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\foxi -IC:\actions-runner\_work\pytorch\pytorch\build\caffe2\..\aten\src -IC:\actions-runner\_work\pytorch\pytorch\third_party\flatbuffers\include -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\api -IC:\actions-runner\_work\pytorch\pytorch\torch\csrc\api\include -IC:\actions-runner\_work\pytorch\pytorch\c10\.. -IC:\actions-runner\_work\pytorch\pytorch\build\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\gloo -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\googletest\googlemock\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\googletest\googletest\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\protobuf\src -IC:\actions-runner\_work\pytorch\pytorch\build\win_tmp\mkl\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\XNNPACK\include -IC:\actions-runner\_work\pytorch\pytorch\cmake\..\third_party\eigen -IC:\actions-runner\_work\pytorch\pytorch\third_party\ideep\mkl-dnn\third_party\oneDNN\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\ideep\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\googletest\googletest\include -IC:\actions-runner\_work\pytorch\pytorch\third_party\googletest\googletest /DWIN32 /D_WINDOWS /GR /EHsc /w /bigobj -DUSE_PTHREADPOOL -openmp:experimental -IC:/actions-runner/_work/pytorch/pytorch/build/win_tmp/mkl/include -DNDEBUG -DUSE_KINETO -DLIBKINETO_NOCUPTI -DUSE_FBGEMM -DUSE_XNNPACK -DSYMBOLICATE_MOBILE_DEBUG_HANDLE -DEDGE_PROFILER_USE_KINETO -DHAVE_AVX512_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /MD /O2 /Ob2 /DNDEBUG /w /bigobj -DNDEBUG -DCAFFE2_USE_GLOO -DTH_HAVE_THREAD /EHsc /DNOMINMAX /wd4267 /wd4251 /wd4522 /wd4838 /wd4305 /wd4244 /wd4190 /wd4101 /wd4996 /wd4275 /bigobj -std:c++14 /showIncludes /Fotest_jit\CMakeFiles\test_jit.dir\test_cleanup_passes.cpp.obj /Fdtest_jit\CMakeFiles\test_jit.dir\ /FS -c C:\actions-runner\_work\pytorch\pytorch\test\cpp\jit\test_cleanup_passes.cpp
2022-04-04T18:40:49.2547435Z Microsoft (R) C/C++ Optimizing Compiler Version 19.28.29337 for x64
2022-04-04T18:40:49.2547748Z Copyright (C) Microsoft Corporation.  All rights reserved.

See GitHub Actions build Lint / clang-tidy (14/15)

Step: "Check for warnings" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:26:48.9555941Z /__w/pytorch/pytor...s' in lambda capture list [clang-diagnostic-error]
2022-04-04T18:26:48.9551703Z     /__w/pytorch/pytorch/torch/csrc/utils/python_dispatch.cpp:65
2022-04-04T18:26:48.9552020Z 
2022-04-04T18:26:48.9552309Z [clang-diagnostic-error] occurred 1 times
2022-04-04T18:26:48.9552861Z     /__w/pytorch/pytorch/torch/csrc/utils/python_dispatch.cpp:193
2022-04-04T18:26:48.9553152Z 
2022-04-04T18:26:48.9553348Z Processing 59 clang-tidy jobs
2022-04-04T18:26:48.9554095Z /__w/pytorch/pytorch/torch/csrc/utils/python_dispatch.cpp:65:3: error: annotate this function with 'override' or (rarely) 'final' [modernize-use-override,-warnings-as-errors]
2022-04-04T18:26:48.9554652Z   ~PythonKernelHolder() {
2022-04-04T18:26:48.9554937Z   ^
2022-04-04T18:26:48.9555265Z                         override
2022-04-04T18:26:48.9555941Z /__w/pytorch/pytorch/torch/csrc/utils/python_dispatch.cpp:193:19: error: expected variable name or 'this' in lambda capture list [clang-diagnostic-error]
2022-04-04T18:26:48.9556528Z     .def("impl", [{}](py::object self, const char* name, const char* dispatch, py::object func) {
2022-04-04T18:26:48.9556901Z                   ^
2022-04-04T18:26:48.9557224Z Warnings detected!
2022-04-04T18:26:48.9557583Z Summary:
2022-04-04T18:26:48.9557972Z [modernize-use-override] occurred 1 times
2022-04-04T18:26:48.9558429Z     /__w/pytorch/pytorch/torch/csrc/utils/python_dispatch.cpp:65
2022-04-04T18:26:48.9558676Z 
2022-04-04T18:26:48.9558885Z [clang-diagnostic-error] occurred 1 times
2022-04-04T18:26:48.9559421Z     /__w/pytorch/pytorch/torch/csrc/utils/python_dispatch.cpp:193
2022-04-04T18:26:48.9559578Z 

See GitHub Actions build pull / pytorch-xla-linux-bionic-py3.7-clang8 / build (15/15)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

2022-04-04T18:22:14.8891153Z �[36;1m echo "ERR...t available for the merge-base of your branch"�[0m
2022-04-04T18:22:14.8888008Z �[36;1mfi�[0m
2022-04-04T18:22:14.8888263Z �[36;1m# Covers the case where a previous tag doesn't exist for the tree�[0m
2022-04-04T18:22:14.8888638Z �[36;1m# this is only really applicable on trees that don't have `.circleci/docker` at its merge base, i.e. nightly�[0m
2022-04-04T18:22:14.8888981Z �[36;1mif ! git rev-parse "$MERGE_BASE:.circleci/docker"; then�[0m
2022-04-04T18:22:14.8889353Z �[36;1m  echo "Directory '.circleci/docker' not found in commit $MERGE_BASE, you should probably rebase onto a more recent commit"�[0m
2022-04-04T18:22:14.8889663Z �[36;1m  exit 1�[0m
2022-04-04T18:22:14.8889854Z �[36;1mfi�[0m
2022-04-04T18:22:14.8890104Z �[36;1mPREVIOUS_DOCKER_TAG=$(git rev-parse "$MERGE_BASE:.circleci/docker")�[0m
2022-04-04T18:22:14.8890460Z �[36;1m# If no image exists but the hash is the same as the previous hash then we should error out here�[0m
2022-04-04T18:22:14.8890794Z �[36;1mif [[ "${PREVIOUS_DOCKER_TAG}" = "${DOCKER_TAG}" ]]; then�[0m
2022-04-04T18:22:14.8891153Z �[36;1m  echo "ERROR: Something has gone wrong and the previous image isn't available for the merge-base of your branch"�[0m
2022-04-04T18:22:14.8891517Z �[36;1m  echo "       contact the PyTorch team to restore the original images"�[0m
2022-04-04T18:22:14.8891842Z �[36;1m  exit 1�[0m
2022-04-04T18:22:14.8892036Z �[36;1mfi�[0m
2022-04-04T18:22:14.8892249Z �[36;1mecho ::set-output name=rebuild::yes�[0m
2022-04-04T18:22:14.8903709Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-04-04T18:22:14.8903962Z env:
2022-04-04T18:22:14.8904135Z   IN_CI: 1
2022-04-04T18:22:14.8904324Z   IS_GHA: 1
2022-04-04T18:22:14.8904564Z   BASE_REVISION: 2474f6a49551298d93e56c14c4ad2fb48008f212
2022-04-04T18:22:14.8904874Z   DOCKER_IMAGE: 308535385114.dkr.ecr.us-east-1.amazonaws.com/pytorch/xla_base:v0.2

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@ezyang ezyang requested review from albanD, bdhirsh and bhosmer August 3, 2021 17:31
@ezyang
Copy link
Contributor Author

ezyang commented Aug 3, 2021

@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

ezyang added a commit to ezyang/pytorch that referenced this pull request Sep 8, 2021
Modeled off of __torch_dispatch__, this PR demonstrates how to register
Python functions directly to the dispatcher.  Unlike __torch_dispatch__,
this makes it possible to directly override preexisting implementations
of PyTorch operators with alternate implementations, functionality that
maybe of interest to IPEX or Triton.

This is not a complete PR because it doesn't provide a coherent user
facing API for the functionality:

- We need to design an appropriate Python-side object hierarchy and
  API surface for interacting with the dispatcher.  Similarly, we need
  to battle harden the preexisting Python dispatcher API, which was
  previously solely used for testing.  Some things that need to be
  improved include file/line number reporting of registrations.

- For overriding use cases, we need to introduce new alias keys to
  allow for overriding without triggering a warning message that
  overriding is happening.

- When an override happens, we need a convenient way to call into the
  underlying implementation, in case we have decided we aren't
  interested in overriding the behavior anyway

- This PR is not compatible with torchdeploy; to handle torchdeploy,
  we must introduce a level of indirection whereby there is a single
  registered kernel for all Python interpreters, but it then determines
  whether or not to fallthrough to the base implementation based on
  whether or not the registration happened from a matching interpreter
  or not

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

ghstack-source-id: 5d3fac0
Pull Request resolved: pytorch#62660
@github-actions
Copy link
Contributor

github-actions bot commented Oct 4, 2021

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
Stale pull requests will automatically be closed 30 days after being marked Stale

@github-actions github-actions bot added the Stale label Oct 4, 2021
@ezyang ezyang removed the Stale label Oct 4, 2021
zou3519 added a commit to pytorch/functorch that referenced this pull request Dec 10, 2021
WIP, but works for reverse-mode autograd right now.

H/T pytorch/pytorch#62660 for half of the
solution.
@zou3519
Copy link
Contributor

zou3519 commented Jan 4, 2022

I'll probably write up a doc on this, but another use case for this is a mechanism for "custom subclass function" - given a Tensor subclass (or a functorch transform), register a custom rule for it from Python. I hacked together a POC over at pytorch/functorch@0f98ab9 that reuses a lot of the code from this PR

@fps7806
Copy link
Contributor

fps7806 commented Jan 5, 2022

I am also interested in this feature. Mainly for backwards compatibility with a lot of python "ops" that are not compatible with TorchScript. The interface of the functions is compatible, but the implementation itself is not
Performance is not a major concern here, ease of use and stability is more important.
I can help test/review if needed

@zou3519
Copy link
Contributor

zou3519 commented Jan 5, 2022

Mainly for backwards compatibility with a lot of python "ops" that are not compatible with TorchScript. The interface of the functions is compatible, but the implementation itself is not

@fps7806 Thanks for the interest. I had a few clarifying questions:

  1. What are you using TorchScript for?
  2. How are you using TorchScript? Are you calling it from Python or are you using it without Python (i.e., some situation where you're deploying a model using libtorch?)
  3. Do you have a quick example of a python op that you'd like to TorchScript?

@fps7806
Copy link
Contributor

fps7806 commented Jan 6, 2022

Mainly for backwards compatibility with a lot of python "ops" that are not compatible with TorchScript. The interface of the functions is compatible, but the implementation itself is not

@fps7806 Thanks for the interest. I had a few clarifying questions:

  1. What are you using TorchScript for?
  2. How are you using TorchScript? Are you calling it from Python or are you using it without Python (i.e., some situation where you're deploying a model using libtorch?)
  3. Do you have a quick example of a python op that you'd like to TorchScript?
  1. We use TorchScript to support custom torch functions/models without having to change "production" (read: privileged) code and without allowing Arbitrary Code Execution.
  2. We use it from python ATM.
  3. I can't share any of the functions we actually have. But to be honest, the functions themselves are not important. We just have A LOT of functions written in python and some of them are very complex. Rewritting them in C++ is just not productive if we could just expose them to TorchScript with a python decorator. We also have a lot more people that can write Python code than c++ code.

The main ask is for exportable TorchScript functions implemented in python.

@fps7806
Copy link
Contributor

fps7806 commented Jan 23, 2022

I got around testing and found the exact snippet/test for what I want:

import tempfile

import torch


class PythonLibrary:
    def __init__(self, name: str):
        self.lib = torch._C._dispatch_library("DEF", name, "")
        self.ops = getattr(torch.ops, name)

    def register(self, name, func_signature):
        """
        func_signature example: "test(Tensor input) -> Tensor"
        """

        def _wrapper(func):
            self.lib.def_(name + func_signature, "")
            # TODO: use torch::schema(name).name() instead of name + signature
            self.lib.impl(name, "", func)
            return getattr(self.ops, name)

        return _wrapper

#### Example Usage ####
api = PythonLibrary("custom_ops")

run = [False]


@api.register("test", "(Tensor input, int test) -> Tensor")
def custom_function(x, test):
    assert isinstance(test, int)
    run[0] = True
    return x + test


@torch.jit.script
def fn(x: torch.Tensor):
    return custom_function(x, test=2)


with tempfile.TemporaryFile() as f:
    torch.jit.save(fn, f)
    f.seek(0)
    del fn, custom_function
    ts = torch.jit.load(f)
    ts(torch.zeros(10, device="cuda"))
    ts(torch.zeros(10, device="cpu"))
    assert run[0]
    print(ts.graph)

I made a custom library that I can use for now, but would be great if we can merge this PR at some point and support this natively.

Modeled off of __torch_dispatch__, this PR demonstrates how to register
Python functions directly to the dispatcher.  Unlike __torch_dispatch__,
this makes it possible to directly override preexisting implementations
of PyTorch operators with alternate implementations, functionality that
maybe of interest to IPEX or Triton.

This is not a complete PR because it doesn't provide a coherent user
facing API for the functionality:

- We need to design an appropriate Python-side object hierarchy and
  API surface for interacting with the dispatcher.  Similarly, we need
  to battle harden the preexisting Python dispatcher API, which was
  previously solely used for testing.  Some things that need to be
  improved include file/line number reporting of registrations.

- For overriding use cases, we need to introduce new alias keys to
  allow for overriding without triggering a warning message that
  overriding is happening.

- When an override happens, we need a convenient way to call into the
  underlying implementation, in case we have decided we aren't
  interested in overriding the behavior anyway

- This PR is not compatible with torchdeploy; to handle torchdeploy,
  we must introduce a level of indirection whereby there is a single
  registered kernel for all Python interpreters, but it then determines
  whether or not to fallthrough to the base implementation based on
  whether or not the registration happened from a matching interpreter
  or not

Signed-off-by: Edward Z. Yang <ezyangfb.com>

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

[ghstack-poisoned]
Modeled off of __torch_dispatch__, this PR demonstrates how to register
Python functions directly to the dispatcher.  Unlike __torch_dispatch__,
this makes it possible to directly override preexisting implementations
of PyTorch operators with alternate implementations, functionality that
maybe of interest to IPEX or Triton.

This is not a complete PR because it doesn't provide a coherent user
facing API for the functionality:

- We need to design an appropriate Python-side object hierarchy and
  API surface for interacting with the dispatcher.  Similarly, we need
  to battle harden the preexisting Python dispatcher API, which was
  previously solely used for testing.  Some things that need to be
  improved include file/line number reporting of registrations.

- For overriding use cases, we need to introduce new alias keys to
  allow for overriding without triggering a warning message that
  overriding is happening.

- When an override happens, we need a convenient way to call into the
  underlying implementation, in case we have decided we aren't
  interested in overriding the behavior anyway

- This PR is not compatible with torchdeploy; to handle torchdeploy,
  we must introduce a level of indirection whereby there is a single
  registered kernel for all Python interpreters, but it then determines
  whether or not to fallthrough to the base implementation based on
  whether or not the registration happened from a matching interpreter
  or not

Signed-off-by: Edward Z. Yang <ezyangfb.com>

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

[ghstack-poisoned]
anjali411 added a commit that referenced this pull request Apr 4, 2022
Modeled off of __torch_dispatch__, this PR demonstrates how to register
Python functions directly to the dispatcher.  Unlike __torch_dispatch__,
this makes it possible to directly override preexisting implementations
of PyTorch operators with alternate implementations, functionality that
maybe of interest to IPEX or Triton.

This is not a complete PR because it doesn't provide a coherent user
facing API for the functionality:

- We need to design an appropriate Python-side object hierarchy and
  API surface for interacting with the dispatcher.  Similarly, we need
  to battle harden the preexisting Python dispatcher API, which was
  previously solely used for testing.  Some things that need to be
  improved include file/line number reporting of registrations.

- For overriding use cases, we need to introduce new alias keys to
  allow for overriding without triggering a warning message that
  overriding is happening.

- When an override happens, we need a convenient way to call into the
  underlying implementation, in case we have decided we aren't
  interested in overriding the behavior anyway

- This PR is not compatible with torchdeploy; to handle torchdeploy,
  we must introduce a level of indirection whereby there is a single
  registered kernel for all Python interpreters, but it then determines
  whether or not to fallthrough to the base implementation based on
  whether or not the registration happened from a matching interpreter
  or not

Signed-off-by: Edward Z. Yang <ezyang@fb.com>

ghstack-source-id: 95d6efa
Pull Request resolved: #62660
@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2022

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the Stale label Jun 3, 2022
@ezyang ezyang closed this Jun 3, 2022
@facebook-github-bot facebook-github-bot deleted the gh/ezyang/1053/head branch July 4, 2022 14:18
zou3519 added a commit to zou3519/pytorch that referenced this pull request Jul 20, 2022
WIP, but works for reverse-mode autograd right now.

H/T pytorch#62660 for half of the
solution.
bigfootjon pushed a commit that referenced this pull request Jul 21, 2022
WIP, but works for reverse-mode autograd right now.

H/T #62660 for half of the
solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants