Giter Site home page Giter Site logo

Test cases about rvvm HOT 13 OPEN

elliott-wen avatar elliott-wen commented on May 22, 2024
Test cases

from rvvm.

Comments (13)

elliott-wen avatar elliott-wen commented on May 22, 2024 1

Thank you for your swift response and the test cases. I can cetainly help write an automatic script to patch riscv-test-cases.

For some background, I teach operating systems at my university and have been using v86 to run Linux on a web page. This approach allows students to write, compile, and test their kernel modules without the need for virtual machines, which can be inconvenient for certain machine such as M2.

Considering the future potential of RISC-V, I'm looking into RVVM, and I'm impressed with its code quality. My goal is to implement JIT compilation for WebAssembly in RVVM, similar to what v86 does.

The switch construct is a text-book method for intepretation. I agree with you on that. 👍

from rvvm.

LekKit avatar LekKit commented on May 22, 2024 1

V86 also implemented the virtual ethernet card, again based on virtio if I am not mistaken.

We already have an ethernet card, just that accessing internet from Emscripten is problematic and won't work without an additional public proxy

from rvvm.

LekKit avatar LekKit commented on May 22, 2024

Here is my old pack of testcases, drop them into release directory and run make test

riscv-tests.tar.gz

I will later try to figure out how to run them in CI, since you don't just compile them, you also need to define how they start, and how they report test success (In RVVM case I just patched to report to UART at 0x10000000 and poweroff via syscon at 0x00100000).
So to automate this I probably need to write an auto-patch script.

Also, what kind of JIT improvements? I'm interested, thanks for your help and keep me in touch.

I recently tried to implement FPU JIT on x86_64 locally, but the major showstopper is the need to workaround many IEEE754 shortcomings on x86_64 which make it non-compliant to RISC-V spec (Specifically canonical NaNs propagation, many lacking exceptions which need to be raised according to tests). Have a look at src/cpu/riscv_f.c for an overview of those fixups if you need.

from rvvm.

LekKit avatar LekKit commented on May 22, 2024

Also, major changes to the interpreter are expected after stable v0.6 release, so I will try to merge your work to next staging window (v0.7-git) first to prevent breaking your patches.

Basically my initial idea to decode instructions using a function table is not covering some new extensions (V, B) well and their entries collide in the decoding table with themselves or older instructions, so most likely interpreter will be rewritten to a usual switch, or something else if anyone comes with a better idea

from rvvm.

LekKit avatar LekKit commented on May 22, 2024

Ah I see, wonderful if you can manage to do that. Beware that RVJIT is mainly designed for register machines yet WASM is a stack machine, but I guess you can treat entries on stack like registers and then WASM will (hopefully) optimize that. I guess v86 should do some similar tricks and you can reuse them in RVJIT WASM backend

My further work on the interpreter also hopefully can improve WASM performance (Interpreter is important even when JIT is present, because it is used before JIT warmup)

from rvvm.

elliott-wen avatar elliott-wen commented on May 22, 2024

Thanks :D. I will play around with code and keep you posted.

The other trick is that a wasm module requires compilation before its execution.
It would be way too slow if we compile each basic block we encounter. We may need to maintain an execution counter and only if it reaches a certain threshold, we proceed to compilation.

from rvvm.

LekKit avatar LekKit commented on May 22, 2024

There are other Emscripten target limitations, see #71.

I am not very familiar with web technologies related to lazy file loading, but if someone brings info on how to implement function that: reads bytes at offset from a file on a web server, then I can implement web-backed disk images;

Also note on networking: Emscripten implementation of select() is broken, so tap_user networking won't work. We can implement some kind of TAP proxy that sends Ethernet frames over WebSocket, but it needs to be hosted somewhere.

from rvvm.

elliott-wen avatar elliott-wen commented on May 22, 2024

from rvvm.

elliott-wen avatar elliott-wen commented on May 22, 2024

Thanks for all the hard work. RVVM looks very promising.

from rvvm.

LekKit avatar LekKit commented on May 22, 2024

Good news: My new interpreter (Which I wrote locally and is still WIP) is around 2x faster on WASM/Emscripten (And marginally faster on native targets, where most useful ones have a JIT anyways). So this new interpreter hopefully will go into the new v0.7-git branch

from rvvm.

elliott-wen avatar elliott-wen commented on May 22, 2024

from rvvm.

LekKit avatar LekKit commented on May 22, 2024

The new interpreter is now in staging branch. Be aware that it's not tested widely enough to be considered production ready, but it passes riscv-tests, except for 1 privileged test which is unrelated (But I'm working on it), and it worked with every image I've thrown at it for now.

I now also provide my own fork of riscv-tests with patches for reporting results under RVVM: https://github.com/LekKit/riscv-tests. I will soon upload prebuilt test archive to releases in that repo, and implement automatic tests downloading inside the Makefile.

from rvvm.

LekKit avatar LekKit commented on May 22, 2024

Test rv64mi-p-illegal now passes. There are other new tests in my forked tree, which fail because there isn't an extension implemented which they are testing (Bitmanip, Zicbom, etc). So now that these tests exist I can begin implementing more extensions and be sure they are compliant.

from rvvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.