Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openblas: Enable loongarch64-linux #229073

Merged
merged 2 commits into from
May 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion pkgs/development/libraries/science/math/openblas/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, perl, which
{ lib, stdenv, fetchFromGitHub, fetchpatch, perl, which
# Most packages depending on openblas expect integer width to match
# pointer width, but some expect to use 32-bit integers always
# (for compatibility with reference BLAS).
Expand Down Expand Up @@ -106,6 +106,13 @@ let
DYNAMIC_ARCH = setDynamicArch false;
USE_OPENMP = true;
};

loongarch64-linux = {
BINARY = 64;
TARGET = setTarget "LOONGSONGENERIC";
DYNAMIC_ARCH = setDynamicArch false;
USE_OPENMP = true;
};
};
in

Expand Down Expand Up @@ -145,6 +152,15 @@ stdenv.mkDerivation rec {
sha256 = "sha256-F6cXPqQai4kA5zrsa8E0Q7dD9zZHlwZ+B16EOGNXoXs=";
};

patches = lib.optionals stdenv.hostPlatform.isLoongArch64 [
# https://github.com/xianyi/OpenBLAS/pull/3626
(fetchpatch {
name = "openblas-0.3.21-fix-loong.patch";
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sci-libs/openblas/files/openblas-0.3.21-fix-loong.patch?id=37ee4c70278eb41181f69e175575b0152b941655";
hash = "sha256-iWy11l3wEvzNV08LbhOjnSPj1SjPH8RMnb3ORz7V+gc";
})
];

postPatch = ''
# cc1: error: invalid feature modifier 'sve2' in '-march=armv8.5-a+sve+sve2+bf16'
substituteInPlace Makefile.arm64 --replace "+sve2+bf16" ""
Expand Down