Rust -> Zisk speedup: Potential Projects
This document outlines potential projects for improving the performance of Rust programs compiled to Zisk.
1. Improve Rust -> RISC-V -> ZisK translation
- Summary: Incremental improvements to existing compiler stack, there are some known inefficiencies in the generated RISC-V, we can try to eliminate them at various stages
- Size: Small, 1 month
- Impact: Low-Medium - estimate of around 10%-20% perf improvement
- Risk: Low
Items:
- Tweak LLVM passes to improve generated RISC-V
- RISC-V instruction re-optimization to leverage ZisK features (e.g. fuse loads and stores)
References:
2. ZK-friendly WASM interpreter
- Summary: Think Zeth, but for WASM. As a result you have ZisK program that takes WASM module, function to call and input arguments and produces the function output
- Size: Small, 1-2 months
- Impact: Low-Medium - depending on how efficient the interpreter will be
- Risc: Low
Items:
- Chose WASM interprer
- Compile it to RISC-V then to ZisK
- Optimize performance on interesting WASM programs
3. WASM -> ZisK compiler using Cranelift
- Summary: Use WASM as intermediate representation instead of RISC-V and leverage Cranelift to implement WASM -> ZisK translation
- Size: Medium, 2-4 months
- Impact: Medium - estimate of around 20%-50% perf improvement
- Risk: Medium - there is a chance we don't see a significant perf improvement or this turns out a lot more work than anticipated. Also, maintaining this will be more challenging due to new concepts (WASM, Cranelift compiler)
Items:
- Cranelift backend that can generate ZisK
- Implemention of ZiskOS ABI (e.g. reading inputs and writing outputs) for WASM toolchain
- Alternatively, we can implement WASI in ZisK and use Rust primitives for this (
println!
and stdin
)
- Implementation of WASM VM host functions in ZisK (e.g.
memory.grow
)
References: