Skip to content

Commit

Permalink
python312Packages.pytorch: just disable -Werror; fix darwin x64 build (
Browse files Browse the repository at this point in the history
  • Loading branch information
GaetanLepage authored Jan 2, 2025
2 parents edb546d + 3fd20a9 commit 5242338
Showing 1 changed file with 3 additions and 51 deletions.
54 changes: 3 additions & 51 deletions pkgs/development/python-modules/torch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -454,59 +454,11 @@ buildPythonPackage rec {

env =
{
# Suppress a weird warning in mkl-dnn, part of ideep in pytorch
# (upstream seems to have fixed this in the wrong place?)
# https://github.com/intel/mkl-dnn/commit/8134d346cdb7fe1695a2aa55771071d455fae0bc
# https://github.com/pytorch/pytorch/issues/22346
#
# disable warnings as errors as they break the build on every compiler
# bump, among other things.
# Also of interest: pytorch ignores CXXFLAGS uses CFLAGS for both C and C++:
# https://github.com/pytorch/pytorch/blob/v1.11.0/setup.py#L17
NIX_CFLAGS_COMPILE = toString (
(
lib.optionals (blas.implementation == "mkl") [ "-Wno-error=array-bounds" ]
# Suppress gcc regression: avx512 math function raises uninitialized variable warning
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105593
# See also: Fails to compile with GCC 12.1.0 https://github.com/pytorch/pytorch/issues/77939
++ lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12.0.0") [
"-Wno-error=maybe-uninitialized"
"-Wno-error=uninitialized"
]
# Since pytorch 2.0:
# gcc-12.2.0/include/c++/12.2.0/bits/new_allocator.h:158:33: error: ‘void operator delete(void*, std::size_t)’
# ... called on pointer ‘<unknown>’ with nonzero offset [1, 9223372036854775800] [-Werror=free-nonheap-object]
++ lib.optionals (stdenv.cc.isGNU && lib.versions.major stdenv.cc.version == "12") [
"-Wno-error=free-nonheap-object"
]
# .../source/torch/csrc/autograd/generated/python_functions_0.cpp:85:3:
# error: cast from ... to ... converts to incompatible function type [-Werror,-Wcast-function-type-strict]
++ lib.optionals (stdenv.cc.isClang && lib.versionAtLeast stdenv.cc.version "16") [
"-Wno-error=cast-function-type-strict"
# Suppresses the most spammy warnings.
# This is mainly to fix https://github.com/NixOS/nixpkgs/issues/266895.
]
++ lib.optionals rocmSupport [
"-Wno-#warnings"
"-Wno-cpp"
"-Wno-unknown-warning-option"
"-Wno-ignored-attributes"
"-Wno-deprecated-declarations"
"-Wno-defaulted-function-deleted"
"-Wno-pass-failed"
]
++ [
"-Wno-unused-command-line-argument"
"-Wno-uninitialized"
"-Wno-array-bounds"
"-Wno-free-nonheap-object"
"-Wno-unused-result"
]
++ lib.optionals stdenv.cc.isGNU [
"-Wno-maybe-uninitialized"
"-Wno-stringop-overflow"
]
)
);

NIX_CFLAGS_COMPILE = "-Wno-error";
USE_VULKAN = setBool vulkanSupport;
}
// lib.optionalAttrs vulkanSupport {
Expand Down

0 comments on commit 5242338

Please sign in to comment.