spec: Field VM - #971
Conversation
Kimi Code ReviewAutomated review by Kimi (Moonshot AI) |
Codex Code ReviewFound five issues in the changed specification/tooling:
|
|
Getting the typechecker to be happy with ExtField elements is one of the next steps ;) |
erik-3milabs
left a comment
There was a problem hiding this comment.
Summary:
- instruction and constraints are similar, but not the same. Sketching the right mental model is informative.
- an instruction spans multiple states, which is a new concept in this spec. The reader is not helped to understand this. Sketching the right mental model is informative.
- the concepts of input hinting, output hinting and register hinting and their relation is unclear.
- have another look at the lower and upper bounds of sum. There seem to be some issues with that.
- minor notes/rephrase proposals
| The central instruction of the ISA is a constraint for a fused multiply-add over the extension field: | ||
| `FMA o == a * b + c`. | ||
| Here all of `o`, `a`, `b` and `c` are arguments following the addressing scheme described below. |
There was a problem hiding this comment.
Reading this section, I've noticed that this o is easy to misinterpret. Also, o and just o are hardly distinguishable. Would it be an idea to rename this as d (for "destination")? I also considered r for "result", but that also overlaps with "register" so that might not be the greatest...
There was a problem hiding this comment.
"The central instruction of the ISA is a constraint"
We could (and maybe should?) spend a full paragraph unpacking the meaning of this single phrase. Starting with the purpose of this VM: verifying a proof. In other words, this VM doesn't need to really produce anything (like traditional programs), but rather just needs to check that a string has an acceptable format, by performing loads of assertions. (We do have some typical instructions, but those are to writeable registers only, and meant to reduce proof size.)
| The central instruction of the ISA is a constraint for a fused multiply-add over the extension field: | ||
| `FMA o == a * b + c`. | ||
| Here all of `o`, `a`, `b` and `c` are arguments following the addressing scheme described below. | ||
| The field VM uses only read-only memory, which is implemented as a committed table, |
There was a problem hiding this comment.
| The field VM uses only read-only memory, which is implemented as a committed table, | |
| The field VM only uses read-only memory, which is implemented as a committed table, |
or
| The field VM uses only read-only memory, which is implemented as a committed table, | |
| The field VM uses read-only memory only, which is implemented as a committed table, |
or something else that bypasses the double "only"
| The central instruction of the ISA is a constraint for a fused multiply-add over the extension field: | ||
| `FMA o == a * b + c`. | ||
| Here all of `o`, `a`, `b` and `c` are arguments following the addressing scheme described below. | ||
| The field VM uses only read-only memory, which is implemented as a committed table, |
There was a problem hiding this comment.
this does not mention the existence of writeable registers.
|
|
||
| [[constraints.memory]] | ||
| kind = "arith" | ||
| constraint = "$!#`mem_flags[i]` => #`args[i]` = #`args_premem[i]`$" |
There was a problem hiding this comment.
general note: why do we use ! to indicate the not-gate in this spec, when there is ¬?
There was a problem hiding this comment.
I'm not sure; I initially wrote not there, but we'd used ! in the past, so I went for consistency.
| }, | ||
| "next": (pp, rec, e) => { | ||
| assert(e.len() == 2 and type(e.at(1)) == str, message: "Invalid transition variable: " + repr(e)) | ||
| cwrap($#rec(PREC.next, e.at(1))'$, pp < PREC.next) |
There was a problem hiding this comment.
why cwrap instead of mwrap? (I see now that "cast" also uses cwrap here, which is also confusing)
There was a problem hiding this comment.
Uhh, copy-paste problems, I'm assuming
| "add": 10, // + | ||
| "eq": 11, // = and := | ||
| "MAX": 12, // <the void outside every expression> | ||
| "next": 3, // var' |
There was a problem hiding this comment.
I'm noticing that [idx, [next, var], i] is expressed as
- do you agree that the added parentheses are undesirable?
- should we perhaps move the idx code to 3 (after next)? I'm not expecting we'll be indexing on a pow or a neg any time soon.
Co-authored-by: Erik <159244975+erik-3milabs@users.noreply.github.com> Co-authored-by: Robin Jadoul <robin.jadoul@gmail.com>
No description provided.