Skip to content

Fixes FP rounding issue and adds tests #166

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jsturtevant
Copy link
Contributor

@jsturtevant jsturtevant commented Aug 21, 2025

fixes #86

The issue was caused because cranelift compilation assume SSE2 even for the where as rust compiler doesn't include these instructions by default. This means when transitioning through wasmtime libcalls the parameters are lost since wasm is using SSE2 instructions and wasmtime isn't. The more advance SSE instructions require a separate pr in HL core that is needed to enable them.

@ludfjig
Copy link
Contributor

ludfjig commented Aug 21, 2025

Nice catch 👍 LGTM. Did you check that the tests fail without the -soft-float,+sse,+sse2?

@ludfjig
Copy link
Contributor

ludfjig commented Aug 21, 2025

Btw, I am not sure if you already have, but we should double check that we set all required cpu control registers for enabling sse,sse2. I know x86_64 assumes sse,sse2 are part base ISA, but still might need some setup. In addition, we should make sure these are reset between guest functions call to avoid any information leaks (if they aren't already).

@jsturtevant
Copy link
Contributor Author

Nice catch 👍 LGTM. Did you check that the tests fail without the -soft-float,+sse,+sse2?

Yes. Also tested this against the sample in #86 (comment)

Btw, I am not sure if you already have, but we should double check that we set all required cpu control registers for enabling sse,sse2. I know x86_64 assumes sse,sse2 are part base ISA, but still might need some setup. In addition, we should make sure these are reset between guest functions call to avoid any information leaks (if they aren't already).

These seem to be enabled in KVM (I check the mxcsr register). I haven't verified on Windows/MSVH. Maybe the best thing do here it push hyperlight-dev/hyperlight#686 forward as well.

Good call on clearing registers which will need to happen in HL, will work on a change for that.

The issue was caused becuase cranelift compilation assume SSE2 even for the  where as rust compiler doesn't include these instructions by default.  This means when transitioning through wasmtime libcalls the parameters are lost since wasm is using SSE2 instructions and wasmtime isn't. The more advance SSE intructions require a seperate pr in HL core that is needed to enable them.

Signed-off-by: James Sturtevant <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SIMD Support Seems Broken
2 participants