Skip to content
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

We compile floating-point code but can't deal with it properly #774

Open
ltratt opened this issue Jul 6, 2023 · 6 comments
Open

We compile floating-point code but can't deal with it properly #774

ltratt opened this issue Jul 6, 2023 · 6 comments
Assignees

Comments

@ltratt
Copy link
Contributor

ltratt commented Jul 6, 2023

@Pavel-Durov noticed in ykjit/yklua#19 that yklua + mandelbrot.lua crash in odd ways. There are two causes. One is an out-of-memory that isn't relevant to this issue, but another is that the benchmark uses floating point, which a) we don't seem to handle b) we let through a trace. Pavel saw this in a backtrace:

[New Thread 0x7fffee334640 (LWP 15861)]
[Thread 0x7fffee334640 (LWP 15861) exited]
[New Thread 0x7fffee334640 (LWP 15880)]
[Thread 0x7fffee334640 (LWP 15880) exited]
[New Thread 0x7fffee334640 (LWP 15925)]
[Thread 0x7fffee334640 (LWP 15925) exited]
instrinsic is missing `yk.intrinsic.inlined` metadata:   %12 = call double @llvm.floor.f64(double %10), !dbg !9033[Inferior 1 (process 15581) exited with code 01]
(gdb) bt

At the very least we should add some sort of assert/panic at JIT time when we encounter FP code, so that we don't let the program stumble on to an inevitable, and confusing, death. Ideally we'd actually fix whatever stops us handling FP stuff (@vext01 suggested we don't deal with FP registers? maybe that's the only problem?).

@Pavel-Durov perhaps you could look into the "assert/panic" fix? I suspect the wider issue will take help from @ptersilie.

@Pavel-Durov
Copy link
Contributor

"assert/panic" was added in 2a267f1
Should we close it? Or was it only partially addressed?

@ltratt
Copy link
Contributor Author

ltratt commented Aug 17, 2023

I think that's one for @ptersilie .

@ptersilie
Copy link
Contributor

I need to look into how stackmaps handle floats, since I believe deopt is what keeps this from working currently.

@vext01
Copy link
Contributor

vext01 commented Aug 18, 2023

I assume it simply reports a FP register or a normal stack slot. But we certainly don't preserve/restore the FP registers over deopt.

@Pavel-Durov
Copy link
Contributor

Related issues in yklua:
ykjit/yklua#37
ykjit/yklua#46
ykjit/yklua#47
ykjit/yklua#53
ykjit/yklua#56

@vext01
Copy link
Contributor

vext01 commented Oct 19, 2023

@Pavel-Durov @ptersilie What's the status of this one? Did we fix floats, or did I imagine it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants