-
-
Notifications
You must be signed in to change notification settings - Fork 9
[Fix] Same Subnormal value over all platform #141
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
Conversation
I think you might have found a thread safety issue in the Dragon4 float128 printing. Here's the traceback for the segfault if I remove the mutex you added:
I'm going to try this again with a TSan build of Python to see where the first data race happens... |
Here's the race:
And indeed It looks like it is declared to be IMO adding a global mutex is not correct, we should fix this issue with the thread-local variable not being thread-local instead. |
BTW, if you want to experiment with using TSan or want to set up TSan CI, we have docker images you can use: https://github.com/nascheme/cpython_sanity |
And more docs on using TSan with Python here: https://py-free-threading.github.io/thread_sanitizer/ |
I guess in order to actually use which require some runtime checks in the meson configuration. Here's where that happens in NumPy's meson configuration: Sorry for the trouble, I didn't realize there was this wrinkle around using |
This make sense, I was thinking my code-editor is lazy that I wasn't able to see the definition of Okay I can try changing the logic of dragon4.c to work without defining a global TLS variable. |
No, please don't do that. We should just fix the meson configuration so it defines the thread-local annotation correctly. |
I think we require C11, don't we? Maybe you can just use |
I made the changes in meson and it was working as expected locally, detecting the type and setting up the macro, lets see for CI |
Okay so it seems to be expanding correctly but issue remains (after removing mutex) |
Nice, everything seems to be working with this latest push. I'd say go ahead and merge this. I would also do a bugfix release for this. |
Yeah so about that, we need to do some tweaks with meson or add explicitly in toml file, in the previous sdist - submodules, LISCENSE and sleef are not packaged. So this is causing some issues integrating with conda-forge I checked meson docs that we can define the extra things we want to include in the toml file. So we can also fix this part and then make the release |
Makes sense. I hope this has been a fun learning experience in Python Packaging for you 😀 |
I think its ready to merge now @ngoldbaum |
OK cool merging. I'm not sure if you all decided that this is a bug in SLEEF. If you think it is, it would also be awesome if one of you could report a bug to the upstream SLEEF project. |
Atleast for the 3.8 the way they defined To check in the current latest version I need to compile it and then verify whether it is same or fixed; Github code of sleef is pretty unreadable as "everything dispatches" during build time |
This PR adds the patch to provide same value of
smallest_subnormal
over all platforms with different endianess and fixes #140 .