near / wasmtime

Standalone JIT-style runtime for WebAssembly, using Cranelift
https://wasmtime.dev/
Apache License 2.0
3 stars 4 forks source link

Tracking issue: ZK WASM optimizations #21

Closed aborg-dev closed 9 months ago

aborg-dev commented 11 months ago

This is a tracking issue for all optimization opportunities for ZK WASM compiler

- [x] Figure out why we use stack in [fibonacci](https://github.com/near/wasmtime/blob/zkasm-hackaton/cranelift/data/fibonacci.zkasm)
- [x] Merge consecutive JMPZ/JMPNZ and JMP using ZK ASM else clause
- [x] Find a way to annotate that a function does not clobber RR register and [save on stack save](https://github.com/near/wasmtime/blob/zkasm-hackaton/cranelift/data/add.zkasm#L8)
- [x] Find why we use immediate addition in [Counter example](https://github.com/near/wasmtime/blob/zkasm-hackaton/cranelift/data/counter.zkasm) for +1 to the counter
aborg-dev commented 9 months ago

I believe a lot of these optimizations are implemented now when compiling the code with aggressive optimizations options.