fix rocm and reenable ollama

This commit is contained in:
Charlotte 🦝 Delenk 2024-07-10 12:38:07 +02:00
parent a20a09a05b
commit 79ad5d96d8
3 changed files with 566 additions and 1 deletions

View file

@ -106,7 +106,7 @@
services.k3s.role = lib.mkForce "agent";
services.ollama = {
#enable = true; # broken. lol
enable = true; # broken. lol
acceleration = "rocm";
# Thank you amd for not supporting 11.0.1
environmentVariables.HCC_AMDGPU_TARGET = "gfx1100";

View file

@ -1,5 +1,17 @@
inputs: system: self: prev: let
inherit (inputs) nixpkgs element-web;
nixpkgsPatched = self.applyPatches {
name = "nixpkgs-patched";
src = inputs.nixpkgs;
patches = [./fix-rocm-python.patch];
};
python311Scope = self.lib.makeScope self.newScope (scope: {
python3 = self.python311;
python3Packages = self.python311Packages;
sphinx = scope.python3Packages.toPythonApplication scope.python3Packages.sphinx;
rocmPackages = self.recurseIntoAttrs (scope.callPackage "${nixpkgsPatched}/pkgs/development/rocm-modules/6" { });
});
common = with nixpkgs.legacyPackages.${system}; {
fcitx5-table-extra = prev.fcitx5-table-extra.overrideAttrs (super: {
patches =
@ -64,6 +76,7 @@ inputs: system: self: prev: let
bsnes-plus = self.libsForQt5.callPackage ../packages/emulator/bsnes-plus {};
sliding-sync = self.callPackage ../packages/matrix/sliding-sync {};
yiffstash = self.python3Packages.callPackage ../packages/python/yiffstash.nix {};
rocmPackages = python311Scope.rocmPackages;
};
perSystem = {
aarch64-linux = {

View file

@ -0,0 +1,552 @@
diff --git a/pkgs/development/rocm-modules/6/clr/default.nix b/pkgs/development/rocm-modules/6/clr/default.nix
index 7d80242ccbda..0619139b2933 100644
--- a/pkgs/development/rocm-modules/6/clr/default.nix
+++ b/pkgs/development/rocm-modules/6/clr/default.nix
@@ -21,7 +21,7 @@
, libGL
, libxml2
, libX11
-, python3Packages
+, python311Packages
}:
let
@@ -65,8 +65,8 @@ in stdenv.mkDerivation (finalAttrs: {
makeWrapper
cmake'
perl
- python3Packages.python
- python3Packages.cppheaderparser
+ python311Packages.python
+ python311Packages.cppheaderparser
];
buildInputs = [
diff --git a/pkgs/development/rocm-modules/6/default.nix b/pkgs/development/rocm-modules/6/default.nix
index 4d10ea244044..203883bbd8f7 100644
--- a/pkgs/development/rocm-modules/6/default.nix
+++ b/pkgs/development/rocm-modules/6/default.nix
@@ -4,7 +4,7 @@
, symlinkJoin
, fetchFromGitHub
, cudaPackages
-, python3Packages
+, python311Packages
, elfutils
, boost179
, opencv
@@ -17,7 +17,10 @@ let
rocmUpdateScript = callPackage ./update.nix { };
in rec {
## ROCm ##
- llvm = recurseIntoAttrs (callPackage ./llvm/default.nix { inherit rocmUpdateScript rocm-device-libs rocm-runtime rocm-thunk clr; });
+ llvm = recurseIntoAttrs (callPackage ./llvm/default.nix {
+ inherit rocmUpdateScript rocm-device-libs rocm-runtime rocm-thunk clr;
+ inherit (python311Packages) callPackage;
+ });
rocm-core = callPackage ./rocm-core {
inherit rocmUpdateScript;
@@ -34,7 +37,7 @@ in rec {
stdenv = llvm.rocmClangStdenv;
};
- rocm-smi = python3Packages.callPackage ./rocm-smi {
+ rocm-smi = python311Packages.callPackage ./rocm-smi {
inherit rocmUpdateScript;
stdenv = llvm.rocmClangStdenv;
};
@@ -77,7 +80,7 @@ in rec {
# stdenv = llvm.rocmClangStdenv;
};
- rocm-docs-core = python3Packages.callPackage ./rocm-docs-core { inherit stdenv; };
+ rocm-docs-core = python311Packages.callPackage ./rocm-docs-core { inherit stdenv; };
hip-common = callPackage ./hip-common {
inherit rocmUpdateScript;
@@ -187,7 +190,7 @@ in rec {
stdenv = llvm.rocmClangStdenv;
};
- tensile = python3Packages.callPackage ./tensile {
+ tensile = python311Packages.callPackage ./tensile {
inherit rocmUpdateScript rocminfo;
stdenv = llvm.rocmClangStdenv;
};
diff --git a/pkgs/development/rocm-modules/6/llvm/base.nix b/pkgs/development/rocm-modules/6/llvm/base.nix
index caa2ebe42823..9cdc1cad1dbb 100644
--- a/pkgs/development/rocm-modules/6/llvm/base.nix
+++ b/pkgs/development/rocm-modules/6/llvm/base.nix
@@ -17,7 +17,7 @@
, mpfr
, zlib
, ncurses
-, python3Packages
+, python311Packages
, buildDocs ? true
, buildMan ? true
, buildTests ? true
@@ -86,11 +86,11 @@ in stdenv.mkDerivation (finalAttrs: {
cmake
ninja
git
- python3Packages.python
+ python311Packages.python
] ++ lib.optionals (buildDocs || buildMan) [
doxygen
sphinx
- python3Packages.recommonmark
+ python311Packages.recommonmark
] ++ lib.optionals (buildTests && !finalAttrs.passthru.isLLVM) [
lit
] ++ extraNativeBuildInputs;
diff --git a/pkgs/development/rocm-modules/6/llvm/stage-2/libcxx.nix b/pkgs/development/rocm-modules/6/llvm/stage-2/libcxx.nix
index 473227242765..121ab3033ca7 100644
--- a/pkgs/development/rocm-modules/6/llvm/stage-2/libcxx.nix
+++ b/pkgs/development/rocm-modules/6/llvm/stage-2/libcxx.nix
@@ -6,6 +6,7 @@
callPackage ../base.nix rec {
inherit stdenv rocmUpdateScript;
buildMan = false; # No man pages to build
+ buildTests = false;
targetName = "libcxx";
targetDir = "runtimes";
diff --git a/pkgs/development/rocm-modules/6/llvm/stage-3/flang.nix b/pkgs/development/rocm-modules/6/llvm/stage-3/flang.nix
index 421663dcb1b7..d596ddd67c9e 100644
--- a/pkgs/development/rocm-modules/6/llvm/stage-3/flang.nix
+++ b/pkgs/development/rocm-modules/6/llvm/stage-3/flang.nix
@@ -4,7 +4,7 @@
, clang-unwrapped
, mlir
, graphviz
-, python3Packages
+, python311Packages
}:
callPackage ../base.nix rec {
@@ -14,7 +14,7 @@ callPackage ../base.nix rec {
extraNativeBuildInputs = [
graphviz
- python3Packages.sphinx-markdown-tables
+ python311Packages.sphinx-markdown-tables
];
extraBuildInputs = [ mlir ];
diff --git a/pkgs/development/rocm-modules/6/llvm/stage-3/lldb.nix b/pkgs/development/rocm-modules/6/llvm/stage-3/lldb.nix
index 9b7d25e06d9d..7a8e1b0b6ee1 100644
--- a/pkgs/development/rocm-modules/6/llvm/stage-3/lldb.nix
+++ b/pkgs/development/rocm-modules/6/llvm/stage-3/lldb.nix
@@ -7,7 +7,7 @@
, lua5_3
, graphviz
, gtest
-, python3Packages
+, python311Packages
}:
callPackage ../base.nix rec {
@@ -15,7 +15,7 @@ callPackage ../base.nix rec {
buildTests = false; # FIXME: Bad pathing for clang executable in tests, using relative path most likely
targetName = "lldb";
targetDir = targetName;
- extraNativeBuildInputs = [ python3Packages.sphinx-automodapi ];
+ extraNativeBuildInputs = [ python311Packages.sphinx-automodapi ];
extraBuildInputs = [
xz
diff --git a/pkgs/development/rocm-modules/6/migraphx/default.nix b/pkgs/development/rocm-modules/6/migraphx/default.nix
index 4cc2e4bd24b3..0dd6fe155bcc 100644
--- a/pkgs/development/rocm-modules/6/migraphx/default.nix
+++ b/pkgs/development/rocm-modules/6/migraphx/default.nix
@@ -26,7 +26,7 @@
, sphinx
, docutils
, ghostscript
-, python3Packages
+, python311Packages
, buildDocs ? false
, buildTests ? false
, gpuTargets ? clr.gpuTargets
@@ -71,15 +71,15 @@ in stdenv.mkDerivation (finalAttrs: {
rocm-cmake
clr
clang-tools-extra
- python3Packages.python
+ python311Packages.python
] ++ lib.optionals buildDocs [
latex
doxygen
sphinx
docutils
ghostscript
- python3Packages.sphinx-rtd-theme
- python3Packages.breathe
+ python311Packages.sphinx-rtd-theme
+ python311Packages.breathe
];
buildInputs = [
@@ -96,8 +96,8 @@ in stdenv.mkDerivation (finalAttrs: {
oneDNN_2
blaze
cppcheck
- python3Packages.pybind11
- python3Packages.onnx
+ python311Packages.pybind11
+ python311Packages.onnx
];
cmakeFlags = [
diff --git a/pkgs/development/rocm-modules/6/miopen/default.nix b/pkgs/development/rocm-modules/6/miopen/default.nix
index 0b57cf6592cb..899504be77c8 100644
--- a/pkgs/development/rocm-modules/6/miopen/default.nix
+++ b/pkgs/development/rocm-modules/6/miopen/default.nix
@@ -28,7 +28,7 @@
, gtest
, rocm-comgr
, roctracer
-, python3Packages
+, python311Packages
, buildDocs ? false # Needs internet because of rocm-docs-core
, buildTests ? false
}:
@@ -156,9 +156,9 @@ in stdenv.mkDerivation (finalAttrs: {
doxygen
sphinx
rocm-docs-core
- python3Packages.sphinx-rtd-theme
- python3Packages.breathe
- python3Packages.myst-parser
+ python311Packages.sphinx-rtd-theme
+ python311Packages.breathe
+ python311Packages.myst-parser
] ++ lib.optionals buildTests [
gtest
zlib
diff --git a/pkgs/development/rocm-modules/6/mivisionx/default.nix b/pkgs/development/rocm-modules/6/mivisionx/default.nix
index 8459dff1c892..94af55aed3ba 100644
--- a/pkgs/development/rocm-modules/6/mivisionx/default.nix
+++ b/pkgs/development/rocm-modules/6/mivisionx/default.nix
@@ -23,7 +23,7 @@
, lmdb
, rapidjson
, rocm-docs-core
-, python3Packages
+, python311Packages
, useOpenCL ? false
, useCPU ? false
, buildDocs ? false # Needs internet
@@ -57,7 +57,7 @@ stdenv.mkDerivation (finalAttrs: {
pkg-config
] ++ lib.optionals buildDocs [
rocm-docs-core
- python3Packages.python
+ python311Packages.python
];
buildInputs = [
@@ -75,9 +75,9 @@ stdenv.mkDerivation (finalAttrs: {
libjpeg_turbo
lmdb
rapidjson
- python3Packages.pybind11
- python3Packages.numpy
- python3Packages.torchWithRocm
+ python311Packages.pybind11
+ python311Packages.numpy
+ python311Packages.torchWithRocm
];
cmakeFlags = [
@@ -121,7 +121,7 @@ stdenv.mkDerivation (finalAttrs: {
'';
postBuild = lib.optionalString buildDocs ''
- python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html
+ python311 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html
'';
postInstall = lib.optionalString (!useOpenCL && !useCPU) ''
diff --git a/pkgs/development/rocm-modules/6/rocblas/default.nix b/pkgs/development/rocm-modules/6/rocblas/default.nix
index f93cceddd68a..a972019604c4 100644
--- a/pkgs/development/rocm-modules/6/rocblas/default.nix
+++ b/pkgs/development/rocm-modules/6/rocblas/default.nix
@@ -7,7 +7,7 @@
, cmake
, rocm-cmake
, clr
-, python3
+, python311
, tensile
, msgpack
, libxml2
@@ -15,7 +15,7 @@
, gfortran
, openmp
, amd-blis
-, python3Packages
+, python311Packages
, buildTensile ? true
, buildTests ? false
, buildBenchmarks ? false
@@ -68,12 +68,12 @@ stdenv.mkDerivation (finalAttrs: {
];
buildInputs = [
- python3
+ python311
] ++ lib.optionals buildTensile [
msgpack
libxml2
- python3Packages.msgpack
- python3Packages.joblib
+ python311Packages.msgpack
+ python311Packages.joblib
] ++ lib.optionals buildTests [
gtest
] ++ lib.optionals (buildTests || buildBenchmarks) [
@@ -81,13 +81,13 @@ stdenv.mkDerivation (finalAttrs: {
openmp
amd-blis
] ++ lib.optionals (buildTensile || buildTests || buildBenchmarks) [
- python3Packages.pyyaml
+ python311Packages.pyyaml
];
cmakeFlags = [
(lib.cmakeFeature "CMAKE_C_COMPILER" "hipcc")
(lib.cmakeFeature "CMAKE_CXX_COMPILER" "hipcc")
- (lib.cmakeFeature "python" "python3")
+ (lib.cmakeFeature "python" "python311")
(lib.cmakeFeature "AMDGPU_TARGETS" (lib.concatStringsSep ";" gpuTargets))
(lib.cmakeBool "BUILD_WITH_TENSILE" buildTensile)
(lib.cmakeBool "ROCM_SYMLINK_LIBS" false)
diff --git a/pkgs/development/rocm-modules/6/rocfft/default.nix b/pkgs/development/rocm-modules/6/rocfft/default.nix
index 9fd1f02398b3..d27b23723cc5 100644
--- a/pkgs/development/rocm-modules/6/rocfft/default.nix
+++ b/pkgs/development/rocm-modules/6/rocfft/default.nix
@@ -5,7 +5,7 @@
, rocmUpdateScript
, cmake
, clr
-, python3
+, python311
, rocm-cmake
, sqlite
, boost
@@ -31,7 +31,7 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
cmake
clr
- python3
+ python311
rocm-cmake
];
@@ -100,7 +100,7 @@ stdenv.mkDerivation (finalAttrs: {
boost
finalAttrs.finalPackage
openmp
- (python3.withPackages (ps: with ps; [
+ (python311.withPackages (ps: with ps; [
pandas
scipy
]))
diff --git a/pkgs/development/rocm-modules/6/rocgdb/default.nix b/pkgs/development/rocm-modules/6/rocgdb/default.nix
index 2112c6cf0210..4f98b7889556 100644
--- a/pkgs/development/rocm-modules/6/rocgdb/default.nix
+++ b/pkgs/development/rocm-modules/6/rocgdb/default.nix
@@ -13,7 +13,7 @@
, ncurses
, expat
, rocdbgapi
-, python3
+, python311
, babeltrace
, sourceHighlight
}:
@@ -43,7 +43,7 @@ stdenv.mkDerivation (finalAttrs: {
ncurses
expat
rocdbgapi
- python3
+ python311
babeltrace
sourceHighlight
];
@@ -56,7 +56,7 @@ stdenv.mkDerivation (finalAttrs: {
"--with-iconv-path=${glibc.bin}"
"--enable-tui"
"--with-babeltrace"
- "--with-python=python3"
+ "--with-python=python311"
"--with-system-zlib"
"--enable-64-bit-bfd"
"--with-gmp=${gmp.dev}"
diff --git a/pkgs/development/rocm-modules/6/rocminfo/default.nix b/pkgs/development/rocm-modules/6/rocminfo/default.nix
index cb1df3f1fd43..8a1523c966a8 100644
--- a/pkgs/development/rocm-modules/6/rocminfo/default.nix
+++ b/pkgs/development/rocm-modules/6/rocminfo/default.nix
@@ -6,7 +6,7 @@
, rocm-cmake
, rocm-runtime
, busybox
-, python3
+, python311
, gnugrep
# rocminfo requires that the calling user have a password and be in
# the video group. If we let rocm_agent_enumerator rely upon
@@ -34,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: {
];
buildInputs = [ rocm-runtime ];
- propagatedBuildInputs = [ python3 ];
+ propagatedBuildInputs = [ python311 ];
cmakeFlags = [ "-DROCRTST_BLD_TYPE=Release" ];
prePatch = ''
diff --git a/pkgs/development/rocm-modules/6/rocmlir/default.nix b/pkgs/development/rocm-modules/6/rocmlir/default.nix
index d8747009a10e..362bf644a3a6 100644
--- a/pkgs/development/rocm-modules/6/rocmlir/default.nix
+++ b/pkgs/development/rocm-modules/6/rocmlir/default.nix
@@ -13,7 +13,7 @@
, zstd
, zlib
, ncurses
-, python3Packages
+, python311Packages
, buildRockCompiler ? false
, buildTests ? false # `argument of type 'NoneType' is not iterable`
}:
@@ -53,8 +53,8 @@ in stdenv.mkDerivation (finalAttrs: {
rocm-cmake
ninja
clr
- python3Packages.python
- python3Packages.tomli
+ python311Packages.python
+ python311Packages.tomli
];
buildInputs = [
diff --git a/pkgs/development/rocm-modules/6/rocprofiler/default.nix b/pkgs/development/rocm-modules/6/rocprofiler/default.nix
index ca6291992d85..1efa3c950d45 100644
--- a/pkgs/development/rocm-modules/6/rocprofiler/default.nix
+++ b/pkgs/development/rocm-modules/6/rocprofiler/default.nix
@@ -21,7 +21,7 @@
, mpi
, systemd
, gtest
-, python3Packages
+, python311Packages
, gpuTargets ? clr.gpuTargets
}:
@@ -73,11 +73,11 @@ in stdenv.mkDerivation (finalAttrs: {
cmake
clang
clr
- python3Packages.lxml
- python3Packages.cppheaderparser
- python3Packages.pyyaml
- python3Packages.barectf
- python3Packages.pandas
+ python311Packages.lxml
+ python311Packages.cppheaderparser
+ python311Packages.pyyaml
+ python311Packages.barectf
+ python311Packages.pandas
];
buildInputs = [
diff --git a/pkgs/development/rocm-modules/6/rocsparse/default.nix b/pkgs/development/rocm-modules/6/rocsparse/default.nix
index 2a1043b33c05..775e841bd5b3 100644
--- a/pkgs/development/rocm-modules/6/rocsparse/default.nix
+++ b/pkgs/development/rocm-modules/6/rocsparse/default.nix
@@ -11,7 +11,7 @@
, git
, gtest
, boost
-, python3Packages
+, python311Packages
, buildTests ? false
, buildBenchmarks ? false # Seems to depend on tests
, gpuTargets ? [ ]
@@ -49,8 +49,8 @@ stdenv.mkDerivation (finalAttrs: {
] ++ lib.optionals (buildTests || buildBenchmarks) [
gtest
boost
- python3Packages.python
- python3Packages.pyyaml
+ python311Packages.python
+ python311Packages.pyyaml
];
cmakeFlags = [
@@ -65,7 +65,7 @@ stdenv.mkDerivation (finalAttrs: {
] ++ lib.optionals (buildTests || buildBenchmarks) [
"-DBUILD_CLIENTS_TESTS=ON"
"-DCMAKE_MATRICES_DIR=/build/source/matrices"
- "-Dpython=python3"
+ "-Dpython=python311"
] ++ lib.optionals buildBenchmarks [
"-DBUILD_CLIENTS_BENCHMARKS=ON"
];
diff --git a/pkgs/development/rocm-modules/6/roctracer/default.nix b/pkgs/development/rocm-modules/6/roctracer/default.nix
index 2523a9ab5330..d50b72c762b5 100644
--- a/pkgs/development/rocm-modules/6/roctracer/default.nix
+++ b/pkgs/development/rocm-modules/6/roctracer/default.nix
@@ -11,7 +11,7 @@
, gcc-unwrapped
, libbacktrace
, rocm-runtime
-, python3Packages
+, python311Packages
, buildDocs ? false # Nothing seems to be generated, so not making the output
, buildTests ? false
}:
@@ -46,8 +46,8 @@ stdenv.mkDerivation (finalAttrs: {
buildInputs = [
libxml2
libbacktrace
- python3Packages.python
- python3Packages.cppheaderparser
+ python311Packages.python
+ python311Packages.cppheaderparser
];
cmakeFlags = [
diff --git a/pkgs/development/rocm-modules/6/rpp/default.nix b/pkgs/development/rocm-modules/6/rpp/default.nix
index 239c99017d02..abd3dbad0106 100644
--- a/pkgs/development/rocm-modules/6/rpp/default.nix
+++ b/pkgs/development/rocm-modules/6/rpp/default.nix
@@ -9,7 +9,7 @@
, clr
, openmp
, boost
-, python3Packages
+, python311Packages
, buildDocs ? false # Needs internet
, useOpenCL ? false
, useCPU ? false
@@ -38,7 +38,7 @@ stdenv.mkDerivation (finalAttrs: {
clr
] ++ lib.optionals buildDocs [
rocm-docs-core
- python3Packages.python
+ python311Packages.python
];
buildInputs = [
@@ -68,7 +68,7 @@ stdenv.mkDerivation (finalAttrs: {
'';
postBuild = lib.optionalString buildDocs ''
- python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html
+ python311 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html
'';
passthru.updateScript = rocmUpdateScript {