Add support for backend-specific Python dependencies #834
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Build and test kernel" | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened] # trigger on PRs | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build kernels | |
| runs-on: | |
| group: aws-highmemory-32-plus-nix | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: DeterminateSystems/nix-installer-action@main | |
| with: | |
| extra-conf: | | |
| max-jobs = 4 | |
| cores = 12 | |
| sandbox-fallback = false | |
| - uses: cachix/cachix-action@v16 | |
| with: | |
| name: huggingface | |
| authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
| env: | |
| USER: runner | |
| - name: Nix info | |
| run: nix-shell -p nix-info --run "nix-info -m" | |
| - name: Build relu kernel | |
| run: ( cd examples/relu && nix build .\#redistributable.torch29-cxx11-cu126-x86_64-linux ) | |
| - name: Copy relu kernel | |
| run: cp -rL examples/relu/result relu-kernel | |
| - name: Build relu kernel (CPU) | |
| run: ( cd examples/relu && nix build .\#redistributable.torch29-cxx11-cpu-x86_64-linux ) | |
| - name: Copy relu kernel (CPU) | |
| run: cp -rL examples/relu/result relu-kernel-cpu | |
| - name: Build cutlass GEMM kernel | |
| run: ( cd examples/cutlass-gemm && nix build .\#redistributable.torch29-cxx11-cu126-x86_64-linux ) | |
| - name: Copy cutlass GEMM kernel | |
| run: cp -rL examples/cutlass-gemm/result cutlass-gemm-kernel | |
| - name: Build relu-backprop-compile kernel | |
| run: ( cd examples/relu-backprop-compile && nix build .\#redistributable.torch29-cxx11-cu126-x86_64-linux ) | |
| - name: Copy relu-backprop-compile kernel | |
| run: cp -rL examples/relu-backprop-compile/result relu-backprop-compile-kernel | |
| # Just test that we build with the extra torchVersions argument. | |
| - name: Build relu kernel (specific Torch version) | |
| run: ( cd examples/relu-specific-torch && nix build . ) | |
| - name: Build relu kernel (compiler flags) | |
| run: ( cd examples/relu-compiler-flags && nix build .\#redistributable.torch29-cxx11-cu126-x86_64-linux ) | |
| - name: Test that we can build a test shell (e.g. that gcc corresponds to CUDA-required) | |
| run: ( cd examples/relu && nix build .#devShells.x86_64-linux.test ) | |
| - name: Build silu-and-mul kernel | |
| run: ( cd examples/silu-and-mul && nix build .\#redistributable.torch-cuda ) | |
| - name: Copy silu-and-mul kernel | |
| run: cp -rL examples/silu-and-mul/result silu-and-mul-kernel | |
| - name: Upload kernel artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: built-kernels | |
| path: | | |
| activation-kernel | |
| cutlass-gemm-kernel | |
| relu-kernel | |
| relu-kernel-cpu | |
| relu-backprop-compile-kernel | |
| silu-and-mul-kernel | |
| test: | |
| name: Test kernels | |
| needs: build | |
| runs-on: | |
| group: aws-g6-12xlarge-plus | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download kernel artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: built-kernels | |
| path: . | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: tests/Dockerfile.test-kernel | |
| platforms: linux/amd64 | |
| load: true | |
| push: false | |
| tags: kernel-builder:latest | |
| - name: Run Tests | |
| run: | | |
| docker run --gpus all kernel-builder:latest |