Scipy: Fix gees calls from wasm invokes (#3960)

More fixes for scipy functions with incorrect signatures that are only called in try blocks
This commit is contained in:
Hood Chatham 2023-06-28 17:00:30 -07:00 committed by GitHub
parent c4a5090b7b
commit fb0dc034d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 70 additions and 31 deletions

View File

@ -34,6 +34,7 @@ source:
# been fixed upstream in https://github.com/scipy/scipy/pull/18124
- patches/0010-When-forward-declaring-print_soln-give-it-the-correc.patch
- patches/0011-Enable-long-double-support-in-Boost-library-for-emsc.patch
- patches/0012-Fix-gees-calls.patch
build:
cflags: |

View File

@ -1,7 +1,7 @@
From 84604f05776d4009a76f3b4374a2d6e7eaefc002 Mon Sep 17 00:00:00 2001
From 01bca73a051f2ba1a56fb9455a11d6dcecb0b034 Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Fri, 18 Mar 2022 16:25:39 -0700
Subject: [PATCH 01/11] Fix dstevr in special/lapack_defs.h
Subject: [PATCH 01/12] Fix dstevr in special/lapack_defs.h
---
scipy/special/lapack_defs.h | 5 ++---
@ -28,5 +28,5 @@ index 0d20ba1ca..d4325f71f 100644
+ w, z, ldz, isuppz, work, lwork, iwork, liwork, info);
}
--
2.34.1
2.25.1

View File

@ -1,7 +1,7 @@
From 5351793996e155d6896a778638620b18d0654bfe Mon Sep 17 00:00:00 2001
From 4f96e535431ee93d266546f41dd40096b9008a1c Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Sat, 25 Dec 2021 18:04:18 -0800
Subject: [PATCH 02/11] int to string
Subject: [PATCH 02/12] int to string
f2c does not handle implicit casts of function arguments correctly. The msg
argument of `xerrwv` is defined to be an `int *`, and then implicitly cast
@ -25,5 +25,5 @@ index 7e180e4f8..b940bb702 100644
double precision r1, r2
dimension msg(nmes)
--
2.34.1
2.25.1

View File

@ -1,7 +1,7 @@
From 6b2e65c86858f3534058b2200f12c6d7b840bf7f Mon Sep 17 00:00:00 2001
From 950ec77d888ac4a7fb528c6b3cc10ff02c468a71 Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Wed, 6 Apr 2022 21:21:53 -0700
Subject: [PATCH 03/11] fix fotran files minpack
Subject: [PATCH 03/12] fix fotran files minpack
---
scipy/optimize/minpack/chkder.f | 3 +--
@ -283,5 +283,5 @@ index 61a7928bb..05282b556 100644
double precision alpha
double precision r(ldr,n),w(n),b(n),cos(n),sin(n)
--
2.34.1
2.25.1

View File

@ -1,7 +1,7 @@
From 4e75c3153b266ae63d42a032cbc558d143bee3c9 Mon Sep 17 00:00:00 2001
From 00683380627e3df12f16c2035ba6b4bdc5518c29 Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Sat, 18 Dec 2021 11:41:15 -0800
Subject: [PATCH 04/11] gemm_ no const
Subject: [PATCH 04/12] gemm_ no const
cgemm, dgemm, sgemm, and zgemm are declared with `const` in slu_cdefs.h, but
other places don't have the cosnt causing compile errors.
@ -82,5 +82,5 @@ index abb7d937e..6c572ff2b 100644
doublecomplex*, int*);
extern int ztrsm_(char*, char*, char*, char*, int*, int*,
--
2.34.1
2.25.1

View File

@ -1,7 +1,7 @@
From bf08421e892aa528c5f89fcb94f75fe7eb41f0c3 Mon Sep 17 00:00:00 2001
From abce2808389410c0b38c0127fab12fa802a1ab91 Mon Sep 17 00:00:00 2001
From: Joe Marshall <joe.marshall@nottingham.ac.uk>
Date: Wed, 6 Apr 2022 21:25:13 -0700
Subject: [PATCH 05/11] make int return values
Subject: [PATCH 05/12] make int return values
The return values of f2c functions are insignificant in most cases, so often it
is treated as returning void, when it really should return int (values are
@ -461,5 +461,5 @@ index 66a8e9f87..81d49c3bd 100644
+c & tcaupd, tcaup2, tcaitr, tceigh, tcgets, tcapps, tcconv,
+c & tmvopx, tmvbx, tgetv0, titref, trvec
--
2.34.1
2.25.1

View File

@ -1,7 +1,7 @@
From 6f15df83c5945c9b2e65241bb38af8b71f57da52 Mon Sep 17 00:00:00 2001
From ec7665ee83d4d430b340a87e4b3061672ce02974 Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Sat, 25 Dec 2021 15:08:18 -0800
Subject: [PATCH 07/11] skip fortran fails to link
Subject: [PATCH 07/12] skip fortran fails to link
These are tests and they have both void vs int return value problems and implicit
function argument cast problems. Not worth fixing for tests.
@ -11,7 +11,7 @@ function argument cast problems. Not worth fixing for tests.
2 files changed, 9 deletions(-)
diff --git a/scipy/integrate/setup.py b/scipy/integrate/setup.py
index 1ba82d18c..dd298a480 100644
index 682f4cfb0..48976129a 100644
--- a/scipy/integrate/setup.py
+++ b/scipy/integrate/setup.py
@@ -95,12 +95,6 @@ def configuration(parent_package='',top_path=None):
@ -42,5 +42,5 @@ index 0b936ceed..bf0c16d6c 100644
config.add_subpackage('matlab')
config.add_subpackage('arff')
--
2.34.1
2.25.1

View File

@ -1,14 +1,14 @@
From 08f0d9aa483d4edf5a86b2bc822af6686265c344 Mon Sep 17 00:00:00 2001
From 9ed9022d88cb05e46b3d1aa077ba9e4d4ec740f8 Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Tue, 30 Aug 2022 10:58:25 -0700
Subject: [PATCH 08/11] Remove meson requirements
Subject: [PATCH 08/12] Remove meson requirements
---
pyproject.toml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 6dc1d4070..f09cd3138 100644
index 454a3c2e3..753b58365 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,10 +8,9 @@
@ -25,5 +25,5 @@ index 6dc1d4070..f09cd3138 100644
# https://github.com/pybind/pybind11/issues/4420
"pybind11==2.10.1",
--
2.34.1
2.25.1

View File

@ -1,7 +1,7 @@
From 39c94e7f760354d5d42e6a354ba4a184f618c31d Mon Sep 17 00:00:00 2001
From 3dc3d0fc7fa53422586c607a78e5cbf251dbfc62 Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Tue, 30 Aug 2022 11:51:53 -0700
Subject: [PATCH 09/11] Fix fitpack
Subject: [PATCH 09/12] Fix fitpack
---
scipy/interpolate/fitpack/dblint.f | 9 ++++-----
@ -84,7 +84,7 @@ index 71c57eb01..97b5851df 100644
return
end
diff --git a/scipy/interpolate/fitpack/splint.f b/scipy/interpolate/fitpack/splint.f
index f038b931b..776b06b9e 100644
index 02b00da6a..6024a0476 100644
--- a/scipy/interpolate/fitpack/splint.f
+++ b/scipy/interpolate/fitpack/splint.f
@@ -1,6 +1,5 @@
@ -95,7 +95,7 @@ index f038b931b..776b06b9e 100644
c function splint calculates the integral of a spline function s(x)
c of degree k, which is given in its normalized b-spline representation
c
@@ -52,9 +51,9 @@ c calculate the integrals wrk(i) of the normalized b-splines
@@ -54,9 +53,9 @@ c calculate the integrals wrk(i) of the normalized b-splines
c ni,k+1(x), i=1,2,...nk1.
call fpintb(t,n,wrk,nk1,a,b)
c calculate the integral of s(x).
@ -108,5 +108,5 @@ index f038b931b..776b06b9e 100644
return
end
--
2.34.1
2.25.1

View File

@ -1,7 +1,7 @@
From bb4e0d92ee2ba91ac5defd36ca5781433de25688 Mon Sep 17 00:00:00 2001
From 088146f257d89e2a73c64cddf0e4b6e4e613e3fe Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Fri, 10 Mar 2023 14:47:00 +0000
Subject: [PATCH 10/11] When forward declaring print_soln, give it the correct
Subject: [PATCH 10/12] When forward declaring print_soln, give it the correct
signature
---
@ -66,5 +66,5 @@ index df95d6fdc..7e032992d 100644
*info = 0;
Bstore = B->Store;
--
2.34.1
2.25.1

View File

@ -0,0 +1,38 @@
From f8f0f47c05c0a3dbd55c96f50724528c1073e85b Mon Sep 17 00:00:00 2001
From: Hood Chatham <roberthoodchatham@gmail.com>
Date: Mon, 26 Jun 2023 20:12:25 -0700
Subject: [PATCH 12/12] Fix gees calls
---
scipy/linalg/flapack_gen.pyf.src | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/scipy/linalg/flapack_gen.pyf.src b/scipy/linalg/flapack_gen.pyf.src
index 04037fdca..3686cea86 100644
--- a/scipy/linalg/flapack_gen.pyf.src
+++ b/scipy/linalg/flapack_gen.pyf.src
@@ -1196,8 +1196,8 @@ subroutine <prefix2c>gees(compute_v,sort_t,<prefix2c>select,n,a,nrows,sdim,w,vs,
! A = Z * T * Z^H -- a complex matrix is in Schur form if it is upper
! triangular
- callstatement (*f2py_func)((compute_v?"V":"N"),(sort_t?"S":"N"),cb_<prefix2c>select_in_gees__user__routines,&n,a,&nrows,&sdim,w,vs,&ldvs,work,&lwork,rwork,bwork,&info,1,1)
- callprotoargument char*,char*,F_INT(*)(<ctype2c>*),F_INT*,<ctype2c>*,F_INT*,F_INT*,<ctype2c>*,<ctype2c>*,F_INT*,<ctype2c>*,F_INT*,<ctype2>*,F_INT*,F_INT*,F_INT,F_INT
+ callstatement (*f2py_func)((compute_v?"V":"N"),(sort_t?"S":"N"),cb_<prefix2c>select_in_gees__user__routines,&n,a,&nrows,&sdim,w,vs,&ldvs,work,&lwork,rwork,bwork,&info)
+ callprotoargument char*,char*,F_INT(*)(<ctype2c>*),F_INT*,<ctype2c>*,F_INT*,F_INT*,<ctype2c>*,<ctype2c>*,F_INT*,<ctype2c>*,F_INT*,<ctype2>*,F_INT*,F_INT*
use gees__user__routines
@@ -1226,8 +1226,8 @@ subroutine <prefix2>gees(compute_v,sort_t,<prefix2>select,n,a,nrows,sdim,wr,wi,v
! A = Z * T * Z^H -- a real matrix is in Schur form if it is upper quasi-
! triangular with 1x1 and 2x2 blocks.
- callstatement (*f2py_func)((compute_v?"V":"N"),(sort_t?"S":"N"),cb_<prefix2>select_in_gees__user__routines,&n,a,&nrows,&sdim,wr,wi,vs,&ldvs,work,&lwork,bwork,&info,1,1)
- callprotoargument char*,char*,F_INT(*)(<ctype2>*,<ctype2>*),F_INT*,<ctype2>*,F_INT*,F_INT*,<ctype2>*,<ctype2>*,<ctype2>*,F_INT*,<ctype2>*,F_INT*,F_INT*,F_INT*,F_INT,F_INT
+ callstatement (*f2py_func)((compute_v?"V":"N"),(sort_t?"S":"N"),cb_<prefix2>select_in_gees__user__routines,&n,a,&nrows,&sdim,wr,wi,vs,&ldvs,work,&lwork,bwork,&info)
+ callprotoargument char*,char*,F_INT(*)(<ctype2>*,<ctype2>*),F_INT*,<ctype2>*,F_INT*,F_INT*,<ctype2>*,<ctype2>*,<ctype2>*,F_INT*,<ctype2>*,F_INT*,F_INT*,F_INT*
use gees__user__routines
--
2.25.1