Skip to content

Commit

Permalink
Disable bogus warning and workaround GCC destructor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Nov 9, 2023
1 parent 7a8bd97 commit af59878
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
GCC 12 has a false positive warning when compiled for some architectures, e.g. Intel Sapphire Rapids.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112370

Suppress this warning such that the build doesn't error.

Author: Alexander Grund (TU Dresden)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 471fc8a8d3d..5eb7b432630 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -557,6 +557,7 @@ string(APPEND CMAKE_CUDA_FLAGS " -Xfatbin -compress-all")
if(NOT MSVC)
string(APPEND CMAKE_CUDA_FLAGS_DEBUG " -g -lineinfo --source-in-ptx")
string(APPEND CMAKE_CUDA_FLAGS_RELWITHDEBINFO " -g -lineinfo --source-in-ptx")
+ append_cxx_flag_if_supported("-Wno-free-nonheap-object" CMAKE_CXX_FLAGS)
endif(NOT MSVC)

# Set INTERN_BUILD_MOBILE for all mobile builds. Components that are not
diff --git a/cmake/public/utils.cmake b/cmake/public/utils.cmake
index 60cca5383dd..76c02d7479f 100644
--- a/cmake/public/utils.cmake
+++ b/cmake/public/utils.cmake
@@ -548,6 +548,8 @@ function(torch_update_find_cuda_flags)
endif()
endfunction()

+include(CheckCXXCompilerFlag)
+
##############################################################################
# CHeck if given flag is supported and append it to provided outputvar
# Also define HAS_UPPER_CASE_FLAG_NAME variable
5 changes: 5 additions & 0 deletions easybuild/easyconfigs/p/PyTorch/PyTorch-2.1.0-foss-2022b.eb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ patches = [
'PyTorch-2.0.1_skip-failing-gradtest.patch',
'PyTorch-2.0.1_skip-test_shuffle_reproducibility.patch',
'PyTorch-2.0.1_skip-tests-skipped-in-subprocess.patch',
'PyTorch-2.0.1_workaround-gcc12-destructor-exception-bug.patch',
'PyTorch-2.1.0_disable-gcc12-warning.patch',
'PyTorch-2.1.0_fix-vsx-vector-shift-functions.patch',
'PyTorch-2.1.0_remove-test-requiring-online-access.patch',
'PyTorch-2.1.0_skip-diff-test-on-ppc.patch',
Expand Down Expand Up @@ -66,6 +68,9 @@ checksums = [
'7047862abc1abaff62954da59700f36d4f39fcf83167a638183b1b7f8fec78ae'},
{'PyTorch-2.0.1_skip-tests-skipped-in-subprocess.patch':
'166c134573a95230e39b9ea09ece3ad8072f39d370c9a88fb2a1e24f6aaac2b5'},
{'PyTorch-2.0.1_workaround-gcc12-destructor-exception-bug.patch':
'198f2244b7415958f96a2c248bab33491a95454091889824d98b0d4a55f114f3'},
{'PyTorch-2.1.0_disable-gcc12-warning.patch': 'c858b8db0010f41005dc06f9a50768d0d3dc2d2d499ccbdd5faf8a518869a421'},
{'PyTorch-2.1.0_fix-vsx-vector-shift-functions.patch':
'3793b4b878be1abe7791efcbd534774b87862cfe7dc4774ca8729b6cabb39e7e'},
{'PyTorch-2.1.0_remove-test-requiring-online-access.patch':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
GCC 12 has a false positive warning when compiled for some architectures, e.g. Intel Sapphire Rapids.
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112370

Suppress this warning such that the build doesn't error.

Author: Alexander Grund (TU Dresden)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a48eaf4e29..faa06c8177a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -561,6 +561,7 @@ if(MSVC)
string(APPEND CMAKE_CXX_FLAGS " /FS")
string(APPEND CMAKE_CUDA_FLAGS " -Xcompiler /FS")
endif(MSVC)
+append_cxx_flag_if_supported("-Wno-free-nonheap-object" CMAKE_CXX_FLAGS)

string(APPEND CMAKE_CUDA_FLAGS " -Xfatbin -compress-all")

diff --git a/cmake/public/utils.cmake b/cmake/public/utils.cmake
index 4d48c0f0f3d..bda17319ce7 100644
--- a/cmake/public/utils.cmake
+++ b/cmake/public/utils.cmake
@@ -533,6 +533,8 @@ function(torch_update_find_cuda_flags)
endif()
endfunction()

+include(CheckCXXCompilerFlag)
+
##############################################################################
# CHeck if given flag is supported and append it to provided outputvar
# Also define HAS_UPPER_CASE_FLAG_NAME variable

0 comments on commit af59878

Please sign in to comment.