From ed7edf5c6bd9324a94100dd5e61669b1cd9601d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Thu, 11 Sep 2025 16:47:11 +0000 Subject: [PATCH 01/17] Add non-bundle Torch 2.9 + CUDA 13.0 variant --- flake.lock | 6 ++---- flake.nix | 2 +- versions.nix | 10 +++++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 4e8a118a..beff69b1 100644 --- a/flake.lock +++ b/flake.lock @@ -82,6 +82,7 @@ }, "original": { "owner": "huggingface", + "ref": "torch-2.9.0", "repo": "hf-nix", "type": "github" } @@ -107,10 +108,7 @@ "flake-compat": "flake-compat", "flake-utils": "flake-utils", "hf-nix": "hf-nix", - "nixpkgs": [ - "hf-nix", - "nixpkgs" - ] + "nixpkgs": ["hf-nix", "nixpkgs"] } }, "systems": { diff --git a/flake.nix b/flake.nix index 738e7866..f4f5345e 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ flake-utils.url = "github:numtide/flake-utils"; nixpkgs.follows = "hf-nix/nixpkgs"; flake-compat.url = "github:edolstra/flake-compat"; - hf-nix.url = "github:huggingface/hf-nix"; + hf-nix.url = "github:huggingface/hf-nix/torch-2.9.0"; }; outputs = diff --git a/versions.nix b/versions.nix index fa5fb5de..e269a7f1 100644 --- a/versions.nix +++ b/versions.nix @@ -129,5 +129,13 @@ systems = [ "x86_64-linux" ]; bundleBuild = false; } - + { + torchVersion = "2.9"; + cudaVersion = "13.0"; + cxx11Abi = true; + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + } ] From 71189ae0f61ae47119ecebbceab1adb219b1a128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 12 Sep 2025 08:54:34 +0000 Subject: [PATCH 02/17] Capability 10.1 is renamed to 11.0 in CUDA 13 --- build2cmake/src/cuda_supported_archs.json | 15 ++++++++++++++- build2cmake/src/templates/cuda/preamble.cmake | 3 +++ lib/torch-extension/default.nix | 5 ++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/build2cmake/src/cuda_supported_archs.json b/build2cmake/src/cuda_supported_archs.json index 41a56d3f..608d15f8 100644 --- a/build2cmake/src/cuda_supported_archs.json +++ b/build2cmake/src/cuda_supported_archs.json @@ -1 +1,14 @@ -["7.0", "7.2", "7.5", "8.0", "8.6", "8.7", "8.9", "9.0", "10.0", "10.1", "12.0"] +[ + "7.0", + "7.2", + "7.5", + "8.0", + "8.6", + "8.7", + "8.9", + "9.0", + "10.0", + "10.1", + "11.0", + "12.0" +] diff --git a/build2cmake/src/templates/cuda/preamble.cmake b/build2cmake/src/templates/cuda/preamble.cmake index 4abea735..acb27b74 100644 --- a/build2cmake/src/templates/cuda/preamble.cmake +++ b/build2cmake/src/templates/cuda/preamble.cmake @@ -35,6 +35,9 @@ if (NOT TARGET_DEVICE STREQUAL "cuda" AND endif() if(DEFINED CMAKE_CUDA_COMPILER_VERSION AND + CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) + set(CUDA_DEFAULT_KERNEL_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0;10.0;11.0;12.0+PTX") +elseif(DEFINED CMAKE_CUDA_COMPILER_VERSION AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) set(CUDA_DEFAULT_KERNEL_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0;10.0;10.1;12.0+PTX") else() diff --git a/lib/torch-extension/default.nix b/lib/torch-extension/default.nix index 4cc583dc..f21edd21 100644 --- a/lib/torch-extension/default.nix +++ b/lib/torch-extension/default.nix @@ -152,8 +152,11 @@ stdenv.mkDerivation (prevAttrs: { TORCH_CUDA_ARCH_LIST = if cudaPackages.cudaOlder "12.8" then "7.0;7.5;8.0;8.6;8.9;9.0" + else if cudaPackages.cudaOlder "13.0" then + "7.0;7.5;8.0;8.6;8.9;9.0;10.0;10.1;12.0" else - "7.0;7.5;8.0;8.6;8.9;9.0;10.0;10.1;12.0"; + # sm_101 has been renamed to sm_110 in CUDA 13. + "7.5;8.0;8.6;8.9;9.0;10.0;11.0;12.0"; } // lib.optionalAttrs rocmSupport { PYTORCH_ROCM_ARCH = lib.concatStringsSep ";" torch.rocmArchs; From 827c634bdd91d4956477b778839d6c9d76ab3817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 12 Sep 2025 11:27:42 +0000 Subject: [PATCH 03/17] Remove all Torch 2.7 variants --- build-variants.json | 7 ------ docs/build-variants.md | 7 ------ versions.nix | 56 ------------------------------------------ 3 files changed, 70 deletions(-) diff --git a/build-variants.json b/build-variants.json index 7f74c1a1..baddd549 100644 --- a/build-variants.json +++ b/build-variants.json @@ -1,32 +1,25 @@ { "aarch64-darwin": { "metal": [ - "torch27-metal-aarch64-darwin", "torch28-metal-aarch64-darwin" ] }, "aarch64-linux": { "cuda": [ - "torch27-cxx11-cu128-aarch64-linux", "torch28-cxx11-cu129-aarch64-linux" ] }, "x86_64-linux": { "cuda": [ - "torch27-cxx11-cu118-x86_64-linux", - "torch27-cxx11-cu126-x86_64-linux", - "torch27-cxx11-cu128-x86_64-linux", "torch28-cxx11-cu126-x86_64-linux", "torch28-cxx11-cu128-x86_64-linux", "torch28-cxx11-cu129-x86_64-linux" ], "rocm": [ - "torch27-cxx11-rocm63-x86_64-linux", "torch28-cxx11-rocm63-x86_64-linux", "torch28-cxx11-rocm64-x86_64-linux" ], "xpu": [ - "torch27-cxx11-xpu20250-x86_64-linux", "torch28-cxx11-xpu20251-x86_64-linux" ] } diff --git a/docs/build-variants.md b/docs/build-variants.md index a9363dfd..e22bcef9 100644 --- a/docs/build-variants.md +++ b/docs/build-variants.md @@ -7,32 +7,25 @@ available. This list will be updated as new PyTorch versions are released. ## Metal aarch64-darwin -- `torch27-metal-aarch64-darwin` - `torch28-metal-aarch64-darwin` ## CUDA aarch64-linux -- `torch27-cxx11-cu128-aarch64-linux` - `torch28-cxx11-cu129-aarch64-linux` ## CUDA x86_64-linux -- `torch27-cxx11-cu118-x86_64-linux` -- `torch27-cxx11-cu126-x86_64-linux` -- `torch27-cxx11-cu128-x86_64-linux` - `torch28-cxx11-cu126-x86_64-linux` - `torch28-cxx11-cu128-x86_64-linux` - `torch28-cxx11-cu129-x86_64-linux` ## ROCm x86_64-linux -- `torch27-cxx11-rocm63-x86_64-linux` - `torch28-cxx11-rocm63-x86_64-linux` - `torch28-cxx11-rocm64-x86_64-linux` ## XPU x86_64-linux -- `torch27-cxx11-xpu20250-x86_64-linux` - `torch28-cxx11-xpu20251-x86_64-linux` ## Universal diff --git a/versions.nix b/versions.nix index e269a7f1..446c9146 100644 --- a/versions.nix +++ b/versions.nix @@ -1,52 +1,4 @@ [ - { - torchVersion = "2.7"; - cudaVersion = "11.8"; - cxx11Abi = true; - systems = [ "x86_64-linux" ]; - bundleBuild = true; - } - { - torchVersion = "2.7"; - cudaVersion = "12.6"; - cxx11Abi = true; - systems = [ - "x86_64-linux" - ]; - bundleBuild = true; - } - { - torchVersion = "2.7"; - cudaVersion = "12.8"; - cxx11Abi = true; - systems = [ - "x86_64-linux" - "aarch64-linux" - ]; - bundleBuild = true; - } - { - torchVersion = "2.7"; - rocmVersion = "6.3.4"; - cxx11Abi = true; - systems = [ "x86_64-linux" ]; - bundleBuild = true; - } - { - torchVersion = "2.7"; - rocmVersion = "6.4.2"; - cxx11Abi = true; - systems = [ "x86_64-linux" ]; - bundleBuild = false; - } - - { - torchVersion = "2.7"; - xpuVersion = "2025.0.2"; - cxx11Abi = true; - systems = [ "x86_64-linux" ]; - bundleBuild = true; - } { torchVersion = "2.8"; xpuVersion = "2025.1.3"; @@ -54,14 +6,6 @@ systems = [ "x86_64-linux" ]; bundleBuild = true; } - { - torchVersion = "2.7"; - cxx11Abi = true; - metal = true; - systems = [ "aarch64-darwin" ]; - bundleBuild = true; - } - { torchVersion = "2.8"; cudaVersion = "12.6"; From 5741c62137af062b3db2ceba7c06ab906cc382ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Sun, 14 Sep 2025 10:09:52 +0000 Subject: [PATCH 04/17] Correctly handle versions with a dash (e.g. 2.9.0-rc2) --- lib/version-utils.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/version-utils.nix b/lib/version-utils.nix index c4002c1a..8474ab78 100644 --- a/lib/version-utils.nix +++ b/lib/version-utils.nix @@ -1,6 +1,10 @@ { lib }: +let + inherit (lib) versions; +in { - flattenVersion = version: lib.replaceStrings [ "." ] [ "" ] (lib.versions.pad 2 version); + flattenVersion = + version: lib.replaceStrings [ "." ] [ "" ] (versions.majorMinor (versions.pad 2 version)); abiString = cxx11Abi: if cxx11Abi then "cxx11" else "cxx98"; } From f656218b9bff3ad2d0090b5d43d7f122d241066f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 16 Sep 2025 05:57:38 +0000 Subject: [PATCH 05/17] Add other CUDA variants and ROCm variants --- versions.nix | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/versions.nix b/versions.nix index 446c9146..46d59926 100644 --- a/versions.nix +++ b/versions.nix @@ -55,11 +55,18 @@ systems = [ "aarch64-darwin" ]; bundleBuild = true; } - - # Non-standard versions; not included in bundle builds. { - torchVersion = "2.8"; - cudaVersion = "12.4"; + torchVersion = "2.9"; + cudaVersion = "12.6"; + cxx11Abi = true; + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + } + { + torchVersion = "2.9"; + cudaVersion = "12.8"; cxx11Abi = true; systems = [ "x86_64-linux" @@ -82,4 +89,29 @@ "aarch64-linux" ]; } + { + torchVersion = "2.9"; + rocmVersion = "6.3.4"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = true; + } + { + torchVersion = "2.9"; + rocmVersion = "6.4.2"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = true; + } + + # Non-standard versions; not included in bundle builds. + { + torchVersion = "2.8"; + cudaVersion = "12.4"; + cxx11Abi = true; + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + } ] From 227f709a2188416b57f2c3f09b4b38833cedd79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 16 Sep 2025 10:21:36 +0200 Subject: [PATCH 06/17] Add Torch 2.9 aarch64-darwin and update variants --- build-variants.json | 7 +++++-- docs/build-variants.md | 3 +++ versions.nix | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/build-variants.json b/build-variants.json index baddd549..22fec673 100644 --- a/build-variants.json +++ b/build-variants.json @@ -1,7 +1,8 @@ { "aarch64-darwin": { "metal": [ - "torch28-metal-aarch64-darwin" + "torch28-metal-aarch64-darwin", + "torch29-metal-aarch64-darwin" ] }, "aarch64-linux": { @@ -17,7 +18,9 @@ ], "rocm": [ "torch28-cxx11-rocm63-x86_64-linux", - "torch28-cxx11-rocm64-x86_64-linux" + "torch28-cxx11-rocm64-x86_64-linux", + "torch29-cxx11-rocm63-x86_64-linux", + "torch29-cxx11-rocm64-x86_64-linux" ], "xpu": [ "torch28-cxx11-xpu20251-x86_64-linux" diff --git a/docs/build-variants.md b/docs/build-variants.md index e22bcef9..8764994f 100644 --- a/docs/build-variants.md +++ b/docs/build-variants.md @@ -8,6 +8,7 @@ available. This list will be updated as new PyTorch versions are released. ## Metal aarch64-darwin - `torch28-metal-aarch64-darwin` +- `torch29-metal-aarch64-darwin` ## CUDA aarch64-linux @@ -23,6 +24,8 @@ available. This list will be updated as new PyTorch versions are released. - `torch28-cxx11-rocm63-x86_64-linux` - `torch28-cxx11-rocm64-x86_64-linux` +- `torch29-cxx11-rocm63-x86_64-linux` +- `torch29-cxx11-rocm64-x86_64-linux` ## XPU x86_64-linux diff --git a/versions.nix b/versions.nix index 46d59926..41502b39 100644 --- a/versions.nix +++ b/versions.nix @@ -103,6 +103,13 @@ systems = [ "x86_64-linux" ]; bundleBuild = true; } + { + torchVersion = "2.9"; + cxx11Abi = true; + metal = true; + systems = [ "aarch64-darwin" ]; + bundleBuild = true; + } # Non-standard versions; not included in bundle builds. { From adce7e8e5b3b45fbb45b346589a230ff571cba5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Tue, 16 Sep 2025 09:05:01 +0000 Subject: [PATCH 07/17] CUDA Torch 2.9 are also bundle builds --- build-variants.json | 10 ++++++++-- docs/build-variants.md | 6 ++++++ versions.nix | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/build-variants.json b/build-variants.json index 22fec673..6b365aef 100644 --- a/build-variants.json +++ b/build-variants.json @@ -7,14 +7,20 @@ }, "aarch64-linux": { "cuda": [ - "torch28-cxx11-cu129-aarch64-linux" + "torch28-cxx11-cu129-aarch64-linux", + "torch29-cxx11-cu126-aarch64-linux", + "torch29-cxx11-cu128-aarch64-linux", + "torch29-cxx11-cu130-aarch64-linux" ] }, "x86_64-linux": { "cuda": [ "torch28-cxx11-cu126-x86_64-linux", "torch28-cxx11-cu128-x86_64-linux", - "torch28-cxx11-cu129-x86_64-linux" + "torch28-cxx11-cu129-x86_64-linux", + "torch29-cxx11-cu126-x86_64-linux", + "torch29-cxx11-cu128-x86_64-linux", + "torch29-cxx11-cu130-x86_64-linux" ], "rocm": [ "torch28-cxx11-rocm63-x86_64-linux", diff --git a/docs/build-variants.md b/docs/build-variants.md index 8764994f..0a2248ff 100644 --- a/docs/build-variants.md +++ b/docs/build-variants.md @@ -13,12 +13,18 @@ available. This list will be updated as new PyTorch versions are released. ## CUDA aarch64-linux - `torch28-cxx11-cu129-aarch64-linux` +- `torch29-cxx11-cu126-aarch64-linux` +- `torch29-cxx11-cu128-aarch64-linux` +- `torch29-cxx11-cu130-aarch64-linux` ## CUDA x86_64-linux - `torch28-cxx11-cu126-x86_64-linux` - `torch28-cxx11-cu128-x86_64-linux` - `torch28-cxx11-cu129-x86_64-linux` +- `torch29-cxx11-cu126-x86_64-linux` +- `torch29-cxx11-cu128-x86_64-linux` +- `torch29-cxx11-cu130-x86_64-linux` ## ROCm x86_64-linux diff --git a/versions.nix b/versions.nix index 41502b39..cce36de5 100644 --- a/versions.nix +++ b/versions.nix @@ -63,6 +63,7 @@ "x86_64-linux" "aarch64-linux" ]; + bundleBuild = true; } { torchVersion = "2.9"; @@ -72,6 +73,7 @@ "x86_64-linux" "aarch64-linux" ]; + bundleBuild = true; } { torchVersion = "2.8"; @@ -88,6 +90,7 @@ "x86_64-linux" "aarch64-linux" ]; + bundleBuild = true; } { torchVersion = "2.9"; From 648e43363e6a605ff811128f49c6b1dc5cfa39ce Mon Sep 17 00:00:00 2001 From: "Wang, Yi" Date: Tue, 30 Sep 2025 01:56:29 +0800 Subject: [PATCH 08/17] add xpu torch 2.9 (#232) Signed-off-by: Wang, Yi A --- build-variants.json | 3 ++- docs/build-variants.md | 1 + versions.nix | 7 +++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/build-variants.json b/build-variants.json index 6b365aef..86e49cdc 100644 --- a/build-variants.json +++ b/build-variants.json @@ -29,7 +29,8 @@ "torch29-cxx11-rocm64-x86_64-linux" ], "xpu": [ - "torch28-cxx11-xpu20251-x86_64-linux" + "torch28-cxx11-xpu20251-x86_64-linux", + "torch29-cxx11-xpu20252-x86_64-linux" ] } } diff --git a/docs/build-variants.md b/docs/build-variants.md index 0a2248ff..39b5c975 100644 --- a/docs/build-variants.md +++ b/docs/build-variants.md @@ -36,6 +36,7 @@ available. This list will be updated as new PyTorch versions are released. ## XPU x86_64-linux - `torch28-cxx11-xpu20251-x86_64-linux` +- `torch29-cxx11-xpu20252-x86_64-linux` ## Universal diff --git a/versions.nix b/versions.nix index cce36de5..5568717a 100644 --- a/versions.nix +++ b/versions.nix @@ -55,6 +55,13 @@ systems = [ "aarch64-darwin" ]; bundleBuild = true; } + { + torchVersion = "2.9"; + xpuVersion = "2025.2.1"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = true; + } { torchVersion = "2.9"; cudaVersion = "12.6"; From bb40a6c06a02300c5b7aaeb3465acd450b459271 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Thu, 2 Oct 2025 13:20:40 +0000 Subject: [PATCH 09/17] Build 2.7, 2.8, and 2.9rc5 --- build-variants.json | 7 +++++ docs/build-variants.md | 7 +++++ flake.lock | 8 +++--- flake.nix | 2 +- versions.nix | 62 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 5 deletions(-) diff --git a/build-variants.json b/build-variants.json index 86e49cdc..eb4e85d6 100644 --- a/build-variants.json +++ b/build-variants.json @@ -1,12 +1,14 @@ { "aarch64-darwin": { "metal": [ + "torch27-metal-aarch64-darwin", "torch28-metal-aarch64-darwin", "torch29-metal-aarch64-darwin" ] }, "aarch64-linux": { "cuda": [ + "torch27-cxx11-cu128-aarch64-linux", "torch28-cxx11-cu129-aarch64-linux", "torch29-cxx11-cu126-aarch64-linux", "torch29-cxx11-cu128-aarch64-linux", @@ -15,6 +17,9 @@ }, "x86_64-linux": { "cuda": [ + "torch27-cxx11-cu118-x86_64-linux", + "torch27-cxx11-cu126-x86_64-linux", + "torch27-cxx11-cu128-x86_64-linux", "torch28-cxx11-cu126-x86_64-linux", "torch28-cxx11-cu128-x86_64-linux", "torch28-cxx11-cu129-x86_64-linux", @@ -23,12 +28,14 @@ "torch29-cxx11-cu130-x86_64-linux" ], "rocm": [ + "torch27-cxx11-rocm63-x86_64-linux", "torch28-cxx11-rocm63-x86_64-linux", "torch28-cxx11-rocm64-x86_64-linux", "torch29-cxx11-rocm63-x86_64-linux", "torch29-cxx11-rocm64-x86_64-linux" ], "xpu": [ + "torch27-cxx11-xpu20250-x86_64-linux", "torch28-cxx11-xpu20251-x86_64-linux", "torch29-cxx11-xpu20252-x86_64-linux" ] diff --git a/docs/build-variants.md b/docs/build-variants.md index 39b5c975..ed7e3f2b 100644 --- a/docs/build-variants.md +++ b/docs/build-variants.md @@ -7,11 +7,13 @@ available. This list will be updated as new PyTorch versions are released. ## Metal aarch64-darwin +- `torch27-metal-aarch64-darwin` - `torch28-metal-aarch64-darwin` - `torch29-metal-aarch64-darwin` ## CUDA aarch64-linux +- `torch27-cxx11-cu128-aarch64-linux` - `torch28-cxx11-cu129-aarch64-linux` - `torch29-cxx11-cu126-aarch64-linux` - `torch29-cxx11-cu128-aarch64-linux` @@ -19,6 +21,9 @@ available. This list will be updated as new PyTorch versions are released. ## CUDA x86_64-linux +- `torch27-cxx11-cu118-x86_64-linux` +- `torch27-cxx11-cu126-x86_64-linux` +- `torch27-cxx11-cu128-x86_64-linux` - `torch28-cxx11-cu126-x86_64-linux` - `torch28-cxx11-cu128-x86_64-linux` - `torch28-cxx11-cu129-x86_64-linux` @@ -28,6 +33,7 @@ available. This list will be updated as new PyTorch versions are released. ## ROCm x86_64-linux +- `torch27-cxx11-rocm63-x86_64-linux` - `torch28-cxx11-rocm63-x86_64-linux` - `torch28-cxx11-rocm64-x86_64-linux` - `torch29-cxx11-rocm63-x86_64-linux` @@ -35,6 +41,7 @@ available. This list will be updated as new PyTorch versions are released. ## XPU x86_64-linux +- `torch27-cxx11-xpu20250-x86_64-linux` - `torch28-cxx11-xpu20251-x86_64-linux` - `torch29-cxx11-xpu20252-x86_64-linux` diff --git a/flake.lock b/flake.lock index beff69b1..8a620b37 100644 --- a/flake.lock +++ b/flake.lock @@ -73,16 +73,16 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1759385472, - "narHash": "sha256-a1YMZp3Yc1RJfLIObRKBTTbjMKL91IYbzTjG/HNZN+I=", + "lastModified": 1759410945, + "narHash": "sha256-8fhl0gwMAnOkQbogPIVq+Fha+Yeq52FaRXfwF+F9Q+k=", "owner": "huggingface", "repo": "hf-nix", - "rev": "050dd78a64cb58fb1f9fb29ca498c73107a9a13e", + "rev": "dba185e6f0c9abb06055a04644538883417c0f20", "type": "github" }, "original": { "owner": "huggingface", - "ref": "torch-2.9.0", + "ref": "torch-2.9.0-rc5", "repo": "hf-nix", "type": "github" } diff --git a/flake.nix b/flake.nix index f4f5345e..3c01eb26 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ flake-utils.url = "github:numtide/flake-utils"; nixpkgs.follows = "hf-nix/nixpkgs"; flake-compat.url = "github:edolstra/flake-compat"; - hf-nix.url = "github:huggingface/hf-nix/torch-2.9.0"; + hf-nix.url = "github:huggingface/hf-nix/torch-2.9.0-rc5"; }; outputs = diff --git a/versions.nix b/versions.nix index 5568717a..8b615b2e 100644 --- a/versions.nix +++ b/versions.nix @@ -1,4 +1,59 @@ [ + { + torchVersion = "2.7"; + cudaVersion = "11.8"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = true; + } + { + torchVersion = "2.7"; + cudaVersion = "12.6"; + cxx11Abi = true; + systems = [ + "x86_64-linux" + ]; + bundleBuild = true; + } + { + torchVersion = "2.7"; + cudaVersion = "12.8"; + cxx11Abi = true; + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + bundleBuild = true; + } + { + torchVersion = "2.7"; + rocmVersion = "6.3.4"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = true; + } + { + torchVersion = "2.7"; + rocmVersion = "6.4.2"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = false; + } + { + torchVersion = "2.7"; + xpuVersion = "2025.0.2"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = true; + } + { + torchVersion = "2.7"; + cxx11Abi = true; + metal = true; + systems = [ "aarch64-darwin" ]; + bundleBuild = true; + } + { torchVersion = "2.8"; xpuVersion = "2025.1.3"; @@ -131,4 +186,11 @@ "aarch64-linux" ]; } + { + torchVersion = "2.8"; + rocmVersion = "7.0.1"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = false; + } ] From 8b95e4a9455c9d21b601f4232b5b020c0ac58d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 3 Oct 2025 11:12:33 +0200 Subject: [PATCH 10/17] Add a note that Xcode 16.x is required for now --- docs/nix.md | 1 + lib/torch-extension/default.nix | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/nix.md b/docs/nix.md index e70500a8..2e2bc47b 100644 --- a/docs/nix.md +++ b/docs/nix.md @@ -6,6 +6,7 @@ We recommend installing Nix in the following way: - Linux: use the [official Nix installer](https://nixos.org/download/). - macOS: use the [Determinate Nix installer](https://docs.determinate.systems/determinate-nix/). + In addition, Xcode 16.x is currently required to build kernels. ## Getting started diff --git a/lib/torch-extension/default.nix b/lib/torch-extension/default.nix index f21edd21..cd23ae27 100644 --- a/lib/torch-extension/default.nix +++ b/lib/torch-extension/default.nix @@ -55,7 +55,7 @@ let onednn-xpu = xpuPackages.onednn-xpu.override { inherit stdenv oneapi-torch-dev; }; # On Darwin, we need the host's xcrun for `xcrun metal` to compile Metal shaders. - # t's not supported by the nixpkgs shim. + # It's not supported by the nixpkgs shim. xcrunHost = writeScriptBin "xcrunHost" '' # Use system SDK for Metal files. unset DEVELOPER_DIR From 4eb96b915f2a9e5d7bdb8668f7aeb34f4564d128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 3 Oct 2025 09:29:15 +0000 Subject: [PATCH 11/17] Add Torch 2.9 ABI compat warning --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 1b21b137..d0c1d124 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,13 @@ Python package. This builder is a core component of the larger kernel build/distribution system. +**Torch 2.9 note:** kernel-builder currently builds Torch 2.9 extensions based on +the [fifth release candidate](https://dev-discuss.pytorch.org/t/reminder-calls-for-features-upcoming-branch-cut/3225). +If you upload kernels Torch 2.9 kernels, please validate them against +the final Torch 2.9.0 release. In the unlikely case of an ABI-breaking +change, you can rebuild and upload a your kernel once kernel-builder +is updated for the final release + ## 🚀 Quick Start We recommend using [Nix](https://nixos.org/download.html) to build kernels. To speed up builds, first enable the Hugging Face binary cache: From 39367a45996a3ba7601bd7c916a9cd1fe6310e06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 3 Oct 2025 11:19:34 +0000 Subject: [PATCH 12/17] Better and better structured `forCache` --- flake.nix | 52 ++++++++++++++++++++++++---------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/flake.nix b/flake.nix index 3c01eb26..1d58209d 100644 --- a/flake.nix +++ b/flake.nix @@ -144,39 +144,35 @@ }) buildSets ); - # Dependencies that should be cached. + # Dependencies that should be cached, the structure of the output + # path is: /- forCache = let filterDist = lib.filter (output: output != "dist"); - # Get all `torch` outputs except for `dist`. Not all outputs - # are dependencies of `out`, but we'll need the `cxxdev` and - # `dev` outputs for kernel builds. - torchOutputs = builtins.listToAttrs ( - lib.flatten ( - # Map over build sets. - map ( - buildSet: - # Map over all outputs of `torch` in a buildset. - map (output: { - name = "${buildVersion buildSet}-${output}"; - value = buildSet.torch.${output}; - }) (filterDist buildSet.torch.outputs) - ) buildSets - ) - ); - oldLinuxStdenvs = builtins.listToAttrs ( - map (buildSet: { - name = "stdenv-${buildVersion buildSet}"; - value = buildSet.pkgs.stdenvGlibc_2_27; - }) buildSets - ); + # Get all outputs except for `dist` (which is the built wheel for Torch). + allOutputs = + drv: + map (output: { + name = "${drv.pname or drv.name}-${output}"; + path = drv.${output}; + }) (filterDist drv.outputs or [ "out" ]); + buildSetOutputs = + buildSet: + with buildSet.pkgs; + ( + allOutputs buildSet.torch + ++ allOutputs build2cmake + ++ allOutputs kernel-abi-check + ++ allOutputs python3Packages.kernels + ++ allOutputs stdenvGlibc_2_27 + ); + buildSetLinkFarm = buildSet: pkgs.linkFarm (buildVersion buildSet) (buildSetOutputs buildSet); in pkgs.linkFarm "packages-for-cache" ( - { - inherit build2cmake kernel-abi-check; - } - // torchOutputs - // lib.optionalAttrs nixpkgs.legacyPackages.${system}.stdenv.isLinux oldLinuxStdenvs + map (buildSet: { + name = buildVersion buildSet; + path = buildSetLinkFarm buildSet; + }) buildSets ); }; } From 6e14a4354fc7b87071858a28ff2fc2453ca7638e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 3 Oct 2025 12:19:18 +0000 Subject: [PATCH 13/17] Back to hf-nix main --- flake.lock | 10 ++++++---- flake.nix | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 8a620b37..47007e10 100644 --- a/flake.lock +++ b/flake.lock @@ -73,16 +73,15 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1759410945, + "lastModified": 1759493343, "narHash": "sha256-8fhl0gwMAnOkQbogPIVq+Fha+Yeq52FaRXfwF+F9Q+k=", "owner": "huggingface", "repo": "hf-nix", - "rev": "dba185e6f0c9abb06055a04644538883417c0f20", + "rev": "b1fc3a18b52447a0f24bc6884418edc5e66082b9", "type": "github" }, "original": { "owner": "huggingface", - "ref": "torch-2.9.0-rc5", "repo": "hf-nix", "type": "github" } @@ -108,7 +107,10 @@ "flake-compat": "flake-compat", "flake-utils": "flake-utils", "hf-nix": "hf-nix", - "nixpkgs": ["hf-nix", "nixpkgs"] + "nixpkgs": [ + "hf-nix", + "nixpkgs" + ] } }, "systems": { diff --git a/flake.nix b/flake.nix index 1d58209d..7210b321 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ flake-utils.url = "github:numtide/flake-utils"; nixpkgs.follows = "hf-nix/nixpkgs"; flake-compat.url = "github:edolstra/flake-compat"; - hf-nix.url = "github:huggingface/hf-nix/torch-2.9.0-rc5"; + hf-nix.url = "github:huggingface/hf-nix"; }; outputs = From b000c74af87cc27eb81444548bc547924f078bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 3 Oct 2025 15:17:10 +0200 Subject: [PATCH 14/17] README fixes Co-authored-by: Mohamed Mekkouri <93391238+MekkCyber@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d0c1d124..bf8160a4 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ This builder is a core component of the larger kernel build/distribution system. **Torch 2.9 note:** kernel-builder currently builds Torch 2.9 extensions based on the [fifth release candidate](https://dev-discuss.pytorch.org/t/reminder-calls-for-features-upcoming-branch-cut/3225). -If you upload kernels Torch 2.9 kernels, please validate them against +If you upload Torch 2.9 kernels, please validate them against the final Torch 2.9.0 release. In the unlikely case of an ABI-breaking -change, you can rebuild and upload a your kernel once kernel-builder +change, you can rebuild and upload your kernel once kernel-builder is updated for the final release ## 🚀 Quick Start From 5f775f358b552f8e08e791fe333e48f7b19ecfa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 3 Oct 2025 13:24:48 +0000 Subject: [PATCH 15/17] Drop capabilities 7.5 and 7.2 for CUDA 13 --- build2cmake/src/templates/cuda/preamble.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build2cmake/src/templates/cuda/preamble.cmake b/build2cmake/src/templates/cuda/preamble.cmake index acb27b74..7b6114de 100644 --- a/build2cmake/src/templates/cuda/preamble.cmake +++ b/build2cmake/src/templates/cuda/preamble.cmake @@ -36,7 +36,7 @@ endif() if(DEFINED CMAKE_CUDA_COMPILER_VERSION AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 13.0) - set(CUDA_DEFAULT_KERNEL_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0;10.0;11.0;12.0+PTX") + set(CUDA_DEFAULT_KERNEL_ARCHS "7.5;8.0;8.6;8.7;8.9;9.0;10.0;11.0;12.0+PTX") elseif(DEFINED CMAKE_CUDA_COMPILER_VERSION AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8) set(CUDA_DEFAULT_KERNEL_ARCHS "7.0;7.2;7.5;8.0;8.6;8.7;8.9;9.0;10.0;10.1;12.0+PTX") From 74645b26561780142fba12a6bf4faec39ebb4ffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 3 Oct 2025 13:27:18 +0000 Subject: [PATCH 16/17] Remove ROCm 7.0 builds that were for testing --- versions.nix | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/versions.nix b/versions.nix index 8b615b2e..5b43fea1 100644 --- a/versions.nix +++ b/versions.nix @@ -137,13 +137,6 @@ ]; bundleBuild = true; } - { - torchVersion = "2.8"; - rocmVersion = "7.0.1"; - cxx11Abi = true; - systems = [ "x86_64-linux" ]; - bundleBuild = false; - } { torchVersion = "2.9"; cudaVersion = "13.0"; @@ -186,11 +179,4 @@ "aarch64-linux" ]; } - { - torchVersion = "2.8"; - rocmVersion = "7.0.1"; - cxx11Abi = true; - systems = [ "x86_64-linux" ]; - bundleBuild = false; - } ] From 275f12a2960882e8ee23fb4105d7bedf737374c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 3 Oct 2025 15:54:03 +0200 Subject: [PATCH 17/17] Fix Darwin caching (stdenvGlibc_2_27 is only for Linux) --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 7210b321..0fa09108 100644 --- a/flake.nix +++ b/flake.nix @@ -164,7 +164,7 @@ ++ allOutputs build2cmake ++ allOutputs kernel-abi-check ++ allOutputs python3Packages.kernels - ++ allOutputs stdenvGlibc_2_27 + ++ lib.optionals stdenv.hostPlatform.isLinux (allOutputs stdenvGlibc_2_27) ); buildSetLinkFarm = buildSet: pkgs.linkFarm (buildVersion buildSet) (buildSetOutputs buildSet); in