Skip to content

Conversation

@pablodeymo
Copy link
Contributor

@pablodeymo pablodeymo commented Nov 4, 2025

Motivation

We want to take advantage of AVX2 processor features, and we are using asm features of dependencies in case it's possible.

Description

This PR sets compilation flag with AVX2 with the configuration:

target-cpu=x86-64-v3

At the same time, it changes Cargo.toml files in the following way:

  • c-kzg: no default features, and add std and ethereum_kzg_settings.
  • ark-ff: with asm feature.
  • sha3: unified in Cargo.toml of the workspace and asm feature added.

Closes #issue_number

@github-actions github-actions bot added L1 Ethereum client L2 Rollup client labels Nov 4, 2025
@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Benchmark Results Comparison

No significant difference was registered for any benchmark run.

Detailed Results

Benchmark Results: BubbleSort

Command Mean [s] Min [s] Max [s] Relative
main_revm_BubbleSort 2.958 ± 0.027 2.932 3.019 1.00 ± 0.01
main_levm_BubbleSort 3.240 ± 0.014 3.227 3.274 1.10 ± 0.01
pr_revm_BubbleSort 2.957 ± 0.014 2.934 2.980 1.00
pr_levm_BubbleSort 3.276 ± 0.024 3.247 3.321 1.11 ± 0.01

Benchmark Results: ERC20Approval

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Approval 974.0 ± 3.3 967.7 978.8 1.01 ± 0.01
main_levm_ERC20Approval 1185.8 ± 18.4 1163.7 1223.3 1.23 ± 0.02
pr_revm_ERC20Approval 965.8 ± 3.6 962.4 974.4 1.00
pr_levm_ERC20Approval 1162.9 ± 9.6 1151.0 1175.2 1.20 ± 0.01

Benchmark Results: ERC20Mint

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Mint 133.8 ± 1.1 132.2 135.4 1.00
main_levm_ERC20Mint 175.0 ± 5.3 171.3 186.1 1.31 ± 0.04
pr_revm_ERC20Mint 134.1 ± 0.9 133.0 135.8 1.00 ± 0.01
pr_levm_ERC20Mint 172.3 ± 10.2 167.7 201.0 1.29 ± 0.08

Benchmark Results: ERC20Transfer

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ERC20Transfer 234.4 ± 4.0 231.2 244.6 1.00 ± 0.02
main_levm_ERC20Transfer 290.9 ± 2.1 288.3 295.3 1.24 ± 0.01
pr_revm_ERC20Transfer 234.1 ± 2.2 229.8 235.8 1.00
pr_levm_ERC20Transfer 286.0 ± 2.8 281.6 290.2 1.22 ± 0.02

Benchmark Results: Factorial

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Factorial 224.3 ± 3.1 218.9 229.0 1.00
main_levm_Factorial 276.1 ± 3.1 273.9 284.7 1.23 ± 0.02
pr_revm_Factorial 224.4 ± 2.3 221.8 230.1 1.00 ± 0.02
pr_levm_Factorial 279.0 ± 23.8 269.0 346.4 1.24 ± 0.11

Benchmark Results: FactorialRecursive

Command Mean [s] Min [s] Max [s] Relative
main_revm_FactorialRecursive 1.665 ± 0.034 1.608 1.705 1.01 ± 0.03
main_levm_FactorialRecursive 8.457 ± 0.046 8.381 8.516 5.11 ± 0.09
pr_revm_FactorialRecursive 1.655 ± 0.026 1.603 1.692 1.00
pr_levm_FactorialRecursive 8.466 ± 0.034 8.405 8.526 5.12 ± 0.08

Benchmark Results: Fibonacci

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Fibonacci 202.9 ± 2.3 196.4 204.7 1.00
main_levm_Fibonacci 267.8 ± 1.6 265.2 270.1 1.32 ± 0.02
pr_revm_Fibonacci 204.2 ± 2.0 198.7 205.8 1.01 ± 0.02
pr_levm_Fibonacci 261.1 ± 3.2 256.0 265.7 1.29 ± 0.02

Benchmark Results: FibonacciRecursive

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_FibonacciRecursive 859.3 ± 7.8 842.0 870.0 1.14 ± 0.01
main_levm_FibonacciRecursive 767.0 ± 3.2 762.4 770.5 1.01 ± 0.01
pr_revm_FibonacciRecursive 858.4 ± 5.4 851.2 865.8 1.14 ± 0.01
pr_levm_FibonacciRecursive 756.0 ± 6.5 747.6 768.4 1.00

Benchmark Results: ManyHashes

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_ManyHashes 8.4 ± 0.1 8.3 8.5 1.01 ± 0.01
main_levm_ManyHashes 9.8 ± 0.1 9.7 10.0 1.18 ± 0.01
pr_revm_ManyHashes 8.3 ± 0.1 8.2 8.4 1.00
pr_levm_ManyHashes 9.6 ± 0.1 9.5 9.8 1.16 ± 0.01

Benchmark Results: MstoreBench

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_MstoreBench 251.7 ± 1.6 249.6 255.0 1.06 ± 0.01
main_levm_MstoreBench 236.7 ± 1.6 234.5 239.0 1.00
pr_revm_MstoreBench 253.8 ± 3.7 250.5 262.4 1.07 ± 0.02
pr_levm_MstoreBench 237.2 ± 2.5 234.2 241.0 1.00 ± 0.01

Benchmark Results: Push

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_Push 285.4 ± 1.4 283.8 288.2 1.00 ± 0.01
main_levm_Push 304.9 ± 1.1 303.1 306.3 1.07 ± 0.00
pr_revm_Push 285.3 ± 0.8 284.2 286.1 1.00
pr_levm_Push 301.9 ± 3.6 299.1 311.4 1.06 ± 0.01

Benchmark Results: SstoreBench_no_opt

Command Mean [ms] Min [ms] Max [ms] Relative
main_revm_SstoreBench_no_opt 170.1 ± 2.7 166.5 173.4 1.92 ± 0.04
main_levm_SstoreBench_no_opt 89.6 ± 4.6 86.9 102.3 1.01 ± 0.05
pr_revm_SstoreBench_no_opt 173.0 ± 7.4 166.8 192.0 1.95 ± 0.09
pr_levm_SstoreBench_no_opt 88.8 ± 1.4 87.3 91.4 1.00

@jrchatruc jrchatruc marked this pull request as ready for review November 5, 2025 15:37
@jrchatruc jrchatruc requested a review from a team as a code owner November 5, 2025 15:37
@ethrex-project-sync ethrex-project-sync bot moved this to In Review in ethrex_l1 Nov 5, 2025
@pablodeymo pablodeymo changed the title feat(l1,l2): adding features asm to crates feat(l1,l2): setting avx2 flags for compilation and adding features asm to crates Nov 5, 2025
@pablodeymo pablodeymo changed the base branch from avx2 to main November 5, 2025 15:44
rustflags = ["-Ctarget-cpu=x86-64-v2"]
rustflags = [
"-Ctarget-cpu=x86-64-v3",
"-Ctarget-feature=+avx2,+sse2,+ssse3,+sse4.1,+sse4.2,+bmi1,+lzcnt,+pclmulqdq",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The target-feature should already be enabled for the x86-64-v3 target CPU.
Are they explicitly there for any reason in particular?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we found some crates are checking for the specific feature not included when we set target-cpu

@jrchatruc jrchatruc enabled auto-merge November 5, 2025 16:23
@jrchatruc jrchatruc disabled auto-merge November 5, 2025 18:57
@jrchatruc jrchatruc enabled auto-merge November 5, 2025 18:57
@jrchatruc jrchatruc added this pull request to the merge queue Nov 5, 2025
Merged via the queue into main with commit 4d99b56 Nov 5, 2025
73 of 75 checks passed
@jrchatruc jrchatruc deleted the avx2-with-asm-features branch November 5, 2025 19:46
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Nov 5, 2025
@github-project-automation github-project-automation bot moved this to Done in ethrex_l2 Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client L2 Rollup client

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants