-
Notifications
You must be signed in to change notification settings - Fork 1
Add riscv-wamr-qemu platform #3
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
Conversation
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.
Thanks! wamr was the last approach for converting C to riscv -- does this work with out of the box with Golang programs (or maybe you could say what is missing such that only TinyGo works right now)?
cc @marcinbugaj for visibility
|
No worries! I'm getting a lot of obscure errors mostly about memory. Maybe it's just a problem in the linker script so that TinyGo works more easily because of the lower footprint. (I've already tried increasing memory) Also a lot of platform functions only have a rudimentary implementation at the moment By the way, I've also seen the hint in the README, during the development I also had similar relocation errors. Although these don't appear with the current parameters |
|
I added a few more improvements, so for now at least basic Go programs work out-of-the-box. Although I noticed that the stateless example depends on |
|
@psilva261 , I'm curious if it's possible "stateless.wasm" with WAMR used in this line: Line 11 in 4972113
|
@marcinbugaj To be precise the WAMR setup isn't doing the C compilation step. Instead there's the LLVM-based AOT step with So compiling it with takes half an hour (with Then it takes just 3 minutes but there's a fatal error when returning from And for running I get: Or directly: I'm not sure how much sense this output already makes, but just to give an update. I wonder what's the best way to call |
|
The results from running The result from I'll try to get number of instructions executed with |
|
Awesome, I see that makes sense |
|
In this Dockerfile there is COPY directive but the recent main changed from: to to avoid sending possibly multi GB context to docker daemon. Could you please address that problem in this PR? |
|
When I run the program hangs spinning at the end at Could that be fixed? Without that it will be difficult to measure number of cpu cycles with |
|
With the most most recent changes from 553bdce I tried to build the When I run: I got: and program hangs. Is that a known issue? Is it possible to compile the program with 03 optimizations? The same happens with O1. |
* Compile wamrc from source * Use LLVM 19 in wamrc
|
The OpenSBI BIOS (
I didn't know the issue is still there. At least now LLVM 20 is referenced which in theory supports code model large. Although more changes would be needed to get it working
The WAMR code is now cloned from a separate repo |
|
I was able to get the output of libinsn.so by using the following options: The option The tail of the log is: So the measurements on my machine with the Interestingly enough libinsn.so reported 5e9 which is consistent with your measurement methodology on your machine. I'd be grateful if you could in the scope of this PR add the steps for wamr compilation and profiling with libinsn.so to go_benchmark.sh. Also please update the go benchmarks section in the README.md. It's worth mentioning that the compilation is with -O0 and that higher optimization levels don't work with wamr. So far it seams that wasmtime and wasmer with cranelift are the fastest being "only" ~3.5 times slower than the direct compilation from Go to RV64. |
Are you aware of an existing issue for that problem in https://github.com/bytecodealliance/wasm-micro-runtime/issues ? If not perhaps it makes sense to create one. In the end WAMR with O3 would be rather crucial for the aforementioned benchmarks. |
|
Yeah the measurement using There are open PRs to upgrade LLVM but that's blocked by problems with the xtensa platform... bytecodealliance/wasm-micro-runtime#4213 (LLVM 19 is needed to fix the compile times) I've seen problems with RISC-V 64 mentioned in the project though
But yeah, I can create a specific ticket regarding the optimization and update the PR. |
|
@kevaundray , @psilva261 is this PR ready to be merged? |
|
From my side this covers all points I have currently open for WAMR AOT support. There's also an update in the WAMR ticket and luckily help was offered, so it might make sense to do follow-up works outside of this PR. Of course WAMR is quite open ended with all the possible features. Some things which can be interesting:
By the way, the WAMR fork referenced from the Dockerfile is also currently in my own namespace: https://github.com/psilva261/wasm-micro-runtime-zkvm (Platform support for baremetal RISC-V, LLVM 20, missing symbols, build file) |
|
That's a massive amount of work and I'd be grateful if you could merge the PR. The follow up work could be covered by subsequent PRs |
|
Awesome, thanks a lot! |
This is still very much in the proof-of-concept state and only TinyGo is an option at this point