python3Packages.mslk: init at 1.4.0

This commit is contained in:
Gaetan Lepage
2026-11-15 10:46:25 +00:00
parent 34afac60b7
commit 5fc4f40a98
2 changed files with 77 additions and 3 deletions

View File

@@ -0,0 +1,74 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
# build-system
setuptools,
# dependencies
numpy,
torch,
}:
buildPythonPackage (finalAttrs: {
pname = "mslk";
version = "1.4.0";
pyproject = true;
src = fetchFromGitHub {
owner = "meta-pytorch";
repo = "MSLK";
tag = "v${finalAttrs.version}";
hash = "sha256-/oC8FttZvJxrfNWR9LEzTeqiTtjBbuLNst/TMIsl4qU=";
};
patches = [
# Fix the triton split-K attention kernel indexing
# https://github.com/meta-pytorch/MSLK/pull/630
(fetchpatch {
name = "mslk-fix-splitk-dequantize-indexing.patch";
url = "https://github.com/meta-pytorch/MSLK/commit/eda292adf77431c3f9a16893561e9903f9b19fca.patch";
hash = "sha256-EUUAZBfSW6cEltejGn4neTZkft798LkJhaI/ygIionk=";
})
# Fix triton >= 3.9 compatibility (block pointers have been removed)
# https://github.com/meta-pytorch/MSLK/pull/619
(fetchpatch {
name = "mslk-splitk-remove-block-pointers.patch";
url = "https://github.com/meta-pytorch/MSLK/commit/78ccdcee3c3af20820a74f8abccddb0a4d84e3f8.patch";
hash = "sha256-cz5dCs8YlifhkXlvjKIWMATRf+gtP4ffFv+pto+c1wg=";
})
];
env = {
# Skip the C++/CUDA build (CMake + scikit-build) and only install the Python code.
# The native kernels are optional: the triton/flash-attention based ops work without them.
MSLK_PYTHON_ONLY = 1;
MSLK_VERSION_OVERRIDE = finalAttrs.version;
};
build-system = [
setuptools
];
dependencies = [
numpy
torch
];
pythonImportsCheck = [
"mslk"
"mslk.attention.fmha"
];
# Almost all tests require a GPU
doCheck = false;
meta = {
description = "Collection of PyTorch GPU operator libraries for GenAI training and inference";
homepage = "https://github.com/meta-pytorch/MSLK";
changelog = "https://github.com/meta-pytorch/MSLK/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
})

View File

@@ -11475,6 +11475,8 @@ self: super: with self; {
mslex = callPackage ../development/python-modules/mslex { };
mslk = callPackage ../development/python-modules/mslk { };
msmart-ng = callPackage ../development/python-modules/msmart-ng { };
msoffcrypto-tool = callPackage ../development/python-modules/msoffcrypto-tool { };
@@ -23112,9 +23114,7 @@ self: super: with self; {
xen = toPythonModule (pkgs.xen.override { python3Packages = self; });
xformers = callPackage ../development/python-modules/xformers {
inherit (pkgs.llvmPackages) openmp;
};
xformers = callPackage ../development/python-modules/xformers { };
xgboost = callPackage ../development/python-modules/xgboost { inherit (pkgs) xgboost; };