Skip to content

Conversation

@juntyr
Copy link
Contributor

@juntyr juntyr commented Jan 22, 2026

This adds recipes and CI to check that numpy-quaddtype works in Pyodide.

Pyodide currently uses an old version of numpy, and building libsleef requires some Pyodide-specific patches (we could upstream them into meson in the future), so we cannot use the simpler https://github.com/numpy/numpy/blob/main/.github/workflows/emscripten.yml yet, so instead, this is my own home-cooked, more verbose one.

@juntyr
Copy link
Contributor Author

juntyr commented Jan 22, 2026

@SwayamInSync Maybe it would be even better to upstream the SLEEF patches for Pyodide? That way, the Pyodide recipe would be patch-free (something that Pyodide is working towards as it will transition from a centralised distribution towards package authors building Pyodide wheels themselves), and this repo could have full control over the patches

@SwayamInSync
Copy link
Member

upstream the SLEEF patches for Pyodide?

Means incorporate in quaddtype's build?

@juntyr
Copy link
Contributor Author

juntyr commented Jan 22, 2026

upstream the SLEEF patches for Pyodide?

Means incorporate in quaddtype's build?

Yes, exactly! I already copied over your patch (now in the 0003-... file), so something similar but so that the patches are only applied when building for Pyodide (if that's possible)?

@SwayamInSync
Copy link
Member

In principle it is possible, but will require good work, as similar dispatching mechanism as in #62 and modifying all the patches to include a conditional flag that turns those patches ON/OFF. Also I am not sure, but there might be an ordering to apply patches.

But these all can be figured out. Once get sometime to look through the details.

diff --git a/src/libm/dispavx.c.org b/src/libm/dispavx.c.org
index 86a0148..e309af7 100644
--- a/src/libm/dispavx.c.org
+++ b/src/libm/dispavx.c.org
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I wonder 0003 patch and SLEEF's own autodetection should be enough to not dispatch these SIMD functions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh maybe its because of cross-compilation, autodetection might fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto detection doesn't exist at all in Emscripten (the instruction doesn't exist), so we need to fully patch them out, unfortunately

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Autodetection is in SLEEF, it detects the properties by compiling code via the assigned compiler (very similar to what we do)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we were talking about different detections then (compile time vs runtime). You can try it again without the patch - from what I remember, there was a link error with sleef's runtime detection, so some dispatch code must still be linked in

@SwayamInSync
Copy link
Member

Lets keep this, I'll see if I can update it post v1 release

@SwayamInSync SwayamInSync changed the title Add CI for Pyodide BUILD: Add Pyodide CI and build recipes Jan 22, 2026
@juntyr
Copy link
Contributor Author

juntyr commented Jan 22, 2026

Lets keep this, I'll see if I can update it post v1 release

That sounds like a good plan to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants