Skip to content

add API for re-functionalization an aten op; other functionalization fixes#79420

Closed
bdhirsh wants to merge 11 commits intogh/bdhirsh/249/basefrom
gh/bdhirsh/249/head
Closed

add API for re-functionalization an aten op; other functionalization fixes#79420
bdhirsh wants to merge 11 commits intogh/bdhirsh/249/basefrom
gh/bdhirsh/249/head

Conversation

@bdhirsh
Copy link
Collaborator

@bdhirsh bdhirsh commented Jun 13, 2022

I moved out the changes to FunctionalTensorWrapper.h from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like pixel_shuffle that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through functionalize_aten_op. This PR also contains the changes to:

  • fix detach() for FunctionalTensorWrapper
  • fix some undefined tensor handling cases

I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646

Stack from ghstack (oldest at bottom):

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jun 13, 2022

🔗 Helpful links

❌ 2 New Failures

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

Expand to see more
  • 2/2 failures introduced in this PR

🕵️ 2 new failures recognized by patterns

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

See GitHub Actions build pull / win-vs2019-cuda11.6-py3 / build (1/2)

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

2022-06-22T06:32:05.3559534Z FAILED: bin/torch_cpu.dll lib/torch_cpu.lib
2022-06-22T06:31:49.5755404Z cub.cu
2022-06-22T06:31:49.5755910Z [5594/6323] Building CUDA object caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\DistributionLogNormalKernel.cu.obj
2022-06-22T06:31:49.5756335Z DistributionLogNormalKernel.cu
2022-06-22T06:31:57.0485914Z [5595/6323] Building CUDA object caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\DistributionUniform.cu.obj
2022-06-22T06:31:57.0486356Z DistributionUniform.cu
2022-06-22T06:31:59.6497073Z [5596/6323] Building CUDA object caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\EmbeddingBackwardKernel.cu.obj
2022-06-22T06:31:59.6497512Z EmbeddingBackwardKernel.cu
2022-06-22T06:32:00.4615771Z [5597/6323] Building CUDA object caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\Embedding.cu.obj
2022-06-22T06:32:00.4616106Z Embedding.cu
2022-06-22T06:32:05.3559024Z [5598/6323] Linking CXX shared library bin\torch_cpu.dll
2022-06-22T06:32:05.3559534Z FAILED: bin/torch_cpu.dll lib/torch_cpu.lib 
2022-06-22T06:32:05.3561390Z cmd.exe /C "cd . && C:\Jenkins\Miniconda3\Library\bin\cmake.exe -E vs_link_dll --intdir=caffe2\CMakeFiles\torch_cpu.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 /nologo @CMakeFiles\torch_cpu.rsp  /out:bin\torch_cpu.dll /implib:lib\torch_cpu.lib /pdb:bin\torch_cpu.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO /NODEFAULTLIB:vcomp  -WHOLEARCHIVE:C:/actions-runner/_work/pytorch/pytorch/build/lib/caffe2_protos.lib -WHOLEARCHIVE:C:/actions-runner/_work/pytorch/pytorch/build/lib/onnx.lib  && cd ."
2022-06-22T06:32:05.3563694Z LINK: command "C:\PROGRA~2\MICROS~2\2019\BUILDT~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\torch_cpu.rsp /out:bin\torch_cpu.dll /implib:lib\torch_cpu.lib /pdb:bin\torch_cpu.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO /NODEFAULTLIB:vcomp -WHOLEARCHIVE:C:/actions-runner/_work/pytorch/pytorch/build/lib/caffe2_protos.lib -WHOLEARCHIVE:C:/actions-runner/_work/pytorch/pytorch/build/lib/onnx.lib /MANIFEST /MANIFESTFILE:bin\torch_cpu.dll.manifest" failed (exit code 1120) with the following output:
2022-06-22T06:32:05.3564564Z    Creating library lib\torch_cpu.lib and object lib\torch_cpu.exp
2022-06-22T06:32:05.3565485Z FunctionalTensorWrapper.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl at::functionalization::_RemoveExcludeDispatchKeyGuard::~_RemoveExcludeDispatchKeyGuard(void)" (__imp_??1_RemoveExcludeDispatchKeyGuard@functionalization@at@@QEAA@XZ) referenced in function "public: __cdecl at::functionalization::ReenableFunctionalize::~ReenableFunctionalize(void)" (??1ReenableFunctionalize@functionalization@at@@QEAA@XZ)
2022-06-22T06:32:05.3566316Z bin\torch_cpu.dll : fatal error LNK1120: 1 unresolved externals
2022-06-22T06:32:05.4100685Z [5599/6323] Building CUDA object caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\DistributionBernoulli.cu.obj
2022-06-22T06:32:05.4101071Z DistributionBernoulli.cu
2022-06-22T06:32:06.5446701Z [5600/6323] Building CUDA object caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\DistributionRandomKernel.cu.obj
2022-06-22T06:32:06.5447211Z DistributionRandomKernel.cu
2022-06-22T06:32:09.6694112Z [5601/6323] Building CUDA object caffe2\CMakeFiles\torch_cuda_cu.dir\__\aten\src\ATen\native\cuda\ForeachBinaryOpList.cu.obj

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

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

2022-06-22T06:32:24.1339740Z FAILED: bin/torch_cpu.dll lib/torch_cpu.lib
2022-06-22T06:29:24.5937706Z [5767/5849] Building CXX object caffe2\torch\CMakeFiles\torch_python.dir\csrc\Layout.cpp.obj
2022-06-22T06:29:24.5986128Z [5768/5849] Building CXX object caffe2\torch\CMakeFiles\torch_python.dir\csrc\QScheme.cpp.obj
2022-06-22T06:29:25.0694138Z [5769/5849] Building CXX object caffe2\torch\CMakeFiles\torch_python.dir\csrc\MemoryFormat.cpp.obj
2022-06-22T06:29:25.2282097Z [5770/5849] Building CXX object test_jit\CMakeFiles\jitbackend_test.dir\test_backend_lib.cpp.obj
2022-06-22T06:29:25.6435049Z [5771/5849] Building CXX object caffe2\torch\CMakeFiles\torch_python.dir\csrc\Dtype.cpp.obj
2022-06-22T06:29:25.8737219Z [5772/5849] Building CXX object caffe2\torch\CMakeFiles\torch_python.dir\csrc\DynamicTypes.cpp.obj
2022-06-22T06:29:25.8981089Z [5773/5849] Building CXX object caffe2\torch\CMakeFiles\torch_python.dir\csrc\Generator.cpp.obj
2022-06-22T06:29:26.1163955Z [5774/5849] Building CXX object caffe2\torch\CMakeFiles\torch_python.dir\csrc\Exceptions.cpp.obj
2022-06-22T06:29:26.3268386Z [5775/5849] Building CXX object test_jit\CMakeFiles\torchbind_test.dir\test_custom_class_registrations.cpp.obj
2022-06-22T06:32:24.1339410Z [5776/5849] Linking CXX shared library bin\torch_cpu.dll
2022-06-22T06:32:24.1339740Z FAILED: bin/torch_cpu.dll lib/torch_cpu.lib 
2022-06-22T06:32:24.1340803Z cmd.exe /C "cd . && C:\Jenkins\Miniconda3\Library\bin\cmake.exe -E vs_link_dll --intdir=caffe2\CMakeFiles\torch_cpu.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 /nologo @CMakeFiles\torch_cpu.rsp  /out:bin\torch_cpu.dll /implib:lib\torch_cpu.lib /pdb:bin\torch_cpu.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO /NODEFAULTLIB:vcomp  -WHOLEARCHIVE:C:/actions-runner/_work/pytorch/pytorch/build/lib/caffe2_protos.lib -WHOLEARCHIVE:C:/actions-runner/_work/pytorch/pytorch/build/lib/onnx.lib  && cd ."
2022-06-22T06:32:24.1342522Z LINK: command "C:\PROGRA~2\MICROS~2\2019\BUILDT~1\VC\Tools\MSVC\1428~1.293\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\torch_cpu.rsp /out:bin\torch_cpu.dll /implib:lib\torch_cpu.lib /pdb:bin\torch_cpu.pdb /dll /version:0.0 /machine:x64 /ignore:4049 /ignore:4217 /ignore:4099 /INCREMENTAL:NO /NODEFAULTLIB:vcomp -WHOLEARCHIVE:C:/actions-runner/_work/pytorch/pytorch/build/lib/caffe2_protos.lib -WHOLEARCHIVE:C:/actions-runner/_work/pytorch/pytorch/build/lib/onnx.lib /MANIFEST /MANIFESTFILE:bin\torch_cpu.dll.manifest" failed (exit code 1120) with the following output:
2022-06-22T06:32:24.1343352Z    Creating library lib\torch_cpu.lib and object lib\torch_cpu.exp
2022-06-22T06:32:24.1344449Z FunctionalTensorWrapper.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl at::functionalization::_RemoveExcludeDispatchKeyGuard::~_RemoveExcludeDispatchKeyGuard(void)" (__imp_??1_RemoveExcludeDispatchKeyGuard@functionalization@at@@QEAA@XZ) referenced in function "public: __cdecl at::functionalization::ReenableFunctionalize::~ReenableFunctionalize(void)" (??1ReenableFunctionalize@functionalization@at@@QEAA@XZ)
2022-06-22T06:32:24.1345274Z bin\torch_cpu.dll : fatal error LNK1120: 1 unresolved externals
2022-06-22T06:32:24.1345544Z ninja: build stopped: subcommand failed.
2022-06-22T06:32:24.1528171Z -- Building version 1.13.0a0+gita9a2430
2022-06-22T06:32:24.1529433Z cmake -GNinja -DBUILD_ENVIRONMENT=win-vs2019-cpu-py3 -DBUILD_PYTHON=True -DBUILD_TEST=True -DBUILD_TYPE=release -DBUILD_WHEEL=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_GENERATOR=Ninja -DCMAKE_INCLUDE_PATH=C:\actions-runner\_work\pytorch\pytorch\build\win_tmp\mkl\include -DCMAKE_INSTALL_PREFIX=C:\actions-runner\_work\pytorch\pytorch\torch -DCMAKE_PREFIX_PATH=C:\Jenkins\Miniconda3\Lib\site-packages -DNUMPY_INCLUDE_DIR=C:\Jenkins\Miniconda3\lib\site-packages\numpy\core\include -DPYTHON_EXECUTABLE=C:\Jenkins\Miniconda3\python.exe -DPYTHON_INCLUDE_DIR=C:\Jenkins\Miniconda3\Include -DPYTHON_LIBRARY=C:\Jenkins\Miniconda3/libs/python38.lib -DTORCH_BUILD_VERSION=1.13.0a0+gita9a2430 -DUSE_CUDA=0 -DUSE_NUMPY=True C:\actions-runner\_work\pytorch\pytorch
2022-06-22T06:32:24.1530724Z cmake --build . --target install --config Release -- -j 8
2022-06-22T06:32:24.2116699Z 

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.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've already reviewed this right

@bdhirsh
Copy link
Collaborator Author

bdhirsh commented Jun 13, 2022

I've already reviewed this right

yup!

bdhirsh and others added 10 commits June 13, 2022 12:52
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
…nalization fixes"

I moved out the changes to `FunctionalTensorWrapper.h` from the LTC <> functionalization PR into a separate PR here, so dealing with XLA failures will be a bit easier.

Specifically, the LTC PR will make a few operators like `pixel_shuffle` that are functional, but decompose into view ops, require re-functionalization once they hit the XLA backend. This PR exposes a helper utility to do that through `functionalize_aten_op`. This PR also contains the changes to:
- fix `detach()` for `FunctionalTensorWrapper`
- fix some undefined tensor handling cases


I have an XLA patch here to do the re-functionalizing: pytorch/xla#3646




[ghstack-poisoned]
@pytorchmergebot
Copy link
Collaborator

Rebased gh/bdhirsh/199/orig onto refs/remotes/origin/master because #75527 was rebased, please pull locally before adding more changes (for example, via ghstack checkout https://github.com/pytorch/pytorch/pull/79420)

@github-actions
Copy link
Contributor

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 Aug 21, 2022
@bdhirsh
Copy link
Collaborator Author

bdhirsh commented Aug 23, 2022

closing, a version of this was already landed

@bdhirsh bdhirsh closed this Aug 23, 2022
@facebook-github-bot facebook-github-bot deleted the gh/bdhirsh/249/head branch September 23, 2022 14:20
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.

4 participants