From 6789fa4ecb6ad292775429bdc680359da299a811 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Wed, 13 May 2026 21:18:21 +0000 Subject: [PATCH] python3Packages.torch: 2.11.0 -> 2.12.0 Diff: https://github.com/pytorch/pytorch/compare/v2.11.0...v2.12.0 Changelog: https://github.com/pytorch/pytorch/releases/tag/v2.12.0 Co-authored-by: Luna Nova --- .../python-modules/torch/source/default.nix | 39 +++--------------- .../python-modules/torch/source/src.nix | 41 +++++++++++-------- 2 files changed, 29 insertions(+), 51 deletions(-) diff --git a/pkgs/development/python-modules/torch/source/default.nix b/pkgs/development/python-modules/torch/source/default.nix index d9a475d7512e..e85a9d2cce28 100644 --- a/pkgs/development/python-modules/torch/source/default.nix +++ b/pkgs/development/python-modules/torch/source/default.nix @@ -3,7 +3,6 @@ lib, fetchFromGitHub, fetchFromGitLab, - fetchpatch, git-unroll, buildPythonPackage, python, @@ -48,7 +47,6 @@ llvmPackages, # dependencies - astunparse, binutils, expecttest, filelock, @@ -229,6 +227,9 @@ let rocm-smi clr.icd hipify + rocprofiler-sdk + rocprofiler-sdk.dev + amdsmi ] ++ lib.optionals (!vendorComposableKernel) [ composable_kernel @@ -282,8 +283,9 @@ in buildPythonPackage.override { inherit stdenv; } (finalAttrs: { pname = "torch"; # Don't forget to update torch-bin to the same version. - version = "2.11.0"; + version = "2.12.0"; pyproject = true; + __structuredAttrs = true; outputs = [ "out" # output standard python package @@ -306,29 +308,6 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: { patches = [ ./clang19-template-warning.patch - - # The GCC version upperbounds were wrong for cuda 12.8 and 12.9, which led downstream builds to - # illegitimately fail with: - # RuntimeError: The current installed version of g++ (14.3.0) is greater than the maximum - # required version by CUDA 12.9. Please make sure to use an adequate version of g++ - # (>=6.0.0, <14.0). - # TODO: remove at the next release - (fetchpatch { - name = "allow-gcc-14-with-cuda-12.8-9"; - url = "https://github.com/pytorch/pytorch/commit/39565a7dcf8f93ea22cedeaa20088b24ff6d2634.patch"; - hash = "sha256-Au5fVbs7i33d9c4Xj8koiBP7lGnsTGTaX4VlE2gAfy8="; - }) - - # pybind11 3.0.3 changes led to ambiguous deduction in some return types - # that used `py::make_tuple`, so the type is explicitly specified where - # needed. - # Merged pull request: https://github.com/pytorch/pytorch/pull/179277 - # TODO: remove at the next release - (fetchpatch { - name = "pybind11-3.0.3-ambiguous-return-type.patch"; - url = "https://github.com/pytorch/pytorch/commit/b248ebc17075c0c3ad2b2532970d2ada32b2cf94.patch"; - hash = "sha256-HY5JFGNoroFsfuUOO5j6WNP6gMHWUcIJFmWLqV8PV94="; - }) ] ++ lib.optionals cudaSupport [ ./fix-cmake-cuda-toolkit.patch @@ -400,13 +379,6 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: { --replace-fail "list(APPEND ATen_HIP_INCLUDE \''${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party/composable_kernel/include)" "" \ --replace-fail "list(APPEND ATen_HIP_INCLUDE \''${CMAKE_CURRENT_SOURCE_DIR}/../../../third_party/composable_kernel/library/include)" "" '' - # Detection of NCCL version doesn't work particularly well when using the static binary. - + lib.optionalString cudaSupport '' - substituteInPlace cmake/Modules/FindNCCL.cmake \ - --replace-fail \ - 'message(FATAL_ERROR "Found NCCL header version and library version' \ - 'message(WARNING "Found NCCL header version and library version' - '' # Remove PyTorch's FindCUDAToolkit.cmake and use CMake's default. # NOTE: Parts of pytorch rely on unmaintained FindCUDA.cmake with custom patches to support e.g. # newer architectures (sm_90a). We do want to delete vendored patches, but have to keep them @@ -620,7 +592,6 @@ buildPythonPackage.override { inherit stdenv; } (finalAttrs: { "sympy" ]; dependencies = [ - astunparse expecttest filelock fsspec diff --git a/pkgs/development/python-modules/torch/source/src.nix b/pkgs/development/python-modules/torch/source/src.nix index 40379b8456cb..393f4fb9de8f 100644 --- a/pkgs/development/python-modules/torch/source/src.nix +++ b/pkgs/development/python-modules/torch/source/src.nix @@ -4,7 +4,7 @@ fetchFromGitHub, runCommand, }: -assert version == "2.11.0"; +assert version == "2.12.0"; rec { src_aiter = fetchFromGitHub { owner = "ROCm"; @@ -43,6 +43,12 @@ rec { hash = "sha256-IDUIuAvgCzWaHoTJUZrH15bqoVcP8bZk+Gs1Ae6/CpY="; }; src_composable_kernel = fetchFromGitHub { + owner = "ROCm"; + repo = "composable_kernel"; + rev = "f1746955fdaf80a3414de814bf32437686dac347"; + hash = "sha256-B/xNuBPUdjL1b+0IzRnaSXT2FKUo5cYwYcKqfKqJ8Eg="; + }; + src_composable_kernel_aiter = fetchFromGitHub { owner = "ROCm"; repo = "composable_kernel"; rev = "fcc9372c009c8e0a23fece77b582da83b04a654f"; @@ -63,8 +69,8 @@ rec { src_cpp-httplib = fetchFromGitHub { owner = "yhirose"; repo = "cpp-httplib"; - rev = "bd95e67c234930cd6d6bb11309588c5462c63cec"; - hash = "sha256-5q77ersAJnPPpVChvntnqEly1/ek2KfX2iukTPUbKHc="; + rev = "4d7c9a788de136071ccf0dd4e96239151e2adadb"; + hash = "sha256-VXEhoxoQjGEuA2g/y6fDTA4LrPd4SggrS3aOjznDSvc="; }; src_cpr = fetchFromGitHub { owner = "libcpr"; @@ -87,14 +93,14 @@ rec { src_cudnn-frontend = fetchFromGitHub { owner = "NVIDIA"; repo = "cudnn-frontend"; - rev = "b8c0656e6f6c84fc194f4d57329b55d609eff596"; - hash = "sha256-G1WYxRCsg67umzOZ9W+JwXV6hfl5n2wtsH9KxVUccTU="; + rev = "a91f0e04dcea10515f0f776fc5a89535e316a9c8"; + hash = "sha256-OOKdkjsVnWgrtcI7IMPSRi2YxtqF2YNV4Fd2rD9I1K8="; }; src_cutlass = fetchFromGitHub { owner = "NVIDIA"; repo = "cutlass"; - rev = "0d2b201e8c1c4a03efa6e9c468161916e2334725"; - hash = "sha256-2xgdS2P2tEI/4qcZv9qjCYHFbAcVayMdCDeJfIiQN4U="; + rev = "da5e086dab31d63815acafdac9a9c5893b1c69e2"; + hash = "sha256-0q9Ad0Z6E/rO2PdM4uQc8H0E0qs9uKc3reHepiHhjEc="; }; src_cutlass_fbgemm = fetchFromGitHub { owner = "jwfromm"; @@ -141,8 +147,8 @@ rec { src_flash-attention = fetchFromGitHub { owner = "Dao-AILab"; repo = "flash-attention"; - rev = "e2743ab5b3803bb672b16437ba98a3b1d4576c50"; - hash = "sha256-ft3jPiKZDHzZvkGPI34l8/Hq9Rf2f6UjDPKGU2IYz+E="; + rev = "fec3a6a18460c1b40f097208d4c16fe8964a679d"; + hash = "sha256-7yEFNM2lslkBA/9slblAbiK1PHKqKmo1MCFJYz2BOLk="; }; src_flatbuffers = fetchFromGitHub { owner = "google"; @@ -243,7 +249,7 @@ rec { src_ideep = fetchFromGitHub { owner = "intel"; repo = "ideep"; - rev = "8e7ddd65df95f13e41f0a40c820c5f35ae4a0ea3"; + rev = "e539e0f9774e2018f0d56fe865da66581f692e3d"; hash = "sha256-AVSsugGYiQ4QOWMVaHj1hzlPTZmg65yrGMmrWytvUuM="; }; src_ittapi = fetchFromGitHub { @@ -273,8 +279,8 @@ rec { src_kineto = fetchFromGitHub { owner = "pytorch"; repo = "kineto"; - rev = "7a731b6ae01cfc2b1fc75d83a91f84e682e43fd7"; - hash = "sha256-kKASzILEvFhXDWDqBiNh21VxhtdT506NYoEDVrtVcGU="; + rev = "b2103f78d13fde4937af010c0ef8e24313568bc5"; + hash = "sha256-Ix5zulGaUPbLeVrrTm/EzcVWT4TkDYcBsQADAl4N7TA="; }; src_kleidiai = fetchFromGitHub { owner = "ARM-software"; @@ -303,8 +309,8 @@ rec { src_mkl-dnn = fetchFromGitHub { owner = "intel"; repo = "mkl-dnn"; - rev = "f1d471933dc852f956fd05389f9313c7148783d5"; - hash = "sha256-/e57voLBNun/2koTF3sEb0Z/nDjCwq9NJVk7TaTSvMY="; + rev = "03c022d3ffdcee958cfacbe720048e725fdf644c"; + hash = "sha256-xJTllrKs6mPNM85ZqyHTHWKpVOtOghmg4ZRFAvQZ4WU="; }; src_MSLK = fetchFromGitHub { owner = "meta-pytorch"; @@ -393,8 +399,8 @@ rec { src_pytorch = fetchFromGitHub { owner = "pytorch"; repo = "pytorch"; - rev = "v2.11.0"; - hash = "sha256-eA/pRQiibLJCKDUkMvmGq4suhrz37i0x0Lc/sH3Ag8E="; + rev = "v2.12.0"; + hash = "sha256-IyQs9CQbbpZYpd+8YhIj/ULjsIWu6gjkGrGSeMWqKvw="; }; src_sleef = fetchFromGitHub { owner = "shibatch"; @@ -423,7 +429,7 @@ rec { src_aiter_recursive = runCommand "aiter" { } '' cp -r ${src_aiter} $out chmod u+w $out/3rdparty/composable_kernel - cp -r ${src_composable_kernel_recursive}/* $out/3rdparty/composable_kernel + cp -r ${src_composable_kernel_aiter_recursive}/* $out/3rdparty/composable_kernel ''; src_asmjit_recursive = src_asmjit; src_benchmark_recursive = src_benchmark; @@ -431,6 +437,7 @@ rec { src_civetweb_recursive = src_civetweb; src_clang-cindex-python3_recursive = src_clang-cindex-python3; src_composable_kernel_recursive = src_composable_kernel; + src_composable_kernel_aiter_recursive = src_composable_kernel_aiter; src_composable_kernel_fbgemm_MSLK_recursive = src_composable_kernel_fbgemm_MSLK; src_composable_kernel_flash-attention_recursive = src_composable_kernel_flash-attention; src_cpp-httplib_recursive = src_cpp-httplib;