8000 [ROCm][Windows] Add hipcc compatibility flags to cpp_extension.py. (#… · pytorch/pytorch@b7ca502 · GitHub
[go: up one dir, main page]

Skip to content

Commit b7ca502

Browse files
ScottToddpytorchmergebot
authored andcommitted
[ROCm][Windows] Add hipcc compatibility flags to cpp_extension.py. (#159790)
This is a similar change to #153986, this time adding flags to the hipcc command under `cpp_extension.py`. The `-Wno-ignored-attributes` flag in particular avoids about 200MB of warning spam when building torchvision, like these: ``` In file included from D:\b\vision_main\torchvision\csrc\ops\hip\deform_conv2d_kernel.hip:72: In file included from D:\projects\TheRock\external-builds\pytorch\.venv\Lib\site-packages\torch\include\ATen/ATen.h:13: In file included from D:\projects\TheRock\external-builds\pytorch\.venv\Lib\site-packages\torch\include\ATen/Functions.h:386: In file included from D:\projects\TheRock\external-builds\pytorch\.venv\Lib\site-packages\torch\include\ATen/ops/_sparse_softmax.h:21: D:\projects\TheRock\external-builds\pytorch\.venv\Lib\site-packages\torch\include\ATen/ops/_sparse_softmax_ops.h:18:8: warning: __declspec attribute 'dllimport' is not supported [-Wignored-attributes] 18 | struct TORCH_API _sparse_softmax_int { | ^~~~~~~~~ D:\projects\TheRock\external-builds\pytorch\.venv\Lib\site-packages\torch\include\torch/headeronly/macros/Export.h:100:19: note: expanded from macro 'TORCH_API' 100 | #define TORCH_API C10_IMPORT | ^~~~~~~~~~ D:\projects\TheRock\external-builds\pytorch\.venv\Lib\site-packages\torch\include\torch/headeronly/macros/Export.h:53:31: note: expanded from macro 'C10_IMPORT' 53 | #define C10_IMPORT __declspec(dllimport) | ^~~~~~~~~ ``` The `-fms-extensions` flag just seems beneficial to include: https://clang.llvm.org/docs/MSVCCompatibility.html. See also this downstream issue where these changes were tested: ROCm/TheRock#910. Pull Request resolved: #159790 Approved by: https://github.com/jeffdaily
1 parent 7bd4cfa commit b7ca502

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

torch/utils/cpp_extension.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ def _join_sycl_home(*paths) -> str:
275275
'-DHIP_ENABLE_WARP_SYNC_BUILTINS=1'
276276
]
277277

278+
if IS_WINDOWS:
279+
# Compatibility flags, similar to those set in cmake/Dependencies.cmake.
280+
COMMON_HIPCC_FLAGS.append('-fms-extensions')
281+
# Suppress warnings about dllexport.
282+
COMMON_HIPCC_FLAGS.append('-Wno-ignored-attributes')
278283

279284

280285
def _get_sycl_arch_list():

0 commit comments

Comments
 (0)
0