File tree Expand file tree Collapse file tree 5 files changed +95
-0
lines changed
pkgs/python-modules/tvm-ffi Expand file tree Collapse file tree 5 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 2222 ++ allOutputs build2cmake
2323 ++ allOutputs kernel-abi-check
2424 ++ allOutputs python3Packages . kernels
25+ ++ allOutputs python3Packages . tvm-ffi
2526 ++ lib . optionals stdenv . hostPlatform . isLinux ( allOutputs stdenvGlibc_2_27 )
2627 ) ;
2728 buildSetLinkFarm = buildSet : pkgs . linkFarm buildSet . torch . variant ( buildSetOutputs buildSet ) ;
Original file line number Diff line number Diff line change 169169 tabulate
170170 tomlkit
171171 torch
172+ tvm-ffi
172173 types-pyyaml
173174 types-requests
174175 types-tabulate
Original file line number Diff line number Diff line change 109109 torchVersion = "2.9" ;
110110 xpuPackages = final . xpuPackages_2025_2 ;
111111 } ;
112+
113+ tvm-ffi = callPackage ./pkgs/python-modules/tvm-ffi {
114+ } ;
112115 }
113116 )
114117 ( import ./pkgs/python-modules/hooks )
Original file line number Diff line number Diff line change 1+ {
2+ callPackage ,
3+ buildPythonPackage ,
4+ fetchFromGitHub ,
5+
6+ cmake ,
7+ cython ,
8+ ninja ,
9+ python ,
10+ scikit-build-core ,
11+ setuptools-scm ,
12+ } :
13+
14+ buildPythonPackage rec {
15+ pname = "tvm-ffi" ;
16+ version = "0.1.9" ;
17+ pyproject = true ;
18+
19+ src = fetchFromGitHub {
20+ owner = "apache" ;
21+ repo = "tvm-ffi" ;
22+ rev = "v${ version } " ;
23+ hash = "sha256-XnlM//WW2TbjbmzYBq6itJQ7R3J646UMVQUVhV5Afwc=" ;
24+ fetchSubmodules = true ;
25+ } ;
26+
27+ build-system = [
28+ cmake
29+ cython
30+ ninja
31+ scikit-build-core
32+ setuptools-scm
33+ ] ;
34+
35+ dontUseCmakeConfigure = true ;
36+
37+ postInstall = ''
38+ ln -s $out/${ python . sitePackages } /tvm_ffi/share $out/share
39+ '' ;
40+
41+ passthru = callPackage ./variant.nix {
42+ tvmFfiVersion = version ;
43+ } ;
44+ }
Original file line number Diff line number Diff line change 1+ {
2+ config ,
3+ cudaSupport ? config . cudaSupport ,
4+ metalSupport ? config . metalSupport or false ,
5+ rocmSupport ? config . rocmSupport ,
6+ xpuSupport ? config . xpuSupport or false ,
7+
8+ cudaPackages ,
9+ rocmPackages ,
10+ xpuPackages ,
11+
12+ lib ,
13+ stdenv ,
14+
15+ tvmFfiVersion ,
16+ } :
17+
18+ let
19+ flattenVersion =
20+ version : lib . replaceStrings [ "." ] [ "" ] ( lib . versions . majorMinor ( lib . versions . pad 2 version ) ) ;
21+ backend =
22+ if cudaSupport then
23+ "cuda"
24+ else if metalSupport then
25+ "metal"
26+ else if rocmSupport then
27+ "rocm"
28+ else if xpuSupport then
29+ "xpu"
30+ else
31+ "cpu" ;
32+ computeString =
33+ if cudaSupport then
34+ "cu${ flattenVersion cudaPackages . cudaMajorMinorVersion } "
35+ else if metalSupport then
36+ "metal"
37+ else if rocmSupport then
38+ "rocm${ flattenVersion ( lib . versions . majorMinor rocmPackages . rocm . version ) } "
39+ else if xpuSupport then
40+ "xpu${ flattenVersion ( lib . versions . majorMinor xpuPackages . oneapi-torch-dev . version ) } "
41+ else
42+ "cpu" ;
43+ in
44+ {
45+ variant = "tvm-ffi${ flattenVersion ( lib . versions . majorMinor tvmFfiVersion ) } -${ computeString } -${ stdenv . hostPlatform . system } " ;
46+ }
You can’t perform that action at this time.
0 commit comments