|
1 | 1 | # kernel-builder |
2 | 2 |
|
3 | | -<div align="center"> |
4 | | -<img src="https://github.com/user-attachments/assets/4b5175f3-1d60-455b-8664-43b2495ee1c3" width="450" height="450" alt="kernel-builder logo"> |
5 | | -<p align="center"> |
6 | | - <a href="https://github.com/huggingface/kernel-builder/actions/workflows/docker-build-push.yaml"><img alt="Build and Push Docker Image" src="https://img.shields.io/github/actions/workflow/status/huggingface/kernel-builder/docker-build-push.yaml?label=docker"></a> |
7 | | - <a href="https://github.com/huggingface/kernel-builder/tags"><img alt="GitHub tag" src="https://img.shields.io/github/v/tag/huggingface/kernel-builder"></a> |
8 | | - <a href="https://github.com/huggingface/kernel-builder/pkgs/container/kernel-builder"><img alt="GitHub package" src="https://img.shields.io/badge/container-ghcr.io-blue"></a> |
9 | | -</p> |
10 | | -</div> |
11 | | -<hr/> |
| 3 | +`kernel-builder` has moved to the [kernels](https://github.com/huggingface/kernels/tree/main/builder) |
| 4 | +repository. If you maintain any kernels, please update your `flake.nix` |
| 5 | +from |
12 | 6 |
|
13 | | -**Note:** Torch 2.10 builds are still based on PyTorch release candidates. |
14 | | -Typically the ABI does not break during release candidates. If it does, |
15 | | -you have to recompile your kernels with the final 2.10.0 release. |
16 | | - |
17 | | -[Join us on Discord](https://discord.gg/H6Tkmd88N3) for questions and discussions! |
18 | | - |
19 | | -This repo contains a Nix package that can be used to build custom machine learning kernels for PyTorch. The kernels are built using the [PyTorch C++ Frontend](https://pytorch.org/cppdocs/frontend.html) and can be loaded from the Hub with the [kernels](https://github.com/huggingface/kernels) |
20 | | -Python package. |
21 | | - |
22 | | -This builder is a core component of the larger kernel build/distribution system. |
23 | | - |
24 | | -## π Quick Start |
25 | | - |
26 | | -We recommend using [Nix](https://nixos.org/download.html) to build kernels. To speed up builds, first enable the Hugging Face binary cache: |
27 | | - |
28 | | -```bash |
29 | | -# Install cachix and configure the cache |
30 | | -cachix use huggingface |
31 | | - |
32 | | -# Or run once without installing cachix |
33 | | -nix run nixpkgs#cachix -- use huggingface |
| 7 | +```nix |
| 8 | +kernel-builder.url = "github:huggingface/kernel-builder"; |
34 | 9 | ``` |
35 | 10 |
|
36 | | -Then quick start a build with: |
| 11 | +to |
37 | 12 |
|
38 | | -```bash |
39 | | -cd examples/relu |
40 | | -nix run .#build-and-copy \ |
41 | | - --max-jobs 2 \ |
42 | | - --cores 8 \ |
43 | | - -L |
| 13 | +```nix |
| 14 | +kernel-builder.url = "github:huggingface/kernels"; |
44 | 15 | ``` |
45 | 16 |
|
46 | | -Where `--max-jobs` specifies the number of build variant that should be built concurrently and `--cores` the number of CPU cores that should be used per build variant. |
47 | | - |
48 | | -The compiled kernel will then be available in the local `build/` directory. |
49 | | -We also provide Docker containers for CI builds. For a quick build: |
50 | | - |
51 | | -```bash |
52 | | -# Using the prebuilt container |
53 | | -cd examples/relu |
54 | | -docker run --rm \ |
55 | | - --mount type=bind,source=$(pwd),target=/kernelcode \ |
56 | | - -w /kernelcode ghcr.io/huggingface/kernel-builder:main build |
57 | | -``` |
58 | | - |
59 | | -See [dockerfiles/README.md](./dockerfiles/README.md) for more options, including a user-level container for CI/CD environments. |
60 | | - |
61 | | -## π― Hardware Support |
62 | | - |
63 | | -| Hardware | Kernels Support | Kernel-Builder Support | Kernels Validated in CI | Tier | |
64 | | -| ---------- | --------------- | ---------------------- | ----------------------- | ---- | |
65 | | -| CUDA | β | β | β | 1 | |
66 | | -| ROCm | β | β | β | 2 | |
67 | | -| XPU | β | β | β | 2 | |
68 | | -| Metal | β | β | β | 2 | |
69 | | -| Huawei NPU | β | β | β | 3 | |
70 | | - |
71 | | -# π Documentation |
72 | | - |
73 | | -- [Writing Hub kernels](./docs/writing-kernels.md) |
74 | | -- [Building kernels with Nix](./docs/nix.md) |
75 | | -- Framework-specific notes: |
76 | | - - [Metal](docs/metal.md) |
77 | | -- [Building kernels with Docker](./docs/docker.md) (for systems without Nix) |
78 | | -- [Local kernel development](docs/local-dev.md) (IDE integration) |
79 | | -- [Kernel security](./docs/security.md) |
80 | | -- [Why Nix?](./docs/why-nix.md) |
81 | | - |
82 | | -## Credits |
83 | | - |
84 | | -The generated CMake build files are based on the vLLM build infrastructure. |
| 17 | +and run `nix flake update` to update `flake.lock`. |
0 commit comments