-
Notifications
You must be signed in to change notification settings - Fork 37
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
spork build fails on Windows ARM #209
Comments
AFAIK, I don't have access to appropriate hardware to make a direct investigation. May be there's some kind of qemu-based solution that could work (though it seems like it could be rather slow)... I found the following, but may be others know of better resources or approaches? |
I think you can reproduce this on Windows and Linux on x86_64. In If I change the #ifdef conditions (like below) to force the fallback code to run on x86_64 Windows, I get the same hang in the math tests. #elif defined(_WIN64) && defined(_MSC_VER) && defined(FOO) On Linux x86_64. Change the first #ifdef #if defined(__SIZEOF_INT128__) && defined(FOO)
and the math tests will hang there as well. |
I don't either (^^; IIUC, @primo-ppcg wrote nearly all of the code in [1] Hmm, does the |
Having recently acquired a Snapdragon X Elite laptop, I have found myself running into the same issue. Following in the footsteps of @rwtolbert, I too ended up with the infinite loop as a result of the test suite, with the code hanging in For q=586101, x=915963, y=501852, and n=1530787, I then compared the output of what I then tried to find some good references online for performing the calculation, and ended up at https://stackoverflow.com/questions/20971888/modular-multiplication-of-large-numbers-in-c. I noticed the answer by Kevin Hopps towards the end was very similar to the implementation in spork, but it uses a helper So I put these two functions in instead of the original
I don't know if the performance is very much impacted or not by this change. I also couldn't say with 100% certainty that it will be correct for any given input, as I haven't quite digested the algorithm yet. Edit: removed an unused variable |
@chamaeleon Thanks for the fix, this looks like something we may want to merge. However, really there are two issues here - spork not building correctly on Windows arm, and the bad _mulmod_impl function. For the nan issue, I think we don't actually need the _MSC_VER check: Janet wrap_nan() {
#ifdef NAN
return janet_wrap_number(NAN);
#else
return janet_wrap_number(0.0 / 0.0);
#endif
} should work for all platforms we support (this is actually how |
Using fix from Lars Nilsson with a helper function for _add_impl. This also slightly modifies wrap_nan() to not check for _MSC_VER
For NaN,
I used |
As for the error when compiling |
@chamaeleon Thanks for having a look at this. I too tried to find an alternate implementation for that As for the |
Using the
Edit: given the state of |
The
|
Trying to build spork on Windows ARM64 using MSVC runs into a couple of problems.
this error occurs in this code, which assumes
_MSC_VER
uses NAN boxing regardless of platform.so as an experiment, let's build a new version of Janet with NAN box ON on ARM64 Windows. Small change in
janet.h
and rebuild Janet.then use this new Janet to build spork:
Ok, this is progress, but we hit this new problem. These two symbols are x86_64 intrinsics, not available on Arm. But
cmath.c
has some fallback code for_mulmod_impl
so let's change the macro to skip the x86_64 intrinsics on Arm.with that change in place, spork will now build
But we have a new problem. The math tests hang in an infinite loop. The code
_molmod_impl
covered by the#else
never converges.This made me wonder about the fallback code on other platforms. As a further experiment, changing the macro to run the fall-back
_mulmod_impl
on Linux, causes the math tests to hang there as well. So, I think there is something awry with that code, but I don't know enough to understand it.The text was updated successfully, but these errors were encountered: