-
Notifications
You must be signed in to change notification settings - Fork 290
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
Add ARMv7 as CI test target #186
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
It looks like @adam-rhebo signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
Ok, this turned out to be trickier that I initially thought. The test that fails is this one. It tests This is the implementation of the opcode and it looks like the problem is in this code: The comment mentions that it is UB to convert value such as Inf or NaN. However, it also looks like that it is UB to convert a value that is outside of range of the target type, see rust-lang/rust#10184. I briefly tried to fix it by adding explicit bounds check but it didn't help. I guess there is a chance that something else might be going on, but I don't have ARM hardware nearby nor don't have a lot of time to look into it. If you decide to fix this and bump into problems feel free to ask me questions. |
@pepyakin I had a look and I think anything that tries to detect the failed conversions using I am not completely sure, but I guess the same could be applied to |
@pepyakin I had to check the cross-compiled tests to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But otherwise seems good!
UPD: let me expand a bit. Since:
- this project more values correctness over performance
- tries to let people experiment with wider range of platforms
- use cases of paritytech don't require floats
I am inclined to trade off some performance in order to support more platforms. If anybody comes up with a better way to do this I'd be happy to merge it.
When truncating floating point values to integer values, we need to avoid undefined behavior if the argument does not fit into the target type which is currently impossible using casts of primitive types. Hence, this reimplements those conversions using arbitrary precision integers and rationals from the num crate.
Ideally, rustc will be improved after LLVM has the necessary intrinsics and we will get things like |
Yeah. But TBH I am still not sure why checking the range before casting doesn't work (as in my tentative fix). I still think that it might be possible to solve it this way. |
From my debugging, I saw that the value actually was in range, i.e. for x86-64 and arm, |
Two issues are fixed: 1. num-bigint 0.2 requires std, and is used to perform float to int conversions since wasmi-labs#186. This patch disables this change in no_std environments. This change can be reverted once num-bigint 0.3 is released, which will support no_std. 2. The `f{32,64}::fract` method is currently not implemented by core, only std. This patch uses the no_std supporting implementation from num-trait's FloatCore trait.
Two issues are fixed: 1. num-bigint 0.2 requires std, and is used to perform float to int conversions since wasmi-labs#186. This patch disables this change in no_std environments. This change can be reverted once num-bigint 0.3 is released, which will support no_std. 2. The `f{32,64}::fract` method is currently not implemented by core, only std. This patch uses the no_std supporting implementation from num-trait's FloatCore trait.
* Fix wasmi no_std support (#218) Two issues are fixed: 1. num-bigint 0.2 requires std, and is used to perform float to int conversions since #186. This patch disables this change in no_std environments. This change can be reverted once num-bigint 0.3 is released, which will support no_std. 2. The `f{32,64}::fract` method is currently not implemented by core, only std. This patch uses the no_std supporting implementation from num-trait's FloatCore trait. * Ensure wasmi builds without std in CI The no-std-check cargo subcommand uses a custom sysroot to prevent the crate from using std while checking a local target. This should help ensure that changes which introduce std dependencies are caught at review time.
This adds ARMv7 as test target for Travis CI so that issues on this 32-bit platform can be spotted immediately which should also resolve #43.
To do so, I opted to bump the CI to Xenial to avoid needing third-party repositories as everything just works using
crossbuild-essential-armhf
andqemu-user-static
on this platform.I also to install packages using
sudo apt-get
instead of the APTaddon
as the latter does not support conditional installs based on the build matrix, but I did not want to use a different installation method of the conditional and the unconditional dependencies.Note that the spec tests currently fail due to failures in
wasm_conversions
. I would be glad if someone could help me with fixing those.