-
Notifications
You must be signed in to change notification settings - Fork 58
ci: speed up and improve kernels tests CI #398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8cd8650
ci: do not build kernels test image inside a buildx container
danieldk 27d4203
ci: kernel tests workflow must fail when one of the tests fails
danieldk f462a9d
Fixup undefined PYTHONPATH
danieldk dc3edae
ci: avoid storing dnf cache
danieldk 51de3b7
ci: fix tests
danieldk 2f89d91
Fix compat module
danieldk 6072d50
ci: parallelize build of example/test kernels
danieldk ca83826
ci: set Nix max-jobs to 8
danieldk 31f0601
nix fmt
danieldk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Empty file.
Empty file.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| { | ||
| description = "All example kernels"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL. Thanks for this. |
||
|
|
||
| inputs = { | ||
| kernel-builder.url = "path:../.."; | ||
| }; | ||
|
|
||
| outputs = | ||
| { | ||
| self, | ||
| kernel-builder, | ||
| }: | ||
| let | ||
| inherit (kernel-builder.inputs) flake-utils nixpkgs; | ||
| inherit (kernel-builder.inputs.nixpkgs) lib; | ||
|
|
||
| cudaVersion = "cu126"; | ||
| torchVersion = "29"; | ||
| tvmFfiVersion = "01"; | ||
|
|
||
| # All example kernels to build in CI. | ||
| # | ||
| # - name: name in the output path | ||
| # - path: kernel flake path | ||
| # - drv (system -> flakeOutputs -> derivation): the derivation for the given | ||
| # system and flake outputs. | ||
| # - torchVersions: optional override for the torchVersions argument | ||
| ciKernels = [ | ||
| { | ||
| name = "relu-kernel"; | ||
| path = ./relu; | ||
| drv = | ||
| sys: out: out.packages.${sys}.redistributable.${"torch${torchVersion}-cxx11-${cudaVersion}-${sys}"}; | ||
| } | ||
| { | ||
| name = "relu-tvm-ffi-kernel"; | ||
| path = ./relu-tvm-ffi; | ||
| drv = | ||
| sys: out: out.packages.${sys}.redistributable.${"tvm-ffi${tvmFfiVersion}-${cudaVersion}-${sys}"}; | ||
| } | ||
| { | ||
| name = "extra-data"; | ||
| path = ./extra-data; | ||
| drv = | ||
| sys: out: out.packages.${sys}.redistributable.${"torch${torchVersion}-cxx11-${cudaVersion}-${sys}"}; | ||
| } | ||
| { | ||
| name = "relu-kernel-cpu"; | ||
| path = ./relu; | ||
| drv = sys: out: out.packages.${sys}.redistributable.${"torch${torchVersion}-cxx11-cpu-${sys}"}; | ||
| } | ||
| { | ||
| name = "cutlass-gemm-kernel"; | ||
| path = ./cutlass-gemm; | ||
| drv = | ||
| sys: out: out.packages.${sys}.redistributable.${"torch${torchVersion}-cxx11-${cudaVersion}-${sys}"}; | ||
| } | ||
| { | ||
| name = "cutlass-gemm-tvm-ffi-kernel"; | ||
| path = ./cutlass-gemm-tvm-ffi; | ||
| drv = | ||
| sys: out: out.packages.${sys}.redistributable.${"tvm-ffi${tvmFfiVersion}-${cudaVersion}-${sys}"}; | ||
| } | ||
| { | ||
| name = "relu-backprop-compile-kernel"; | ||
| path = ./relu-backprop-compile; | ||
| drv = | ||
| sys: out: out.packages.${sys}.redistributable.${"torch${torchVersion}-cxx11-${cudaVersion}-${sys}"}; | ||
| } | ||
| { | ||
| name = "silu-and-mul-kernel"; | ||
| path = ./silu-and-mul; | ||
| drv = sys: out: out.packages.${sys}.redistributable.torch-cuda; | ||
| } | ||
| { | ||
| # Tests that we can build with the extra torchVersions argument. | ||
| name = "relu-specific-torch"; | ||
| path = ./relu-specific-torch; | ||
| drv = sys: out: out.packages.${sys}.default; | ||
| torchVersions = _defaultVersions: [ | ||
| { | ||
| torchVersion = "2.9"; | ||
| cudaVersion = "12.8"; | ||
| systems = [ | ||
| "x86_64-linux" | ||
| "aarch64-linux" | ||
| ]; | ||
| bundleBuild = true; | ||
| } | ||
| ]; | ||
| } | ||
| { | ||
| name = "relu-compiler-flags"; | ||
| path = ./relu-compiler-flags; | ||
| drv = | ||
| sys: out: out.packages.${sys}.redistributable.${"torch${torchVersion}-cxx11-${cudaVersion}-${sys}"}; | ||
| } | ||
| { | ||
| # Check that we can build a test shell (e.g. gcc is compatible with | ||
| # CUDA requirements). | ||
| name = "relu-test-shell"; | ||
| path = ./relu; | ||
| drv = sys: out: out.devShells.${sys}.test; | ||
| } | ||
| ]; | ||
|
|
||
| mkKernelOutputs = | ||
| { | ||
| path, | ||
| torchVersions ? null, | ||
| }: | ||
| kernel-builder.lib.genKernelFlakeOutputs ( | ||
| { | ||
| inherit self path; | ||
| } | ||
| // lib.optionalAttrs (torchVersions != null) { inherit torchVersions; } | ||
| ); | ||
|
|
||
| ciKernelOutputs = map ( | ||
| kernel: | ||
| kernel | ||
| // { | ||
| outputs = mkKernelOutputs { | ||
| inherit (kernel) path; | ||
| torchVersions = kernel.torchVersions or null; | ||
| }; | ||
| } | ||
| ) ciKernels; | ||
| in | ||
| flake-utils.lib.eachSystem | ||
| [ | ||
| "x86_64-linux" | ||
| "aarch64-linux" | ||
| ] | ||
| ( | ||
| system: | ||
| let | ||
| pkgs = nixpkgs.legacyPackages.${system}; | ||
|
|
||
| resolvedKernels = map (kernel: { | ||
| inherit (kernel) name; | ||
| drv = kernel.drv system kernel.outputs; | ||
| }) ciKernelOutputs; | ||
|
|
||
| ci-build = pkgs.linkFarm "ci-kernels" ( | ||
| map (kernel: { | ||
| inherit (kernel) name; | ||
| path = kernel.drv; | ||
| }) resolvedKernels | ||
| ); | ||
| in | ||
| { | ||
| packages = { | ||
| inherit ci-build; | ||
| default = ci-build; | ||
| }; | ||
| } | ||
| ); | ||
| } | ||
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you meant