erlang / otp

Erlang/OTP
http://erlang.org
Apache License 2.0
11.38k stars 2.95k forks source link

Erlang RISC-V Architecture JIT Support #7498

Open yskelg opened 1 year ago

yskelg commented 1 year ago

We can develop and test RISC-V support with official Ubuntu spported Vision Five 2 RISC-V Board.

If we add architecture support for RISC-V, First of all, I think asmjit and beam module support needed. Is that good starting point for RISC-V support?

If we need new architecture support, Can I ask is there a guide we can refer to?

jhogberg commented 1 year ago

RISC-V should already work out of the box, just not with the JIT. Have you had any issues building and running Erlang?

yskelg commented 1 year ago

@jhogberg thank you for your response. I'll build and test it on my ubuntu environment on my Vision Five 2 board to see if it works without JIT well. :) Are there any plans to support JIT for RISC-V like arm, arm64 or x86, x86_64 architecture?

yskelg commented 1 year ago

I find some discussion threads about this topic.

yskelg commented 1 year ago

@jhogberg If it works well in the ubuntu environment on my Vision Five 2 board, would it be fine to submit a documentation or build script update PR for architectural support?

yskelg commented 12 months ago

I tested erlang on real RISC-V board. It works fine!

starfive:~$ uname -ra
Linux starfive 5.15.0-starfive #1 SMP Mon Dec 19 07:56:37 EST 2022 riscv64 GNU/Linux
starfive:~$ erlang/bin/erl -noshell -eval 'io:fwrite("Hello, World!\n"), init:stop().'
Hello, World!
yskelg commented 12 months ago

@jhogberg Are there any plans to support JIT for RISC-V?

garazdawi commented 12 months ago

There are currently no plans to add RISC-V support for the JIT.

adrianbrink commented 11 months ago

What are the tradeoff of not having JIT support for RISC-V?

garazdawi commented 11 months ago

What are the tradeoff of not having JIT support for RISC-V?

Adding a new JIT backend is a lot of work and each backend adds to our maintainance burden as there is very little code that can be shared between the backends. So for a new backend to be added there needs to be a very strong usecase. Initially we had not planned to have any more than x86_64, but then apple went and changed the game by making aarch64 great again.