a16z / jolt

The simplest and most extensible zkVM. Fast and fully open source from a16z crypto and friends. ⚡
https://jolt.a16zcrypto.com
MIT License
632 stars 126 forks source link

RV32I M-Extension #251

Closed GUJustin closed 4 weeks ago

GUJustin commented 5 months ago

More instructions: The Jolt codebase currently implements the RISC-V 32-bit Base Integer instruction set (RV32I), but the Jolt construction is highly flexible. Add support for the RISC-V “M” extension for integer multiplication and division, as described in the Jolt paper. Further, Jolt can trivially support the 64-bit variant RV64IM.

mw2000 commented 4 months ago

@GUJustin @moodlezoup potentially interested in tackling this if an open issue, might need a few eyes on my PR drafts as I implement this 😄

moodlezoup commented 4 months ago

Hi @mw2000, feel free to give it a shot! My suggestion would be to start with just the instructions/subtables for the (32-bit) M extension (i.e. the stuff in jolt-core/src/jolt/instruction and jolt-core/src/jolt/subtable). The rest of the work shouldn't be too bad either, but will require some refactoring (as described in the Jolt paper, the M extension introduces the notion of "virtual instructions", which complicates things a bit)

mw2000 commented 4 months ago

Sounds good! I'll make small atomic PRs for the instructions and pass them over for review.

More than happy to break this issue into smaller ones (and use this as the bucket) if it makes sense for tracking (assuming 1 issue = 1 PR)

moodlezoup commented 4 months ago

Sure, go for it. Thanks for taking this on!

mw2000 commented 4 months ago

Just wanted to give an update, still on it. I should have something up in next couple days

moodlezoup commented 4 months ago

Great, let me know if you have any questions!

mw2000 commented 4 months ago

Hey @moodlezoup Was implementing the non-virtual multiplication instructions, MUL, MULU and MULHU. I was able to get the first two running just fine, but running into some trouble with MULHU.

With this context, i wanted to understand what exactly a subtable is and if you could add more color to the jolt_instruction_test! Macro

moodlezoup commented 4 months ago

Hi @mw2000, could you DM me on Twitter or post your Telegram handle here? Will be easier to communicate over one of those channels

Ethan-000 commented 3 months ago

hi. are people working on rest of the instructions such as div and rem?

mw2000 commented 3 months ago

Hey @Ethan-000, I and @shreyas-londhe are currently working on the rest of the M extension commands! You're welcome to join us 😄

Ethan-000 commented 3 months ago

sure :) how to coordinate? is there a branch you guys are working on?

mw2000 commented 3 months ago

@Ethan-000 Feel free to dm me on TG, my handle is that_one_nerdy

Right now we've been coordinating over DM, but happy to create a group or something similar

We've currently been working off of my fork of the repo