Skip to content
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

[EraVM] Add skipFunction() to the backend optimization passes. #670

Merged
merged 1 commit into from
Aug 5, 2024

Conversation

PavelKopyl
Copy link
Contributor

Code Review Checklist

Purpose

Ticket Number

Requirements

  • Have the requirements been met?
  • Have stakeholder(s) approved the change?

Implementation

  • Does this code change accomplish what it is supposed to do?
  • Can this solution be simplified?
  • Does this change add unwanted compile-time or run-time dependencies?
  • Could an additional framework, API, library, or service improve the solution?
  • Could we reuse part of LLVM instead of implementing the patch or a part of it?
  • Is the code at the right abstraction level?
  • Is the code modular enough?
  • Can a better solution be found in terms of maintainability, readability, performance, or security?
  • Does similar functionality already exist in the codebase? If yes, why isn’t it reused?
  • Are there any best practices, design patterns or language-specific patterns that could substantially improve this code?

Logic Errors and Bugs

  • Can you think of any use case in which the
    code does not behave as intended?
  • Can you think of any inputs or external events
    that could break the code?

Error Handling and Logging

  • Is error handling done the correct way?
  • Should any logging or debugging information
    be added or removed?
  • Are error messages user-friendly?
  • Are there enough log events and are they
    written in a way that allows for easy
    debugging?

Maintainability

  • Is the code easy to read?
  • Is the code not repeated (DRY Principle)?
  • Is the code method/class not too long?

Dependencies

  • Were updates to documentation, configuration, or readme files made as required by this change?
  • Are there any potential impacts on other parts of the system or backward compatibility?

Security

  • Does the code introduce any security vulnerabilities?

Performance

  • Do you think this code change decreases
    system performance?
  • Do you see any potential to improve the
    performance of the code significantly?

Testing and Testability

  • Is the code testable?
  • Have automated tests been added, or have related ones been updated to cover the change?
    • For changes to mutable state
  • Do tests reasonably cover the code change (unit/integration/system tests)?
    • Line Coverage
    • Region Coverage
    • Branch Coverage
  • Are there some test cases, input or edge cases
    that should be tested in addition?

Readability

  • Is the code easy to understand?
  • Which parts were confusing to you and why?
  • Can the readability of the code be improved by
    smaller methods?
  • Can the readability of the code be improved by
    different function, method or variable names?
  • Is the code located in the right
    file/folder/package?
  • Do you think certain methods should be
    restructured to have a more intuitive control
    flow?
  • Is the data flow understandable?
  • Are there redundant or outdated comments?
  • Could some comments convey the message
    better?
  • Would more comments make the code more
    understandable?
  • Could some comments be removed by making the code itself more readable?
  • Is there any commented-out code?
  • Have you run a spelling and grammar checker?

Documentation

  • Is there sufficient documentation?
  • Is the ReadMe.md file up to date?

Best Practices

  • Follow Single Responsibility principle?
  • Are different errors handled correctly?
  • Are errors and warnings logged?
  • Magic values avoided?
  • No unnecessary comments?
  • Minimal nesting used?

Experts' Opinion

  • Do you think a specific expert, like a security
    expert or a usability expert, should look over
    the code before it can be accepted?
  • Will this code change impact different teams, and should they review the change as well?

@PavelKopyl PavelKopyl marked this pull request as draft August 2, 2024 14:38
Copy link

github-actions bot commented Aug 2, 2024

Benchmark results EraVM:

╔═╡ Size (-%) ╞════════════════╡ All M3B3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════════════╡ All M3B3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════════════╡ All M3B3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════════════╡ All MzB3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════════════╡ All MzB3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════════════╡ All MzB3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞═════╡ EVMInterpreter M3B3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                                 NaN ║
╠═╡ Cycles (-%) ╞═══╡ EVMInterpreter M3B3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞═════╡ EVMInterpreter M3B3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs/gas ╞══════╡ EVMInterpreter M3B3 ╞═╣
║ ADD                                42.750 ║
║ MUL                                25.650 ║
║ SUB                                42.750 ║
║ DIV                                30.450 ║
║ SDIV                               46.050 ║
║ MOD                                30.450 ║
║ SMOD                               43.650 ║
║ ADDMOD                             24.406 ║
║ MULMOD                             25.906 ║
║ EXP                                 7.438 ║
║ SIGNEXTEND                         28.050 ║
║ LT                                 46.750 ║
║ GT                                 46.750 ║
║ SLT                                70.750 ║
║ SGT                                68.750 ║
║ EQ                                 46.750 ║
║ ISZERO                             44.417 ║
║ AND                                42.750 ║
║ OR                                 42.750 ║
║ XOR                                42.750 ║
║ NOT                                38.417 ║
║ BYTE                               54.750 ║
║ SHL                                46.750 ║
║ SHR                                48.750 ║
║ SAR                                68.750 ║
║ SGT                                68.750 ║
║ SHA3                               28.243 ║
║ ADDRESS                            53.812 ║
║ BALANCE                            73.625 ║
║ ORIGIN                           1369.375 ║
║ CALLER                             53.812 ║
║ CALLVALUE                          53.812 ║
║ CALLDATALOAD                       40.750 ║
║ CALLDATASIZE                       54.125 ║
║ CALLDATACOPY                       73.123 ║
║ CODESIZE                           54.625 ║
║ CODECOPY                          133.379 ║
║ GASPRICE                         1372.188 ║
║ EXTCODESIZE                         5.128 ║
║ EXTCODECOPY                         5.180 ║
║ RETURNDATASIZE                     52.500 ║
║ RETURNDATACOPY                     45.222 ║
║ EXTCODEHASH                         8.212 ║
║ BLOCKHASH                         241.019 ║
║ COINBASE                         1372.375 ║
║ TIMESTAMP                        1369.375 ║
║ NUMBER                           1369.375 ║
║ PREVRANDAO                       1369.375 ║
║ GASLIMIT                         1375.375 ║
║ CHAINID                          1369.375 ║
║ SELFBALANCE                       647.975 ║
║ BASEFEE                          1369.375 ║
║ POP                                44.625 ║
║ MLOAD                              64.390 ║
║ MSTORE                             62.562 ║
║ MSTORE8                            74.127 ║
║ SLOAD                              26.837 ║
║ SSTORE                              9.059 ║
║ JUMP                               23.111 ║
║ JUMPI                              21.727 ║
║ PC                                 54.312 ║
║ MSIZE                              60.812 ║
║ GAS                                51.312 ║
║ JUMPDEST                           77.625 ║
║ PUSH0                              51.312 ║
║ PUSH1                              45.958 ║
║ PUSH2                              49.375 ║
║ PUSH4                              52.208 ║
║ PUSH5                              53.625 ║
║ PUSH6                              55.042 ║
║ PUSH7                              56.458 ║
║ PUSH8                              57.875 ║
║ PUSH9                              59.292 ║
║ PUSH10                             60.708 ║
║ PUSH11                             62.125 ║
║ PUSH12                             63.542 ║
║ PUSH13                             64.958 ║
║ PUSH14                             66.375 ║
║ PUSH15                             67.792 ║
║ PUSH16                             69.208 ║
║ PUSH17                             70.625 ║
║ PUSH18                             72.042 ║
║ PUSH19                             73.458 ║
║ PUSH20                             74.875 ║
║ PUSH21                             76.292 ║
║ PUSH22                             77.708 ║
║ PUSH23                             79.125 ║
║ PUSH24                             80.542 ║
║ PUSH25                             81.958 ║
║ PUSH26                             83.375 ║
║ PUSH27                             84.792 ║
║ PUSH28                             86.208 ║
║ PUSH29                             87.625 ║
║ PUSH30                             89.042 ║
║ PUSH31                             90.458 ║
║ PUSH32                             89.875 ║
║ DUP1                               36.417 ║
║ DUP2                               44.417 ║
║ DUP3                               42.417 ║
║ DUP4                               44.417 ║
║ DUP5                               44.417 ║
║ DUP6                               44.417 ║
║ DUP7                               44.417 ║
║ DUP8                               44.417 ║
║ DUP9                               44.417 ║
║ DUP10                              44.417 ║
║ DUP11                              44.417 ║
║ DUP12                              44.417 ║
║ DUP13                              44.417 ║
║ DUP14                              44.417 ║
║ DUP15                              44.417 ║
║ DUP16                              44.417 ║
║ SWAP1                              47.083 ║
║ SWAP2                              47.083 ║
║ SWAP3                              47.083 ║
║ SWAP4                              47.083 ║
║ SWAP5                              45.083 ║
║ SWAP6                              47.083 ║
║ SWAP7                              47.083 ║
║ SWAP8                              47.083 ║
║ SWAP9                              47.083 ║
║ SWAP10                             47.083 ║
║ SWAP11                             47.083 ║
║ SWAP12                             47.083 ║
║ SWAP13                             47.083 ║
║ SWAP14                             47.083 ║
║ SWAP15                             47.083 ║
║ SWAP16                             47.083 ║
║ CALL                               60.523 ║
║ STATICCALL                         60.513 ║
║ DELEGATECALL                       59.548 ║
║ CREATE                              5.380 ║
║ CREATE2                             7.576 ║
║ RETURN                              1.000 ║
║ REVERT                              1.000 ║
╠═╡ Ergs/gas (-%) ╞═╡ EVMInterpreter M3B3 ╞═╣
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞═════╡ EVMInterpreter MzB3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                                 NaN ║
╠═╡ Cycles (-%) ╞═══╡ EVMInterpreter MzB3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞═════╡ EVMInterpreter MzB3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════╡ Precompiles M3B3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════╡ Precompiles M3B3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════╡ Precompiles M3B3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞════════╡ Precompiles MzB3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞══════╡ Precompiles MzB3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞════════╡ Precompiles MzB3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞══════════╡ Real life M3B3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞════════╡ Real life M3B3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞══════════╡ Real life M3B3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

╔═╡ Size (-%) ╞══════════╡ Real life MzB3 ╞═╗
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Cycles (-%) ╞════════╡ Real life MzB3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╠═╡ Ergs (-%) ╞══════════╡ Real life MzB3 ╞═╣
║ Mean                                0.000 ║
║ Best                                0.000 ║
║ Worst                               0.000 ║
║ Total                               0.000 ║
╚═══════════════════════════════════════════╝

@PavelKopyl PavelKopyl marked this pull request as ready for review August 5, 2024 08:39
@akiramenai akiramenai merged commit cab0be3 into main Aug 5, 2024
15 checks passed
@akiramenai akiramenai deleted the kpv-eravm-skipfunction branch August 5, 2024 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants