-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce instructions pick
+ i
and place
+ i
#297
Conversation
9f8c2f1
to
95d2a06
Compare
7b63e76
to
e18d3c3
Compare
1c2ccef
to
dd496f7
Compare
e18d3c3
to
3a3ad2e
Compare
Arguments in favor of introducing the new instructions:
Arguments against introducing the new instructions:
Footnotes |
To make the strongest possible argument in favor of this PR, one has to argue that the following cost metrics either don't increase or are worth it:
Do we have numbers or arguments relating to these cost metrics? |
The arithmetization overview can answer the first two questions:
The arithmetization overview also tells us that evaluating the new constraints would introduce 2382 additional rows in the processor table when evaluating the AIR in assembly. The question regarding opcode space is slightly more involved because of instruction categories. The relevant categories are currently (without
Within each category, the maximum is 16. The instructions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed. No comments. LGTM.
To merge or not to merge? Here is an argument in favor worth considering. The 1.6% fewer cycles translates to rows in the processor table. Assume that translates to a smaller table height before padding. (And even if this assumption is wrong the argument still kinda holds.) We get this reduced row count in exchange for 0.7% (=1 - 607/611) performance drop in two big steps, namely NTT and row hashing. While this PR does not move the row count across the next power-of-two threshold, it can achieve that in combination with other similar improvements. I propose to merge this and future similar improvements. And then, at a later stage when we crossed the next power of two boundary, we can figure out which instructions to drop without crossing it back. In the mean time we can
|
How did @jan-ferdinand get to the 1.6 % fewer cycles? Do they include the added cost of the AIR-constraint evaluation? Because of this AIR-constraint evaluation cost, this PR adds 2 % to the opstack table 0.8 % to the processor table, and 0.6 % to the memory table. With the above-mentioned 0.7 % of additional prover time because of extra columns, I would say merging this is neutral from a performance perspective (assuming I didn't misunderstand anything). I'm in favor of advancing on the consensus programs and only after those have been written, reconsider these instruction. But it's not a strong preference. I'm happy to let the majority, or just @jan-ferdinand, decide. |
For reference, here is a table row count for the current verifier, run on Triton-VM 0.42 alpha 6. [
{
"name": "tasmlib_verifier_stark_verify_inner_padded_height_524288_fri_exp_4",
"benchmark_result": {
"clock_cycle_count": 285183,
"hash_table_height": 234025,
"u32_table_height": 211197,
"op_stack_table_height": 235124,
"ram_table_height": 281599
},
"case": "CommonCase"
}
] |
Please note that yesterday's comment was not meant to try to conclude the question regarding merging this PR; I mostly wanted to jot down some findings wherever they fit best. Some of this is here. |
I analysed how often a
No. That's part of the (admittedly overly short) con “arithmetic overhead.” |
358c67f
to
6271c3d
Compare
3a3ad2e
to
a2a97f4
Compare
These two new instructions simplify manipulation of the operational stack. Instruction `pick` + `i` moves the indicated stack element to the top of the stack. Instruction `place` + `i` is its dual, moving the top of the stack to the indicated position.
a2a97f4
to
b769392
Compare
The two new instructions simplify manipulation of the operational stack. Instruction
pick
+i
moves the indicated stack element to the top of the stack. Instructionplace
+i
is its dual, moving the top of the stack to the indicated position.pick
+i
_ d x c b a
_ d c b a x
place
+i
_ d c b a x
_ d x c b a