near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.31k stars 605 forks source link

NaN canonization #1987

Open MaksymZavershynskyi opened 4 years ago

MaksymZavershynskyi commented 4 years ago

This issue should be resolved by Wasmer. Once it is resolved we should enable non-x86 architectures.

MaksymZavershynskyi commented 4 years ago

Assigning low priority since most of the work is done by Wasmer.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

bowenwang1996 commented 3 years ago

@nearmax what is the status of this issue?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

bowenwang1996 commented 2 years ago

@matklad could you check whether this is still relevant?

matklad commented 2 years ago

@olonho am I correct that wasmer2 canonicalizes nans in an arch-independent way, and that we can close this after #4910 ?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

nagisa commented 2 years ago

Wasmer2's singlepass backend canonicalizes NaNs as necessary by default (though I cannot vouch for the canonicalization being exhaustive, or bug-free), making the first two points in the checklist above solved.

In response to:

Once it is resolved we should enable non-x86 architectures

singlepass supports x86_64 only, right now, so NaN canonicalization is probably the least of the blockers for this kind of feature request and probably should be tracked as a separate issue. The check in question that we have in nearcore can go away either way though, because wasmer now checks that a supported architecture is being targetted by itself.

matklad commented 2 years ago

Makes sense!

Do we have tests for nan canonicalization? This is something that might differ between runtimes (as that's not specced by WASM), so we should have tests for this on our side.

I think we have one test here:

https://github.com/near/nearcore/blob/960c4112111bc4a2f214af65c37bfa55a1552062/runtime/near-vm-runner/src/tests/runtime_errors.rs#L794-L843

But I don't think we have reinterpret based tests.

So: let's add test some time and then close this.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

matklad commented 1 year ago

cc @akhi3030 , you might want to take a look at this.