Skip to content

Commit 3387cf5

Browse files
committed
Migrate the rest of hf-nix to kernel-builder
1 parent 2bc1a3a commit 3387cf5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+17219
-89
lines changed

flake.lock

Lines changed: 4 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33

44
inputs = {
55
flake-utils.url = "github:numtide/flake-utils";
6-
nixpkgs.follows = "hf-nix/nixpkgs";
6+
# Put back to nixos-unstable-small the next bump. Exact revision is
7+
# to avoid a rebuild during the hf-nix -> kernel-builder transition.
8+
nixpkgs.url = "github:NixOS/nixpkgs/c543a59edf25ada193719764f3bc0c6ba835f94d";
79
flake-compat.url = "github:edolstra/flake-compat";
8-
hf-nix.url = "github:huggingface/hf-nix";
910
};
1011

1112
outputs =
1213
{
1314
self,
1415
flake-compat,
1516
flake-utils,
16-
hf-nix,
1717
nixpkgs,
1818
}:
1919
let
@@ -33,7 +33,6 @@
3333
name = system;
3434
value = import ./lib/build-sets.nix {
3535
inherit nixpkgs system torchVersions;
36-
hf-nix = hf-nix.overlays.default;
3736
};
3837
}) systems
3938
);

lib/build-sets.nix

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
nixpkgs,
33
system,
4-
hf-nix,
54
torchVersions,
65
}:
76

@@ -121,7 +120,6 @@ let
121120
xpuSupport = true;
122121
};
123122
overlays = [
124-
hf-nix
125123
overlay
126124
(overlayForXpuVersion xpuVersion)
127125
];
@@ -138,7 +136,6 @@ let
138136
allowUnfree = true;
139137
};
140138
overlays = [
141-
hf-nix
142139
overlay
143140
];
144141
};
@@ -157,7 +154,6 @@ let
157154
cudaSupport = true;
158155
};
159156
overlays = [
160-
hf-nix
161157
overlay
162158
(overlayForCudaVersion cudaVersion)
163159
];
@@ -179,7 +175,6 @@ let
179175
rocmSupport = true;
180176
};
181177
overlays = [
182-
hf-nix
183178
overlay
184179
(overlayForRocmVersion rocmVersion)
185180
];

overlay.nix

Lines changed: 101 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,58 @@
1-
final: prev: {
2-
cmakeNvccThreadsHook = prev.callPackage ./pkgs/cmake-nvcc-threads-hook { };
3-
4-
# Local packages
1+
final: prev:
2+
let
3+
# For XPU we use MKL from the joined oneAPI toolkit.
4+
useMKL = final.stdenv.isx86_64 && !(final.config.xpuSupport or false);
5+
in
6+
{
7+
# Use MKL for BLAS/LAPACK on x86_64.
8+
blas = if useMKL then prev.blas.override { blasProvider = prev.mkl; } else prev.blas;
9+
lapack = if useMKL then prev.lapack.override { lapackProvider = prev.mkl; } else prev.blas;
510

611
build2cmake = prev.callPackage ./pkgs/build2cmake { };
712

13+
cmakeNvccThreadsHook = prev.callPackage ./pkgs/cmake-nvcc-threads-hook { };
14+
815
get-kernel-check = prev.callPackage ./pkgs/get-kernel-check { };
916

1017
kernel-abi-check = prev.callPackage ./pkgs/kernel-abi-check { };
1118

1219
kernel-layout-check = prev.callPackage ./pkgs/kernel-layout-check { };
1320

21+
# Used by ROCm.
22+
libffi_3_2 = final.libffi_3_3.overrideAttrs (
23+
finalAttrs: _: {
24+
version = "3.2.1";
25+
src = final.fetchurl {
26+
url = with finalAttrs; "https://gcc.gnu.org/pub/${pname}/${pname}-${version}.tar.gz";
27+
hash = "sha256-0G67jh2aItGeONY/24OVQlPzm+3F1GIyoFZFaFciyjc=";
28+
};
29+
}
30+
);
31+
32+
magma = (prev.callPackage ./pkgs/magma { }).magma;
33+
34+
magma-hip =
35+
(prev.callPackage ./pkgs/magma {
36+
cudaSupport = false;
37+
rocmSupport = true;
38+
}).magma;
39+
40+
nvtx = final.callPackage ./pkgs/nvtx { };
41+
42+
metal-cpp = final.callPackage ./pkgs/metal-cpp { };
43+
1444
rewrite-nix-paths-macho = prev.callPackage ./pkgs/rewrite-nix-paths-macho { };
1545

1646
remove-bytecode-hook = prev.callPackage ./pkgs/remove-bytecode-hook { };
1747

1848
stdenvGlibc_2_27 = prev.callPackage ./pkgs/stdenv-glibc-2_27 { };
1949

50+
ucx = prev.ucx.overrideAttrs (
51+
_: prevAttrs: {
52+
buildInputs = prevAttrs.buildInputs ++ [ final.cudaPackages.cuda_nvcc ];
53+
}
54+
);
55+
2056
# Python packages
2157
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
2258
(
@@ -53,6 +89,14 @@ final: prev: {
5389

5490
mkTorch = callPackage ./pkgs/python-modules/torch/binary { };
5591

92+
scipy = python-super.scipy.overrideAttrs (
93+
_: prevAttrs: {
94+
# Three tests have a slight deviance.
95+
doCheck = false;
96+
doInstallCheck = false;
97+
}
98+
);
99+
56100
torch-bin_2_8 = mkTorch {
57101
version = "2.8";
58102
xpuPackages = final.xpuPackages_2025_1;
@@ -70,7 +114,60 @@ final: prev: {
70114
torch_2_9 = callPackage ./pkgs/python-modules/torch/source/2_9 {
71115
xpuPackages = final.xpuPackages_2025_2;
72116
};
117+
118+
triton-xpu_2_8 = callPackage ./pkgs/python-modules/triton-xpu {
119+
torchVersion = "2.8";
120+
xpuPackages = final.xpuPackages_2025_1;
121+
};
122+
123+
triton-xpu_2_9 = callPackage ./pkgs/python-modules/triton-xpu {
124+
torchVersion = "2.9";
125+
xpuPackages = final.xpuPackages_2025_2;
126+
};
73127
}
74128
)
129+
(import ./pkgs/python-modules/hooks)
75130
];
131+
132+
xpuPackages = final.xpuPackages_2025_1;
76133
}
134+
// (import ./pkgs/cutlass { pkgs = final; })
135+
// (
136+
let
137+
flattenVersion = prev.lib.strings.replaceStrings [ "." ] [ "_" ];
138+
readPackageMetadata = path: (builtins.fromJSON (builtins.readFile path));
139+
versions = [
140+
"6.3.4"
141+
"6.4.2"
142+
"7.0.1"
143+
];
144+
newRocmPackages = final.callPackage ./pkgs/rocm-packages { };
145+
in
146+
builtins.listToAttrs (
147+
map (version: {
148+
name = "rocmPackages_${flattenVersion (prev.lib.versions.majorMinor version)}";
149+
value = newRocmPackages {
150+
packageMetadata = readPackageMetadata ./pkgs/rocm-packages/rocm-${version}-metadata.json;
151+
};
152+
}) versions
153+
)
154+
)
155+
// (
156+
let
157+
flattenVersion = prev.lib.strings.replaceStrings [ "." ] [ "_" ];
158+
readPackageMetadata = path: (builtins.fromJSON (builtins.readFile path));
159+
xpuVersions = [
160+
"2025.1.3"
161+
"2025.2.1"
162+
];
163+
newXpuPackages = final.callPackage ./pkgs/xpu-packages { };
164+
in
165+
builtins.listToAttrs (
166+
map (version: {
167+
name = "xpuPackages_${flattenVersion (prev.lib.versions.majorMinor version)}";
168+
value = newXpuPackages {
169+
packageMetadata = readPackageMetadata ./pkgs/xpu-packages/intel-deep-learning-${version}.json;
170+
};
171+
}) xpuVersions
172+
)
173+
)

0 commit comments

Comments
 (0)