Skip to content

Compiles WebAssembly into a ZK friendly IR with infinite-registers and write-once memory.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

powdr-labs/womir

Repository files navigation

WOMIR - Write-Once Memory IR

WOMIR is a compiler pipeline from WebAssembly to machines with a very particular execution model: write-once memory (WOM) machines.

Instead of a fixed register bank or a stack, these machines provide as many registers as needed, but each register can only be written once. To differentiate between multiple calls of the same function, or multiple iterations of the same loop, references to registers are relative to a frame pointer managed by loops and function calls. This execution model fits naturally with zkVMs, where the execution trace is immutable anyway.

WOMIR transforms a WebAssembly program into an intermediate representation (IR). In this IR, WASM local variables and the operand stack are represented as edges of a directed acyclic graph (DAG). From this structure, WOMIR can generate a user-defined, assembly-like representation of the WOM program.

WOMIR was initially designed for PetraVM, developed through a collaboration between powdr and Irreducible.

Targets

WOMIR can target ISAs for WOM machines that have arbitrarily many general-purpose registers, a special frame pointer (FP) register, and instructions that operate on registers relative to the frame pointer. It also enforces that no register is written more than once in the same frame.

In addition to WOM-specific operations, the IR preserves most WebAssembly operations. Therefore, the target ISA must also allow for implementing them.

These targets are currently under development:

Interpreter

WOMIR has its own ISA and a corresponding interpreter that are used for testing.

Contributing

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.

Requirements

To run the tests, you need to install wabt.

License

This project is licensed under either of

at your option.

About

Compiles WebAssembly into a ZK friendly IR with infinite-registers and write-once memory.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6