File tree Expand file tree Collapse file tree
development/python-modules Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 ninja ,
1010 scikit-build-core ,
1111 setuptools-scm ,
12+ python ,
13+ build ,
1214
1315 # dependencies
1416 typing-extensions ,
@@ -43,6 +45,10 @@ buildPythonPackage (finalAttrs: {
4345
4446 dependencies = [
4547 typing-extensions
48+ # for the extension we technically need torch, but this
49+ # causes some circular import issue during build, so the
50+ # user/dependant needs to ensure that for now
51+ # torch
4652 ] ;
4753
4854 optional-dependencies = {
@@ -59,6 +65,27 @@ buildPythonPackage (finalAttrs: {
5965 writableTmpDirAsHomeHook
6066 ] ;
6167
68+ # Building the extension already requires an installed
69+ # tvm-ffi, so we're just doing this "temporarily".
70+ # Would still be nice to break out the c-ext separately...
71+ # Maybe multiple outputs derivation?
72+ buildPhase = ''
73+ pypaBuildPhase
74+
75+ # pre-installing wheel for extension build
76+ TMP_INSTALL=$(mktemp -d)
77+ mkdir -p $TMP_INSTALL
78+ ${ python } /bin/python -m installer --prefix "$TMP_INSTALL" dist/*.whl;
79+ pushd addons/torch_c_dlpack_ext
80+ PYTHONPATH="$TMP_INSTALL/${ python . sitePackages } :$PYTHONPATH" \
81+ ${ build } /bin/pyproject-build --no-isolation --outdir ../../dist/ --wheel
82+ popd
83+ '' ;
84+
85+ # needed so we can work around the torch<->ext build circular
86+ # module init
87+ dontCheckRuntimeDeps = true ;
88+
6289 meta = {
6390 description = "Open ABI and FFI for Machine Learning Systems" ;
6491 changelog = "https://github.com/apache/tvm-ffi/releases/tag/${ finalAttrs . src . tag } " ;
Original file line number Diff line number Diff line change @@ -85,6 +85,8 @@ buildPythonPackage (finalAttrs: {
8585
8686 pythonRemoveDeps = [
8787 "nvidia-cudnn-frontend"
88+ # dsl is used in quack-kernels, so could be
89+ # made available separately
8890 "nvidia-cutlass-dsl"
8991 ] ;
9092 dependencies = [
Original file line number Diff line number Diff line change 1+ {
2+ fetchFromGitHub ,
3+ buildPythonPackage ,
4+ packaging ,
5+ setuptools ,
6+ setuptools-scm ,
7+ torch ,
8+ cudaPackages ,
9+ apache-tvm-ffi ,
10+ lib ,
11+ ...
12+ } :
13+ let
14+ # Not clear if anyone else really needs this
15+ cutlass-dsl = buildPythonPackage rec {
16+ pname = "nvidia-cutlass-dsl" ;
17+ # TODO: Should this be aligned with the actual
18+ # cutlass version? Seems to work fine for now.
19+ version = "4.4.2" ;
20+ pyproject = true ;
21+
22+ src = fetchFromGitHub {
23+ owner = "NVIDIA" ;
24+ repo = "cutlass" ;
25+ tag = "v${ version } " ;
26+ hash = "sha256-0q9Ad0Z6E/rO2PdM4uQc8H0E0qs9uKc3reHepiHhjEc=" ;
27+ } ;
28+
29+ patchPhase = ''
30+ echo ${ version } > VERSION.EDITABLE
31+ '' ;
32+
33+ sourceRoot = "${ src . name } /python/CuTeDSL" ;
34+
35+ stdenv = torch . stdenv ;
36+ dependencies = [
37+ torch
38+ cudaPackages . cutlass
39+ ] ;
40+ build-system = [
41+ setuptools-scm
42+ ] ;
43+ } ;
44+
45+ in
46+
47+ buildPythonPackage rec {
48+ pname = "quack-kernels" ;
49+ version = "0.3.4" ;
50+ pyproject = true ;
51+
52+ stdenv = torch . stdenv ;
53+ build-system = [
54+ packaging
55+ setuptools
56+ setuptools-scm
57+ torch
58+ ] ;
59+
60+ dependencies = [
61+ cudaPackages . cutlass
62+ torch
63+ #tvm-ffi comes with torch-c-dlpack_ext
64+ apache-tvm-ffi
65+ cutlass-dsl
66+ ] ;
67+
68+ src = fetchFromGitHub {
69+ # https://github.com/Dao-AILab/quack/tree/v0.3.4
70+ name = "quack-kernels" ;
71+ owner = "DAO-AILab" ;
72+ repo = "quack" ;
73+ rev = "v${ version } " ;
74+ hash = "sha256-CjaUe+gBHfWkdnxn+jiXq9s7ODjveptJXdjbiBywGjA=" ;
75+ } ;
76+
77+ meta = {
78+ description = "A Quirky Assortment of CuTe Kernels" ;
79+ homepage = "https://github.com/Dao-AILab/quack" ;
80+ license = lib . licenses . asl20 ;
81+ maintainers = [
82+ ] ;
83+ } ;
84+ }
Original file line number Diff line number Diff line change 9393 cupy ,
9494 flashinfer ,
9595 nvidia-ml-py ,
96+ quack-kernels ,
9697
9798 # optional-dependencies
9899 # audio
@@ -390,7 +391,9 @@ buildPythonPackage.override { stdenv = torch.stdenv; } (finalAttrs: {
390391 ]
391392 ++ lib . optionals cudaSupport [
392393 cudaPackages . cuda_nvcc
394+ cudaPackages . cutlass
393395 autoAddDriverRunpath
396+ quack-kernels
394397 ]
395398 ++ lib . optionals isCudaJetson [
396399 cudaPackages . autoAddCudaCompatRunpath
Original file line number Diff line number Diff line change @@ -16318,6 +16318,8 @@ self: super: with self; {
1631816318
1631916319 qtpy = callPackage ../development/python-modules/qtpy { };
1632016320
16321+ quack-kernels = callPackage ../development/python-modules/quack-kernels { };
16322+
1632116323 quadprog = callPackage ../development/python-modules/quadprog { };
1632216324
1632316325 qualysclient = callPackage ../development/python-modules/qualysclient { };
You can’t perform that action at this time.
0 commit comments