Documenting cuda 11.5 windows issue (#73013)
Summary:
Adding documentation about compiling extension with CUDA 11.5 and Windows
Example of failure: https://github.com/pytorch/pytorch/runs/4408796098?check_suite_focus=true
Note: Don't use torch/extension.h In CUDA 11.5 under windows in your C++ code:
Use aten instead of torch interface in all cuda 11.5 code under windows. It has been failing with errors, due to a bug in nvcc.
Example use:
>>> #include <ATen/ATen.h>
>>> at::Tensor SigmoidAlphaBlendForwardCuda(....)
Instead of:
>>> #include <torch/extension.h>
>>> torch::Tensor SigmoidAlphaBlendForwardCuda(...)
Currently open issue for nvcc bug: https://github.com/pytorch/pytorch/issues/69460
Complete Workaround code example: https://github.com/facebookresearch/pytorch3d/commit/cb170ac024a949f1f9614ffe6af1c38d972f7d48
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73013
Reviewed By: malfet, seemethere
Differential Revision: D34306134
Pulled By: atalman
fbshipit-source-id: 3c5b9d7a89c91bd1920dc63dbd356e45dc48a8bd
(cherry picked from commit 87098e7f17fca1b98c90fafe2dde1defb6633f49)
diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py
index b81fefb..00e6d5d 100644
--- a/torch/utils/cpp_extension.py
+++ b/torch/utils/cpp_extension.py
@@ -913,6 +913,20 @@
Note that while it's possible to include all supported archs, the more archs get included the
slower the building process will be, as it will build a separate kernel image for each arch.
+ Note that CUDA-11.5 nvcc will hit internal compiler error while parsing torch/extension.h on Windows.
+ To workaround the issue, move python binding logic to pure C++ file.
+
+ Example use:
+ >>> #include <ATen/ATen.h>
+ >>> at::Tensor SigmoidAlphaBlendForwardCuda(....)
+
+ Instead of:
+ >>> #include <torch/extension.h>
+ >>> torch::Tensor SigmoidAlphaBlendForwardCuda(...)
+
+ Currently open issue for nvcc bug: https://github.com/pytorch/pytorch/issues/69460
+ Complete workaround code example: https://github.com/facebookresearch/pytorch3d/commit/cb170ac024a949f1f9614ffe6af1c38d972f7d48
+
'''
library_dirs = kwargs.get('library_dirs', [])
library_dirs += library_paths(cuda=True)