{ lib, buildPythonPackage, fetchurl, # dependencies numpy, numba, # torch-bin (CUDA wheel build) and triton-bin are passed by the caller; # the python scope defaults are the source-built torch (CPU-only) and # triton — using them would duplicate torch/triton in the closure. torch, triton, tqdm, }: buildPythonPackage rec { pname = "flashlib"; version = "0.3.0"; format = "wheel"; src = fetchurl { url = "https://files.pythonhosted.org/packages/e5/b8/4c085892462e521bb9f2d943ff34fa219e3a5a206798f3c96a983538039f/flashlib-0.3.0-py3-none-any.whl"; hash = "sha256-kDeRHzFf7zyfRFMmFZc2Ory4OGiBOtGyWKsTCLNP0Ro="; }; # freetoken pins flashlib==0.3.0 (not in nixpkgs) and only uses its Triton # kernels (flashlib.kernels.slot_cache). nvidia-cutlass-dsl — needed only by # the CuTeDSL GEMM backends in flashlib.linalg, which drag in cuda-python and # nvdisasm binary wheels — is deliberately not packaged (and removed from # the wheel metadata so the runtime deps check passes). pythonRemoveDeps = [ "nvidia-cutlass-dsl" ]; dependencies = [ numpy numba torch triton tqdm ]; # flashlib is CPU-safe at import time: CuteDSL imports are lazy and hardware # detection (flashlib._hw) is cuda-optional. pythonImportsCheck = [ "flashlib" ]; meta = { description = "High-performance ML primitives — Triton and CuteDSL kernels for NVIDIA GPUs"; homepage = "https://pypi.org/project/flashlib/"; license = lib.licenses.asl20; platforms = lib.platforms.linux; }; }