|
| 1 | +name: "Build and test kernel" |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main] |
| 5 | + pull_request: |
| 6 | + branches: [main] |
| 7 | + types: [opened, synchronize, reopened] # trigger on PRs |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + name: Build kernels |
| 13 | + runs-on: |
| 14 | + group: aws-highmemory-32-plus-nix |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v6 |
| 17 | + - uses: DeterminateSystems/nix-installer-action@main |
| 18 | + with: |
| 19 | + extra-conf: | |
| 20 | + max-jobs = 4 |
| 21 | + cores = 12 |
| 22 | + sandbox-fallback = false |
| 23 | + - uses: cachix/cachix-action@v16 |
| 24 | + with: |
| 25 | + name: huggingface |
| 26 | + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" |
| 27 | + env: |
| 28 | + USER: runner |
| 29 | + - name: Nix info |
| 30 | + run: nix-shell -p nix-info --run "nix-info -m" |
| 31 | + - name: Build relu kernel |
| 32 | + run: ( cd examples/relu && nix build .\#redistributable.torch29-cxx11-cu126-x86_64-linux ) |
| 33 | + - name: Copy relu kernel |
| 34 | + run: cp -rL examples/relu/result relu-kernel |
| 35 | + |
| 36 | + - name: Build relu kernel (CPU) |
| 37 | + run: ( cd examples/relu && nix build .\#redistributable.torch29-cxx11-cpu-x86_64-linux ) |
| 38 | + - name: Copy relu kernel (CPU) |
| 39 | + run: cp -rL examples/relu/result relu-kernel-cpu |
| 40 | + |
| 41 | + - name: Build cutlass GEMM kernel |
| 42 | + run: ( cd examples/cutlass-gemm && nix build .\#redistributable.torch29-cxx11-cu126-x86_64-linux ) |
| 43 | + - name: Copy cutlass GEMM kernel |
| 44 | + run: cp -rL examples/cutlass-gemm/result cutlass-gemm-kernel |
| 45 | + |
| 46 | + - name: Build relu-backprop-compile kernel |
| 47 | + run: ( cd examples/relu-backprop-compile && nix build .\#redistributable.torch29-cxx11-cu126-x86_64-linux ) |
| 48 | + - name: Copy relu-backprop-compile kernel |
| 49 | + run: cp -rL examples/relu-backprop-compile/result relu-backprop-compile-kernel |
| 50 | + |
| 51 | + # Just test that we build with the extra torchVersions argument. |
| 52 | + - name: Build relu kernel (specific Torch version) |
| 53 | + run: ( cd examples/relu-specific-torch && nix build . ) |
| 54 | + |
| 55 | + - name: Build relu kernel (compiler flags) |
| 56 | + run: ( cd examples/relu-compiler-flags && nix build .\#redistributable.torch29-cxx11-cu126-x86_64-linux ) |
| 57 | + |
| 58 | + - name: Test that we can build a test shell (e.g. that gcc corresponds to CUDA-required) |
| 59 | + run: ( cd examples/relu && nix build .#devShells.x86_64-linux.test ) |
| 60 | + |
| 61 | + - name: Build silu-and-mul kernel |
| 62 | + run: ( cd examples/silu-and-mul && nix build .\#redistributable.torch-cuda ) |
| 63 | + - name: Copy silu-and-mul kernel |
| 64 | + run: cp -rL examples/silu-and-mul/result silu-and-mul-kernel |
| 65 | + |
| 66 | + - name: Upload kernel artifacts |
| 67 | + uses: actions/upload-artifact@v6 |
| 68 | + with: |
| 69 | + name: built-kernels |
| 70 | + path: | |
| 71 | + activation-kernel |
| 72 | + cutlass-gemm-kernel |
| 73 | + relu-kernel |
| 74 | + relu-kernel-cpu |
| 75 | + relu-backprop-compile-kernel |
| 76 | + silu-and-mul-kernel |
| 77 | +
|
| 78 | + test: |
| 79 | + name: Test kernels |
| 80 | + needs: build |
| 81 | + runs-on: |
| 82 | + group: aws-g6-12xlarge-plus |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v6 |
| 85 | + |
| 86 | + - name: Download kernel artifacts |
| 87 | + uses: actions/download-artifact@v7 |
| 88 | + with: |
| 89 | + name: built-kernels |
| 90 | + path: . |
| 91 | + |
| 92 | + - name: Set up Docker Buildx |
| 93 | + uses: docker/setup-buildx-action@v3 |
| 94 | + - name: Build Docker image |
| 95 | + uses: docker/build-push-action@v6 |
| 96 | + with: |
| 97 | + context: . |
| 98 | + file: tests/Dockerfile.test-kernel |
| 99 | + platforms: linux/amd64 |
| 100 | + load: true |
| 101 | + push: false |
| 102 | + tags: kernel-builder:latest |
| 103 | + |
| 104 | + - name: Run Tests |
| 105 | + run: | |
| 106 | + docker run --gpus all kernel-builder:latest |
0 commit comments