diff --git a/.github/workflows/build_kernel.yaml b/.github/workflows/build_kernel.yaml index 144a7dbb..d4f78c6f 100644 --- a/.github/workflows/build_kernel.yaml +++ b/.github/workflows/build_kernel.yaml @@ -24,17 +24,17 @@ jobs: env: USER: github_runner - name: Build activation kernel - run: ( cd examples/activation && nix build .\#redistributable.torch26-cxx98-cu124-x86_64-linux ) + run: ( cd examples/activation && nix build .\#redistributable.torch27-cxx11-cu126-x86_64-linux ) - name: Copy activation kernel run: cp -rL examples/activation/result activation-kernel - name: Build cutlass GEMM kernel - run: ( cd examples/cutlass-gemm && nix build .\#redistributable.torch26-cxx98-cu124-x86_64-linux ) + run: ( cd examples/cutlass-gemm && nix build .\#redistributable.torch27-cxx11-cu126-x86_64-linux ) - name: Copy cutlass GEMM kernel run: cp -rL examples/cutlass-gemm/result cutlass-gemm-kernel - name: Build relu kernel - run: ( cd examples/relu && nix build .\#redistributable.torch26-cxx98-cu124-x86_64-linux ) + run: ( cd examples/relu && nix build .\#redistributable.torch27-cxx11-cu126-x86_64-linux ) - name: Copy relu kernel run: cp -rL examples/relu/result relu-kernel @@ -43,7 +43,7 @@ jobs: run: ( cd examples/relu-specific-torch && nix build . ) - name: Build silu-and-mul-universal kernel - run: ( cd examples/silu-and-mul-universal && nix build .\#redistributable.torch26-cxx98-cu124-x86_64-linux ) + run: ( cd examples/silu-and-mul-universal && nix build .\#redistributable.torch27-cxx11-cu126-x86_64-linux ) - name: Copy silu-and-mul-universal kernel run: cp -rL examples/silu-and-mul-universal/result silu-and-mul-universal-kernel diff --git a/.github/workflows/build_kernel_rocm.yaml b/.github/workflows/build_kernel_rocm.yaml index 5d8f6da0..7453fbe1 100644 --- a/.github/workflows/build_kernel_rocm.yaml +++ b/.github/workflows/build_kernel_rocm.yaml @@ -26,4 +26,4 @@ jobs: # For now we only test that there are no regressions in building ROCm # kernels. Also run tests once we have a ROCm runner. - name: Build relu kernel - run: ( cd examples/relu && nix build .\#redistributable.torch26-cxx11-rocm62-x86_64-linux -L ) + run: ( cd examples/relu && nix build .\#redistributable.torch27-cxx11-rocm63-x86_64-linux -L ) diff --git a/build-variants.json b/build-variants.json index 72676d90..95548b12 100644 --- a/build-variants.json +++ b/build-variants.json @@ -1,32 +1,29 @@ { "aarch64-darwin": { "metal": [ - "torch27-metal-aarch64-darwin" + "torch27-metal-aarch64-darwin", + "torch28-metal-aarch64-darwin" ] }, "aarch64-linux": { "cuda": [ - "torch26-cxx11-cu126-aarch64-linux", - "torch26-cxx98-cu126-aarch64-linux", - "torch27-cxx11-cu126-aarch64-linux", - "torch27-cxx11-cu128-aarch64-linux" + "torch27-cxx11-cu128-aarch64-linux", + "torch28-cxx11-cu129-aarch64-linux" ] }, "x86_64-linux": { "cuda": [ - "torch26-cxx11-cu118-x86_64-linux", - "torch26-cxx11-cu124-x86_64-linux", - "torch26-cxx11-cu126-x86_64-linux", - "torch26-cxx98-cu118-x86_64-linux", - "torch26-cxx98-cu124-x86_64-linux", - "torch26-cxx98-cu126-x86_64-linux", "torch27-cxx11-cu118-x86_64-linux", "torch27-cxx11-cu126-x86_64-linux", - "torch27-cxx11-cu128-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": [ - "torch26-cxx11-rocm62-x86_64-linux", - "torch27-cxx11-rocm63-x86_64-linux" + "torch27-cxx11-rocm63-x86_64-linux", + "torch28-cxx11-rocm63-x86_64-linux", + "torch28-cxx11-rocm64-x86_64-linux" ] } } diff --git a/docs/build-variants.md b/docs/build-variants.md index 8e71b6f6..d512fae8 100644 --- a/docs/build-variants.md +++ b/docs/build-variants.md @@ -8,30 +8,27 @@ 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 -- `torch26-cxx11-cu126-aarch64-linux` -- `torch26-cxx98-cu126-aarch64-linux` -- `torch27-cxx11-cu126-aarch64-linux` - `torch27-cxx11-cu128-aarch64-linux` +- `torch28-cxx11-cu129-aarch64-linux` ## CUDA x86_64-linux -- `torch26-cxx11-cu118-x86_64-linux` -- `torch26-cxx11-cu124-x86_64-linux` -- `torch26-cxx11-cu126-x86_64-linux` -- `torch26-cxx98-cu118-x86_64-linux` -- `torch26-cxx98-cu124-x86_64-linux` -- `torch26-cxx98-cu126-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 -- `torch26-cxx11-rocm62-x86_64-linux` - `torch27-cxx11-rocm63-x86_64-linux` +- `torch28-cxx11-rocm63-x86_64-linux` +- `torch28-cxx11-rocm64-x86_64-linux` ## Universal diff --git a/examples/relu-specific-torch/flake.nix b/examples/relu-specific-torch/flake.nix index ab1837f5..16b386e6 100644 --- a/examples/relu-specific-torch/flake.nix +++ b/examples/relu-specific-torch/flake.nix @@ -22,7 +22,7 @@ "x86_64-linux" "aarch64-linux" ]; - upstreamVariant = true; + bundleBuild = true; } ]; }; diff --git a/flake.lock b/flake.lock index ebcdcb44..6d27cab3 100644 --- a/flake.lock +++ b/flake.lock @@ -73,11 +73,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1751968576, - "narHash": "sha256-cmKrlWpNTG/hq1bCaHXfbdm9T+Y6V+5//EHAVc1TLBE=", + "lastModified": 1754038838, + "narHash": "sha256-oHigCT4z0ayyLyEuxdZooSXRAZP8lfOkZHzY1lx1U50=", "owner": "huggingface", "repo": "hf-nix", - "rev": "3fcd1e1b46da91b6691261640ffd6b7123d0cb9e", + "rev": "336f781fa284e193baa3d4c3ce3f95fb34e9ffad", "type": "github" }, "original": { @@ -88,17 +88,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1747820358, - "narHash": "sha256-fTqsZsUX6M3yeEvgyQvXcbGmT2CaRVyVwsi8eK29Oj4=", - "owner": "danieldk", + "lastModified": 1752785354, + "narHash": "sha256-Y33ryUz7MPqKrZwlbQcsYCUz2jAJCacRf8jbs0tYUlA=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "d3c1681180717528068082103bf323147de6ab0b", + "rev": "d38025438a6ee456758dc03188ca6873a415463b", "type": "github" }, "original": { - "owner": "danieldk", - "ref": "cudatoolkit-12.9-kernel-builder", + "owner": "nixos", "repo": "nixpkgs", + "rev": "d38025438a6ee456758dc03188ca6873a415463b", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 75666b41..204d9144 100644 --- a/flake.nix +++ b/flake.nix @@ -97,7 +97,7 @@ revUnderscored = builtins.replaceStrings [ "-" ] [ "_" ] rev; pkgs = nixpkgs.legacyPackages.${system}; shellTorch = - if system == "aarch64-darwin" then "torch27-metal-${system}" else "torch27-cxx11-cu126-${system}"; + if system == "aarch64-darwin" then "torch28-metal-${system}" else "torch28-cxx11-cu126-${system}"; in { devShells = rec { diff --git a/lib/build-sets.nix b/lib/build-sets.nix index 6696769d..93ed36fd 100644 --- a/lib/build-sets.nix +++ b/lib/build-sets.nix @@ -31,13 +31,13 @@ let let withCuda = builtins.filter (torchVersion: torchVersion ? cudaVersion) torchVersions; in - builtins.map (torchVersion: torchVersion.cudaVersion) withCuda; + lib.unique (builtins.map (torchVersion: torchVersion.cudaVersion) withCuda); rocmVersions = let withRocm = builtins.filter (torchVersion: torchVersion ? rocmVersion) torchVersions; in - builtins.map (torchVersion: torchVersion.rocmVersion) withRocm; + lib.unique (builtins.map (torchVersion: torchVersion.rocmVersion) withRocm); flattenVersion = version: lib.replaceStrings [ "." ] [ "_" ] (lib.versions.pad 2 version); @@ -59,7 +59,7 @@ let torchVersion, cxx11Abi, system, - upstreamVariant ? false, + bundleBuild ? false, }: let pkgs = @@ -80,7 +80,7 @@ let buildConfig pkgs torch - upstreamVariant + bundleBuild ; }; @@ -92,18 +92,6 @@ let ]; }; - pkgsForRocm = import nixpkgs { - inherit system; - config = { - allowUnfree = true; - rocmSupport = true; - }; - overlays = [ - hf-nix - overlay - ]; - }; - # Instantiate nixpkgs for the given CUDA versions. Returns # an attribute set like `{ "12.4" = ; ... }`. pkgsForCudaVersions = diff --git a/lib/build-variants.nix b/lib/build-variants.nix index 23e4618e..bfcdbcf0 100644 --- a/lib/build-variants.nix +++ b/lib/build-variants.nix @@ -19,7 +19,7 @@ rec { else throw "Could not find compute framework: no CUDA or ROCm version specified and Metal is not enabled"; - # Upstream build variants. + # Build variants included in bundle builds. buildVariants = let inherit (import ./version-utils.nix { inherit lib; }) abiString flattenVersion; @@ -39,7 +39,7 @@ rec { "torch${flattenVersion version.torchVersion}-${computeString version}-${version.system}" else "torch${flattenVersion version.torchVersion}-${abiString version.cxx11Abi}-${computeString version}-${version.system}"; - upstreamVersions = lib.filter (version: version.upstreamVariant or false); + bundleBuildVersions = lib.filter (version: version.bundleBuild or false); in lib.foldl' ( acc: version: @@ -51,5 +51,5 @@ rec { pathVersions = lib.attrByPath path [ ] acc ++ [ (buildName version) ]; in lib.recursiveUpdate acc (lib.setAttrByPath path pathVersions) - ) { } (flattenSystems (upstreamVersions torchVersions)); + ) { } (flattenSystems (bundleBuildVersions torchVersions)); } diff --git a/lib/build-version.nix b/lib/build-version.nix index d0588dcc..f0386d46 100644 --- a/lib/build-version.nix +++ b/lib/build-version.nix @@ -2,7 +2,7 @@ buildConfig, pkgs, torch, - upstreamVariant, + bundleBuild, }: let inherit (pkgs) lib; diff --git a/lib/build.nix b/lib/build.nix index 472a6641..c0e0b681 100644 --- a/lib/build.nix +++ b/lib/build.nix @@ -90,7 +90,7 @@ rec { buildConfig, pkgs, torch, - upstreamVariant, + bundleBuild, }: { path, @@ -199,10 +199,10 @@ rec { let # We just need to get any nixpkgs for use by the path join. pkgs = (builtins.head buildSets).pkgs; - upstreamBuildSets = builtins.filter (buildSet: buildSet.upstreamVariant) buildSets; + bundleBuildSets = builtins.filter (buildSet: buildSet.bundleBuild) buildSets; extensions = buildDistTorchExtensions { inherit path rev doGetKernelCheck; - buildSets = upstreamBuildSets; + buildSets = bundleBuildSets; }; buildConfig = readBuildConfig path; namePaths = diff --git a/lib/torch-extension/default.nix b/lib/torch-extension/default.nix index dc9da031..84c708db 100644 --- a/lib/torch-extension/default.nix +++ b/lib/torch-extension/default.nix @@ -121,7 +121,7 @@ stdenv.mkDerivation (prevAttrs: { libcusparse ] ) - #++ lib.optionals rocmSupport (with rocmPackages; [ clr rocm-core ]) + ++ lib.optionals rocmSupport (with rocmPackages; [ hipsparselt ]) ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ] diff --git a/pkgs/stdenv-glibc-2_27/default.nix b/pkgs/stdenv-glibc-2_27/default.nix index 70c07d4c..e6795e04 100644 --- a/pkgs/stdenv-glibc-2_27/default.nix +++ b/pkgs/stdenv-glibc-2_27/default.nix @@ -6,6 +6,7 @@ system, wrapBintoolsWith, wrapCCWith, + writeClosure, gcc12Stdenv, stdenv, bintools-unwrapped, @@ -71,5 +72,11 @@ let in overrideCC stdenv compilerWrapped; + # Workaround for: https://github.com/NixOS/nixpkgs/issues/428546 + ccWithoutHook = ((if cudaSupport then cudaPackages.backendStdenv else gcc12Stdenv).cc.cc).override { + # Just some null derivation to disable the hook. + sanitiseHeaderPathsHook = writeClosure [ ]; + }; + in -stdenvWith glibc_2_27 (if cudaSupport then cudaPackages.backendStdenv else gcc12Stdenv).cc.cc stdenv +stdenvWith glibc_2_27 ccWithoutHook stdenv diff --git a/versions.nix b/versions.nix index 61a5d0b0..67b91ac8 100644 --- a/versions.nix +++ b/versions.nix @@ -1,100 +1,101 @@ [ { - torchVersion = "2.6"; - cudaVersion = "11.8"; - cxx11Abi = false; - systems = [ "x86_64-linux" ]; - upstreamVariant = true; - } - { - torchVersion = "2.6"; + torchVersion = "2.7"; cudaVersion = "11.8"; cxx11Abi = true; systems = [ "x86_64-linux" ]; - upstreamVariant = true; - } - { - torchVersion = "2.6"; - cudaVersion = "12.4"; - cxx11Abi = false; - systems = [ "x86_64-linux" ]; - upstreamVariant = true; - } - { - torchVersion = "2.6"; - cudaVersion = "12.4"; - cxx11Abi = true; - systems = [ "x86_64-linux" ]; - upstreamVariant = true; + bundleBuild = true; } { - torchVersion = "2.6"; + torchVersion = "2.7"; cudaVersion = "12.6"; - cxx11Abi = false; + cxx11Abi = true; systems = [ "x86_64-linux" - "aarch64-linux" ]; - upstreamVariant = true; + bundleBuild = true; } { - torchVersion = "2.6"; - cudaVersion = "12.6"; + torchVersion = "2.7"; + cudaVersion = "12.8"; cxx11Abi = true; systems = [ "x86_64-linux" "aarch64-linux" ]; - upstreamVariant = true; + bundleBuild = true; } { - torchVersion = "2.6"; - rocmVersion = "6.2.4"; + torchVersion = "2.7"; + rocmVersion = "6.3.4"; cxx11Abi = true; systems = [ "x86_64-linux" ]; - upstreamVariant = true; + bundleBuild = true; } - { torchVersion = "2.7"; - cudaVersion = "11.8"; + rocmVersion = "6.4.2"; cxx11Abi = true; systems = [ "x86_64-linux" ]; - upstreamVariant = true; + bundleBuild = false; } + { torchVersion = "2.7"; + cxx11Abi = true; + metal = true; + systems = [ "aarch64-darwin" ]; + bundleBuild = true; + } + + { + torchVersion = "2.8"; cudaVersion = "12.6"; cxx11Abi = true; systems = [ "x86_64-linux" - "aarch64-linux" ]; - upstreamVariant = true; + bundleBuild = true; } { - torchVersion = "2.7"; + torchVersion = "2.8"; cudaVersion = "12.8"; cxx11Abi = true; + systems = [ + "x86_64-linux" + ]; + bundleBuild = true; + } + { + torchVersion = "2.8"; + cudaVersion = "12.9"; + cxx11Abi = true; systems = [ "x86_64-linux" "aarch64-linux" ]; - upstreamVariant = true; + bundleBuild = true; } { - torchVersion = "2.7"; + torchVersion = "2.8"; rocmVersion = "6.3.4"; cxx11Abi = true; systems = [ "x86_64-linux" ]; - upstreamVariant = true; + bundleBuild = true; } { - torchVersion = "2.7"; + torchVersion = "2.8"; + rocmVersion = "6.4.2"; + cxx11Abi = true; + systems = [ "x86_64-linux" ]; + bundleBuild = true; + } + { + torchVersion = "2.8"; cxx11Abi = true; metal = true; systems = [ "aarch64-darwin" ]; - upstreamVariant = true; + bundleBuild = true; } # Non-standard versions; not included in bundle builds. @@ -107,4 +108,14 @@ "aarch64-linux" ]; } + { + torchVersion = "2.8"; + cudaVersion = "12.4"; + cxx11Abi = true; + systems = [ + "x86_64-linux" + "aarch64-linux" + ]; + } + ]