-
Notifications
You must be signed in to change notification settings - Fork 234
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
feat(avm): in vm static gas accounting #6542
Conversation
@@ -320,9 +346,12 @@ namespace avm_main(256); | |||
pol OPCODE_SELECTORS = (sel_op_add + sel_op_sub + sel_op_div + sel_op_fdiv + sel_op_mul + sel_op_not | |||
+ sel_op_eq + sel_op_and + sel_op_or + sel_op_xor + sel_op_cast + KERNEL_SELECTORS); | |||
|
|||
pol commit opcode_active; | |||
opcode_active - OPCODE_SELECTORS = 0; |
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.
constrain to be boolean
// Constrain that the gas decrements correctly per instruction | ||
opcode_active * (l2_gas_remaining - (l2_gas_remaining' + l2_gas_op)); | ||
opcode_active * (da_gas_remaining - (da_gas_remaining' + da_gas_op)); | ||
|
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.
underflow check
f6c9a06
to
979ffcb
Compare
Benchmark resultsMetrics with a significant change:
Detailed resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. Proof generationEach column represents the number of threads used in proof generation.
L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 16 txs.
Circuits statsStats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.
Stats on running time collected for app circuits
Tree insertion statsThe duration to insert a fixed batch of leaves into each tree type.
MiscellaneousTransaction sizes based on how many contract classes are registered in the tx.
Transaction size based on fee payment method | Metric | | |
5fb2ef2
to
fb9fa49
Compare
72282f7
to
cb49c19
Compare
uint32_t initial_da_gas = 0; | ||
|
||
private: | ||
std::vector<GasTableEntry> construct_gas_lookup_table(); |
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.
Is this ever used since we have the hardcoded table above?
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.
Good catch!
EXPECT_TRUE(sender_row != trace.end()); | ||
|
||
// Show the first few rows and see if the correct gas values are populated | ||
for (size_t i = 1; i < 5; i++) { |
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.
Do we need these logs here when we have in the the helper.cpp already?
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.
Not really. As unit tests are postponed to another ticket I have left this part. Ultimately, it will be removed. I will add a comment.
0eed979
to
6a2f305
Compare
control flow opcodes
through bb binary
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.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'C++ Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05
.
Benchmark suite | Current: 1630e9a | Previous: 6a2f305 | Ratio |
---|---|---|---|
nativeconstruct_proof_ultrahonk_power_of_2/20 |
5943.480171999994 ms/iter |
5506.037660000004 ms/iter |
1.08 |
This comment was automatically generated by workflow using github-action-benchmark.
CC: @ludamad @codygunton
Overview
https://hackmd.io/zOxxT5bGTPmDWdalw0BkEw
TODO
For follow up prs