Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: style kernel-builder-cli-docs quality bump-dev bump-dev-dry-run bump-dev-major bump-dev-major-dry-run bump-release bump-release-dry-run bump-major bump-major-dry-run pin-actions
.PHONY: style kernel-builder-cli-docs quality update-variants bump-dev bump-dev-dry-run bump-dev-major bump-dev-major-dry-run bump-release bump-release-dry-run bump-major bump-major-dry-run pin-actions


export check_dirs := kernels/src kernels/tests
Expand All @@ -24,6 +24,15 @@ kernel-builder-cli-docs:
pin-actions:
pinact run

variants_json := nix-builder/build-variants.json

update-variants:
nix eval --raw .#lib.allBuildVariantsJSON > $(variants_json).raw
nix run nixpkgs#jq -- 'walk(if type == "array" then sort else . end)' $(variants_json).raw > $(variants_json).new
mv $(variants_json).new $(variants_json)
rm -f $(variants_json).raw
nix run nixpkgs#python3 nix-builder/scripts/gen_variants_markdown.py

quality:
ruff format --check ${check_dirs}
ruff check ${check_dirs}
Expand Down
13 changes: 13 additions & 0 deletions docs/source/builder/build-variants.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This list will be updated as new PyTorch versions are released.
- `torch213-cpu-aarch64-darwin`
- `torch214-cpu-aarch64-darwin`
- `torch215-cpu-aarch64-darwin`
- `torch216-cpu-aarch64-darwin`

## Metal aarch64-darwin

Expand All @@ -22,6 +23,7 @@ This list will be updated as new PyTorch versions are released.
- `torch213-metal-aarch64-darwin`
- `torch214-metal-aarch64-darwin`
- `torch215-metal-aarch64-darwin`
- `torch216-metal-aarch64-darwin`

## CPU aarch64-linux

Expand All @@ -31,6 +33,7 @@ This list will be updated as new PyTorch versions are released.
- `torch213-cpu-aarch64-linux`
- `torch214-cpu-aarch64-linux`
- `torch215-cpu-aarch64-linux`
- `torch216-cpu-aarch64-linux`

## CUDA aarch64-linux

Expand All @@ -51,6 +54,9 @@ This list will be updated as new PyTorch versions are released.
- `torch214-cu132-aarch64-linux`
- `torch215-cu132-aarch64-linux`
- `torch215-cu134-aarch64-linux`
- `torch216-cu132-aarch64-linux`
- `torch216-cu134-aarch64-linux`
- `torch216-cu135-aarch64-linux`

## CPU x86_64-linux

Expand All @@ -60,6 +66,7 @@ This list will be updated as new PyTorch versions are released.
- `torch213-cpu-x86_64-linux`
- `torch214-cpu-x86_64-linux`
- `torch215-cpu-x86_64-linux`
- `torch216-cpu-x86_64-linux`

## CUDA x86_64-linux

Expand All @@ -80,6 +87,9 @@ This list will be updated as new PyTorch versions are released.
- `torch214-cu132-x86_64-linux`
- `torch215-cu132-x86_64-linux`
- `torch215-cu134-x86_64-linux`
- `torch216-cu132-x86_64-linux`
- `torch216-cu134-x86_64-linux`
- `torch216-cu135-x86_64-linux`

## ROCm x86_64-linux

Expand All @@ -95,6 +105,8 @@ This list will be updated as new PyTorch versions are released.
- `torch214-rocm72-x86_64-linux`
- `torch215-rocm100-x86_64-linux`
- `torch215-rocm714-x86_64-linux`
- `torch216-rocm101-x86_64-linux`
- `torch216-rocm102-x86_64-linux`

## TPU x86_64-linux

Expand All @@ -108,6 +120,7 @@ This list will be updated as new PyTorch versions are released.
- `torch213-xpu20260-x86_64-linux`
- `torch214-xpu20261-x86_64-linux`
- `torch215-xpu20261-x86_64-linux`
- `torch216-xpu20262-x86_64-linux`

## Python-only kernels

Expand Down
29 changes: 21 additions & 8 deletions nix-builder/build-variants.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@
"torch212-cpu-aarch64-darwin",
"torch213-cpu-aarch64-darwin",
"torch214-cpu-aarch64-darwin",
"torch215-cpu-aarch64-darwin"
"torch215-cpu-aarch64-darwin",
"torch216-cpu-aarch64-darwin"
],
"metal": [
"torch210-metal-aarch64-darwin",
"torch211-metal-aarch64-darwin",
"torch212-metal-aarch64-darwin",
"torch213-metal-aarch64-darwin",
"torch214-metal-aarch64-darwin",
"torch215-metal-aarch64-darwin"
"torch215-metal-aarch64-darwin",
"torch216-metal-aarch64-darwin"
]
},
"aarch64-linux": {
Expand All @@ -24,7 +26,8 @@
"torch212-cpu-aarch64-linux",
"torch213-cpu-aarch64-linux",
"torch214-cpu-aarch64-linux",
"torch215-cpu-aarch64-linux"
"torch215-cpu-aarch64-linux",
"torch216-cpu-aarch64-linux"
],
"cuda": [
"torch210-cu126-aarch64-linux",
Expand All @@ -43,7 +46,10 @@
"torch214-cu130-aarch64-linux",
"torch214-cu132-aarch64-linux",
"torch215-cu132-aarch64-linux",
"torch215-cu134-aarch64-linux"
"torch215-cu134-aarch64-linux",
"torch216-cu132-aarch64-linux",
"torch216-cu134-aarch64-linux",
"torch216-cu135-aarch64-linux"
]
},
"x86_64-linux": {
Expand All @@ -53,7 +59,8 @@
"torch212-cpu-x86_64-linux",
"torch213-cpu-x86_64-linux",
"torch214-cpu-x86_64-linux",
"torch215-cpu-x86_64-linux"
"torch215-cpu-x86_64-linux",
"torch216-cpu-x86_64-linux"
],
"cuda": [
"torch210-cu126-x86_64-linux",
Expand All @@ -72,7 +79,10 @@
"torch214-cu130-x86_64-linux",
"torch214-cu132-x86_64-linux",
"torch215-cu132-x86_64-linux",
"torch215-cu134-x86_64-linux"
"torch215-cu134-x86_64-linux",
"torch216-cu132-x86_64-linux",
"torch216-cu134-x86_64-linux",
"torch216-cu135-x86_64-linux"
],
"rocm": [
"torch210-rocm70-x86_64-linux",
Expand All @@ -86,7 +96,9 @@
"torch214-rocm714-x86_64-linux",
"torch214-rocm72-x86_64-linux",
"torch215-rocm100-x86_64-linux",
"torch215-rocm714-x86_64-linux"
"torch215-rocm714-x86_64-linux",
"torch216-rocm101-x86_64-linux",
"torch216-rocm102-x86_64-linux"
],
"tpu": [
"torch-tpu"
Expand All @@ -97,7 +109,8 @@
"torch212-xpu20253-x86_64-linux",
"torch213-xpu20260-x86_64-linux",
"torch214-xpu20261-x86_64-linux",
"torch215-xpu20261-x86_64-linux"
"torch215-xpu20261-x86_64-linux",
"torch216-xpu20262-x86_64-linux"
]
}
}
16 changes: 16 additions & 0 deletions nix-builder/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ final: prev:
triton-xpu_3_7_2
triton-xpu_3_8_0
triton-xpu_3_9_0
triton-xpu_3_9_1
;

cuda-bindings = python-self.callPackage ./pkgs/python-modules/cuda-bindings { };
Expand Down Expand Up @@ -352,6 +353,20 @@ final: prev:
xpuPackages = final.xpuPackages_2026_1_2;
};

torch-bin_2_16 = mkTorch {
version = "2.16";
nccl = byCudaMajor {
cuda13 = final.nccl_2_32_3;
};
nccl-ep = byCudaMajor {
cuda13 = final.nccl-ep_0_2_0 final.nccl_2_32_3;
};
triton-cuda = triton_3_9_0;
triton-rocm = triton-rocm_3_9_0;
triton-xpu = triton-xpu_3_9_1;
xpuPackages = final.xpuPackages_2026_2_0;
};

tvm-ffi = callPackage ./pkgs/python-modules/tvm-ffi {
};
}
Expand All @@ -363,6 +378,7 @@ final: prev:
}
// (import ./pkgs/cutlass { pkgs = final; })
// (import ./pkgs/nccl { inherit (final) callPackage; })
// (import ./pkgs/nccl-ep { inherit (final) callPackage; })
// (
# libnvshmem builds are very slow. Use binraries instead.
let
Expand Down
50 changes: 50 additions & 0 deletions nix-builder/pkgs/aotriton/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,54 @@ in
];
};

aotriton_0_15 = generic rec {
version = "0.15b";

# Upstream names the ROCm 10.x packages after their HIP version.
hipVersions = {
"10.1" = "7.16";
"10.2" = "7.17";
};

hashes = {
"10.1" = "sha256-3OQZgSIEzBG6TUcMc2OV79INvdf1Ce6JMzxw0xYTHW4=";
"10.2" = "sha256-X7aGnFzql57FEtKZSbelE+lUTTdwgjYPFR7AfKSm6a8=";
};

images = mkImages version [
(fetchurl {
url = "https://github.com/ROCm/aotriton/releases/download/0.15b/aotriton-0.15b-images-amd-gfx90a.tar.gz";
hash = "sha256-QhiZl+P0S7zenSzm6+2+rzc8KAKZ0D7HkzvnPgxiQ9M=";
})
(fetchurl {
url = "https://github.com/ROCm/aotriton/releases/download/0.15b/aotriton-0.15b-images-amd-gfx942.tar.gz";
hash = "sha256-EfXA+oxLE+/NRmJhrfH9a1vb4AwDrTW889U+B13RiEY=";
})
(fetchurl {
url = "https://github.com/ROCm/aotriton/releases/download/0.15b/aotriton-0.15b-images-amd-gfx950.tar.gz";
hash = "sha256-UDAHfwOIu79NaIQadGXZHPp7ZSoxNKc+c/VjnEW235M=";
})
(fetchurl {
url = "https://github.com/ROCm/aotriton/releases/download/0.15b/aotriton-0.15b-images-amd-gfx110x.tar.gz";
hash = "sha256-mxuw87/vCIRdK5VaAGiQ8ofEa1N8B9pJfl4ITZDXvjU=";
})
(fetchurl {
url = "https://github.com/ROCm/aotriton/releases/download/0.15b/aotriton-0.15b-images-amd-gfx115x.tar.gz";
hash = "sha256-NS6eW5nCMNfahU+GusbRSTCrioESddOYmergMMbRYas=";
})
(fetchurl {
url = "https://github.com/ROCm/aotriton/releases/download/0.15b/aotriton-0.15b-images-amd-gfx117x.tar.gz";
hash = "sha256-vQDSgsdDqX0elLFZO9mu+BKTo4HMDQwPTnuyOCxS8oM=";
})
(fetchurl {
url = "https://github.com/ROCm/aotriton/releases/download/0.15b/aotriton-0.15b-images-amd-gfx120x.tar.gz";
hash = "sha256-RgViGyQi5KOyizNX1w5gxVylfeYXnfCpeI7wtIftpks=";
})
(fetchurl {
url = "https://github.com/ROCm/aotriton/releases/download/0.15b/aotriton-0.15b-images-amd-gfx1250.tar.gz";
hash = "sha256-Iw0Q/BOu5JqutyJ77YebrkGggkV/q+z8ClyX8EeHUSI=";
})
];
};

}
25 changes: 25 additions & 0 deletions nix-builder/pkgs/nccl-ep/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{ callPackage }:

let
mkNcclEp = callPackage ./generic.nix { };
in
{
inherit mkNcclEp;

nccl-ep_0_2_0 =
nccl:
mkNcclEp {
inherit nccl;
version = "0.2.0";
wheels = {
x86_64-linux.cuda13 = {
url = "https://files.pythonhosted.org/packages/b5/80/2e510944b5993adb368a37241742e257b2c45b152b3e93f83011be74285e/nccl_extensions-0.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl";
sha256 = "7db0d5980c734fa94823125d35e1024af86090c7b8f5ffe7de3ba2d242dc52e9";
};
aarch64-linux.cuda13 = {
url = "https://files.pythonhosted.org/packages/a9/6f/5144b170010058910672e9a5f8e02898c8831d8b2be0740ef30ef89d51c7/nccl_extensions-0.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl";
sha256 = "6ec10419199cf662519deaa5a7ebf9b8f8c6bcab26623b31a78af4b44ab20a4f";
};
};
};
}
80 changes: 80 additions & 0 deletions nix-builder/pkgs/nccl-ep/generic.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
fetchurl,
lib,
stdenv,

# Native build inputs
autoAddDriverRunpath,
autoPatchelfHook,
unzip,

# Build inputs
cudaPackages,
}:

{
version,
wheels,
nccl,
}:

let
inherit (stdenv.hostPlatform) system;
inherit (cudaPackages) cudaMajorVersion;

wheel =
wheels.${system}."cuda${cudaMajorVersion}"
or (throw "NCCL EP ${version} is not available for ${system} and CUDA ${cudaMajorVersion}");
in
stdenv.mkDerivation {
pname = "nccl-ep";
inherit version;

src = fetchurl {
inherit (wheel) url sha256;
};

dontUnpack = true;

nativeBuildInputs = [
autoAddDriverRunpath
autoPatchelfHook
unzip
];

buildInputs = [
nccl
stdenv.cc.cc.lib
];

autoPatchelfFlags = [ "--keep-libc" ];

# Provided by the driver at runtime.
autoPatchelfIgnoreMissingDeps = [ "libcuda.so.1" ];

installPhase = ''
runHook preInstall

unzip -q "$src" \
'nccl/ep/lib/cu${cudaMajorVersion}/libnccl_ep.so.0' \
'nccl_extensions-*.dist-info/licenses/*' \
-d unpacked

mkdir -p "$out/lib" "$out/share/licenses/nccl-ep"
cp unpacked/nccl/ep/lib/cu${cudaMajorVersion}/libnccl_ep.so.0 "$out/lib/"
cp unpacked/nccl_extensions-*.dist-info/licenses/* "$out/share/licenses/nccl-ep/"

runHook postInstall
'';

meta = {
description = "NVIDIA NCCL EP library from the NCCL extensions";
homepage = "https://github.com/NVIDIA/nccl-extensions";
license = lib.licenses.asl20;
platforms = [
"aarch64-linux"
"x86_64-linux"
];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
}
14 changes: 14 additions & 0 deletions nix-builder/pkgs/nccl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,18 @@ in
};
};
};

nccl_2_32_3 = mkNccl {
version = "2.32.3";
wheels = {
x86_64-linux.cuda13 = {
url = "https://files.pythonhosted.org/packages/5b/29/6b277e63c92d91f9cb4d1a3a554e148983de39d54baa652bb52c798af78e/nvidia_nccl_cu13-2.32.3-py3-none-manylinux_2_27_x86_64.whl";
sha256 = "1459723080ac889d73a26edfa3e04383a7928ab31ac8f0ec43b3ea9548b04ff3";
};
aarch64-linux.cuda13 = {
url = "https://files.pythonhosted.org/packages/58/0a/c29c302036a06d27dd732588f3fd8ee89b1f7b0087e38c668ae7be8ff7b2/nvidia_nccl_cu13-2.32.3-py3-none-manylinux_2_27_aarch64.whl";
sha256 = "a5bee92b2f4af218c109f8d221c3c9adcc752b94ae0ffcb0ed5abf9341a7724c";
};
};
};
}
Loading
Loading