Closed jdroob closed 7 months ago
OK, cool! This sounds ambitious, but I think you can make it work. :smiley:
Here are a few questions I think will be important for this project's eval:
print
(and if so, how)? How about function calls?Please try to answer these questions within, say, ~1 week so we can agree on how to approach stuff here. I'm particularly interested in knowing that y'all have a RISC-V emulator up and running that you think will work for your purposes.
print
but we need to look further into the implementation details on how to accomplish this. I'm currently looking into this post for implementation details on how to print to screen in RISC-V assembly.OK, sounds good!
To be clear, if you want to try to reuse LLVM's register allocator, this has profound implications for the project: namely, you will not be generating RISC-V assembly. Your options include generating LLVM IR (which would be completely target-agnostic and not specific to RISC-V at all) or generating the LLVM MachineInstr
IR (which sounds interesting but I have no idea what it would entail). I can't see a way to reuse LLVM's register allocator without reusing its code generator.
Including a link to the project repo
What will you do?
We will develop a system for lowering Bril programs to RISC-V assembly code, enabling the execution of Bril programs in a RISC-V environment. We will also focus on verifying the accuracy and correctness of this lowering system.
How will you do it?
To achieve this goal, we will do the following:
Familiarization: We will better acquaint ourselves with both the Bril language and the RISC-V architecture. One team member is actively working on implementing a RISC-V processor in Verilog for another course, and we feel as though we have a solid foundation in Bril. However, we will dive deeper into both before we begin implementation.
Lowering Design: We will design a system for lowering Bril instructions into RISC-V assembly code. Initially, our focus will be on creating a minimum viable implementation. In this phase, we will use a 1-to-N approach, where one Bril instruction corresponds to multiple RISC-V instructions. This basic version will serve as our foundation.
Optimization (Stretch Goal): If time permits, we will explore an M-to-N approach. This strategy will involve optimizing the translation by recognizing dependencies between multiple Bril instructions and generating a more efficient sequence of RISC-V instructions.
How will you empirically measure success?
We will evaluate the success of our project by assessing two key criteria:
Semantic Equivalence: We will verify the correctness of our project by ensuring that the translated RISC-V code is semantically equivalent to the source Bril code. We will utilize Cranelift's ISLE domain-specific language to specify our translation rules and use Crocus to verify the correctness of these rules. It's imperative that the RISC-V code generated by our system matches that produced by Cranelift. This will be tested using rigorous benchmarks.
Performance Improvement: We will assess the improvement in performance from interpreted Bril code to compiled RISC-V code in terms of execution time. We are currently researching tools to accurately measure wall clock time for comparing the two execution modes.
Team members: @20ashah