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

Make performance improving options default #1963

Closed
wants to merge 48 commits into from

Conversation

palinatolmach
Copy link
Contributor

@palinatolmach palinatolmach commented Jul 24, 2023

This PR fixes #1958, which is aimed to improve the default observable performance of KEVM by making the following set of flags/optimizations the default:

  • Setting default --max-depth to 25000 (instead of 1000)
  • Using --no-break-on-calls by default
  • Using --use-booster by default
  • Using infinite gas by default; implemented based on Allow setting infinite gas in foundry test #1524. With regards to the conversation in Use infinite gas by default #1520, this PR also adds a cheatcode setGas(uint256) that sets gas to the provided value; the PR also adds a test for setGas.
  • Using --no-implication-every-block by default
    (requires further investigation, as using it by default breaks 79182a0149fceb6cd86e2ca420e4afb4032fdb144618f53b819e3edbfa47a1bb proof in nix build --extra-experimental-features 'nix-command flakes' --print-build-logs .#kevm-test)

In this configuration, the execution of kevm foundry-prove on the MiniVat test takes ~170s instead of ~250s as before.

@palinatolmach palinatolmach marked this pull request as ready for review July 24, 2023 19:25
@palinatolmach palinatolmach self-assigned this Jul 24, 2023
@palinatolmach palinatolmach force-pushed the optimized-defaults branch 2 times, most recently from b433541 to f2c6005 Compare July 26, 2023 07:20
@ehildenb
Copy link
Member

I still prefer unbounded loops by default, following the principle taht @d-xo mentioned of "be as sound as possible, and let users make it simpler if wanted".

But not having that, I would also suggest having a loud warning on passed proofs if any nodes are passed because they are bounded, something like "Proof passed, but NNN nodes were loop-depth bounded at MMM iterations, re-run with --unbounded-loops for full verification."

@palinatolmach
Copy link
Contributor Author

palinatolmach commented Aug 1, 2023

@anvacaru @tothtamas28 @ehildenb Can I ask for your opinion on making --with-llvm-backend default in foundry-kompile in dde26c8? I realized that with the booster enabled by default, we should also generate the llvm library (otherwise everyone would have to debug the no interpreter.dylib error), but I didn't want to enable it for kompile in general, beyond the Foundry integration — at least, until we migrate all proofs (including normal Haskell, not just Foundry ones) to use booster, as @ehildenb suggested.

@palinatolmach
Copy link
Contributor Author

palinatolmach commented Aug 4, 2023

Update on using --with-llvm-library in kevm foundry-kompile by default (and not having it on by default for kevm kompile), as implemented in a8b0126:

  • The option --with-llvm-library is inherited as part of kompile_args in pyk, which we don't want to modify;
  • Introducing foundry_kompile.set_defaults(llvm_library=True) to re-set the default value foundry_kompile options overrides the default value for all subparsers (i.e., for kevm kompile, which is then also ran with --with-llvm-library by default)
  • As a way around this, I added separate --with-llvm-library and --no-llvm-library options to both kevm_kompile_args and foundry_kompile_args; the first overrides the --with-llvm-library option inherited from the parent kompile_args: a8b0126. For that, I added conflict_handler='resolve' argument to the initialization of both subparsers.
    (Strangely enough, adding an overriding --with-llvm-library option and conflict_handler='resolve' to just one subparser, foundry_kompile_args, messes up this option in kevm_kompile_args).

@github-actions
Copy link

Workflow Telemetry - Test PR / Build and Test KEVM Foundry proofs

Workflow telemetry for commit 86d56c8824aa19cf0b1f7643158401801ef83f83
You can access workflow job details here

Step Trace

gantt
	title Build and Test KEVM Foundry proofs
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1692116333000, 1692116341000
	Set up runner : 1692116341000, 1692116342000
	Workflow Telemetry : 1692116342000, 1692116342000
	Check out code : 1692116343000, 1692116358000
	Set up Docker : 1692116358000, 1692116368000
	Build kevm-pyk : 1692116368000, 1692116386000
	Build Foundry : 1692116387000, 1692116451000
	Foundry Prove : crit, 1692116451000, 1692117368000
	Tear down Docker : 1692117368000, 1692117369000
	Post Check out code : 1692117369000, 1692117369000

Loading

CPU Metrics

chart_stacked_area_time_cdff9cb7-03df-4d18-ab8d-5d669906bad7

Memory Metrics

chart_stacked_area_time_b4ad5d1c-9ad7-44e0-84e0-c846a882a4d3

IO Metrics

Read Write
Network I/O chart_line_time_9d0f86de-3e38-45ca-9b0f-029441e86326 chart_line_time_8c50bfa4-81b3-4dd1-a0a5-8cfa4ec7a1d8
Disk I/O chart_line_time_dbef985e-414f-4284-8da3-d3009b6fa068 chart_line_time_d15afc52-7bf5-4e97-b18a-671b515b449d

@github-actions
Copy link

Workflow Telemetry - Test PR / Build and Test KEVM Foundry proofs (booster)

Workflow telemetry for commit 86d56c8824aa19cf0b1f7643158401801ef83f83
You can access workflow job details here

Step Trace

gantt
	title Build and Test KEVM Foundry proofs (booster)
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1692115938000, 1692115941000
	Set up runner : 1692115941000, 1692115942000
	Workflow Telemetry : 1692115943000, 1692115943000
	Check out code : 1692115943000, 1692115951000
	Set up Docker : 1692115951000, 1692116343000
	Build kevm-pyk : 1692116344000, 1692116363000
	Build blockchain-k-plugin-deps : 1692116363000, 1692116363000
	Build Foundry : 1692116363000, 1692116399000
	Foundry Prove : 1692116399000, 1692126748000
	Tear down Docker : 1692126750000, 1692126750000
	Post Check out code : 1692126751000, 1692126751000

Loading

CPU Metrics

chart_stacked_area_time_dd172f66-6915-4591-b159-3c599a6f514d

Memory Metrics

chart_stacked_area_time_41c5347b-9774-4d44-82b0-34ca6a084922

IO Metrics

Read Write
Network I/O chart_line_time_84d3c1bd-4654-4549-b08d-c285b951f7e7 chart_line_time_c15192ea-f96f-4b41-9ceb-20ae19ef0e18
Disk I/O chart_line_time_1a9d69a2-3d63-48f0-9908-5b0401fbee05 chart_line_time_78ea2eab-a8fb-4950-9a58-e6afb5e4869e

@github-actions
Copy link

Workflow Telemetry - Test PR / Build and Test KEVM Foundry proofs

Workflow telemetry for commit 86d56c8824aa19cf0b1f7643158401801ef83f83
You can access workflow job details here

Step Trace

gantt
	title Build and Test KEVM Foundry proofs
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1692132227000, 1692132235000
	Set up runner : 1692132235000, 1692132236000
	Workflow Telemetry : 1692132236000, 1692132236000
	Check out code : 1692132237000, 1692132244000
	Set up Docker : 1692132244000, 1692132277000
	Build kevm-pyk : 1692132278000, 1692132303000
	Build Foundry : 1692132303000, 1692132330000
	Foundry Prove : 1692132330000, 1692141236000
	Tear down Docker : 1692141237000, 1692141237000
	Post Check out code : 1692141237000, 1692141237000

Loading

CPU Metrics

chart_stacked_area_time_d463ab3a-3276-4c14-b83d-3310e91fd05c

Memory Metrics

chart_stacked_area_time_8501568b-a0e7-43fc-81a4-5601b1cfe4a9

IO Metrics

Read Write
Network I/O chart_line_time_00ca369c-819e-4901-b2d9-025ef3c4d0d7 chart_line_time_7945255f-0cf2-4980-89ec-ed6631646b9d
Disk I/O chart_line_time_78b7ac59-d1d6-4f90-9f9b-42877c3e363b chart_line_time_7f19e7e0-8a1f-4f7a-8c43-9d036f090d27

@github-actions
Copy link

Workflow Telemetry - Test PR / Build and Test KEVM Foundry proofs (booster)

Workflow telemetry for commit c394094dcd48cc4b0c6746e86833174592d33e8b
You can access workflow job details here

Step Trace

gantt
	title Build and Test KEVM Foundry proofs (booster)
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1692154211000, 1692154219000
	Set up runner : 1692154219000, 1692154220000
	Workflow Telemetry : 1692154221000, 1692154221000
	Check out code : 1692154221000, 1692154236000
	Set up Docker : 1692154236000, 1692154280000
	Build kevm-pyk : 1692154280000, 1692154303000
	Build blockchain-k-plugin-deps : 1692154304000, 1692154600000
	Build Foundry : 1692154601000, 1692154645000
	Foundry Prove : 1692154645000, 1692154776000
	Tear down Docker : 1692154777000, 1692154777000
	Post Check out code : 1692154777000, 1692154777000

Loading

CPU Metrics

chart_stacked_area_time_586ad02d-6907-4aab-bd2b-ebf018ab8158

Memory Metrics

chart_stacked_area_time_68455b9d-6f17-4724-8e93-b0e5d2f08940

IO Metrics

Read Write
Network I/O chart_line_time_0fe977e8-78ed-4963-876e-9da52c692d8b chart_line_time_3efc1ac0-d977-4e01-a1b1-f32fc0b61ed0
Disk I/O chart_line_time_554b7505-d0bd-4e5c-81ad-d2ae37ebd72f chart_line_time_70abfa42-879d-4658-94b1-3f1540f6872a

@github-actions
Copy link

Workflow Telemetry - Test PR / Build and Test KEVM Foundry proofs

Workflow telemetry for commit c394094dcd48cc4b0c6746e86833174592d33e8b
You can access workflow job details here

Step Trace

gantt
	title Build and Test KEVM Foundry proofs
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1692154212000, 1692154215000
	Set up runner : 1692154215000, 1692154216000
	Workflow Telemetry : 1692154216000, 1692154216000
	Check out code : 1692154216000, 1692154226000
	Set up Docker : 1692154227000, 1692154413000
	Build kevm-pyk : 1692154414000, 1692154433000
	Build Foundry : 1692154433000, 1692154479000
	Foundry Prove : 1692154479000, 1692154776000
	Tear down Docker : 1692154776000, 1692154777000
	Post Check out code : 1692154777000, 1692154777000

Loading

CPU Metrics

chart_stacked_area_time_e7472c78-c992-4204-9e69-00c5e3356edc

Memory Metrics

chart_stacked_area_time_2fa21a84-7561-4d0a-951f-59cb9ae54c3a

IO Metrics

Read Write
Network I/O chart_line_time_2a74fdab-29c5-4026-9832-b3d85239ebb4 chart_line_time_17fadf2f-33d6-45b8-b645-2feaecf5e2ed
Disk I/O chart_line_time_62313845-213a-4088-b827-6944528e38de chart_line_time_9178850e-d5e2-420e-98f6-e4dd5dac18cd

@github-actions
Copy link

Workflow Telemetry - Test PR / Build and Test KEVM Foundry proofs

Workflow telemetry for commit 33f83d19df41545e1499453c0b9e1776a5517664
You can access workflow job details here

Step Trace

gantt
	title Build and Test KEVM Foundry proofs
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1692154899000, 1692154904000
	Set up runner : 1692154904000, 1692154905000
	Workflow Telemetry : 1692154905000, 1692154905000
	Check out code : 1692154905000, 1692154916000
	Set up Docker : 1692154916000, 1692155125000
	Build kevm-pyk : 1692155125000, 1692155145000
	Build Foundry : 1692155145000, 1692155192000
	Foundry Prove : crit, 1692155192000, 1692156579000
	Tear down Docker : 1692156580000, 1692156580000
	Post Check out code : 1692156580000, 1692156580000

Loading

CPU Metrics

chart_stacked_area_time_3709abcf-e14b-4de4-967c-ba2bbe4eb3cf

Memory Metrics

chart_stacked_area_time_d87172f7-590c-4f94-9efe-ed5f087d5989

IO Metrics

Read Write
Network I/O chart_line_time_88ab6300-a5b7-47f4-a15f-e1f58fbc9485 chart_line_time_d3e00e10-e1ca-4e67-b235-59a0171f20cc
Disk I/O chart_line_time_6b27c6d2-a53e-4cb4-9e83-14ac901a51e0 chart_line_time_d865a981-d808-4486-ae45-9df064801692

@github-actions
Copy link

Workflow Telemetry - Test PR / Build and Test KEVM Foundry proofs (booster)

Workflow telemetry for commit 33f83d19df41545e1499453c0b9e1776a5517664
You can access workflow job details here

Step Trace

gantt
	title Build and Test KEVM Foundry proofs (booster)
	dateFormat x
	axisFormat %H:%M:%S
	Set up job : milestone, 1692154900000, 1692154904000
	Set up runner : 1692154904000, 1692154905000
	Workflow Telemetry : 1692154905000, 1692154905000
	Check out code : 1692154905000, 1692154914000
	Set up Docker : 1692154914000, 1692155313000
	Build kevm-pyk : 1692155314000, 1692155331000
	Build blockchain-k-plugin-deps : 1692155332000, 1692155607000
	Build Foundry : 1692155607000, 1692155653000
	Foundry Prove : 1692155653000, 1692163909000
	Tear down Docker : 1692163909000, 1692163909000
	Post Check out code : 1692163910000, 1692163910000

Loading

CPU Metrics

chart_stacked_area_time_8d155a23-6894-4a7f-9bb7-6135995ad2b6

Memory Metrics

chart_stacked_area_time_74e4040d-f145-4fc1-852e-fef6a76022f0

IO Metrics

Read Write
Network I/O chart_line_time_4a7037c3-6c51-4a2b-b2e8-1152038dc563 chart_line_time_6bf89e6d-63fe-40a6-8d37-8bae43b9a725
Disk I/O chart_line_time_f2ebd3f8-2530-4003-a179-6d623d4f1aab chart_line_time_213c4d87-6468-445a-9bb0-0657201f1c52

@palinatolmach
Copy link
Contributor Author

Closing this PR since it introduces performance issues and doesn't pass CI. I'll split the changes suggested here into several smaller PRs.

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.

Make performance improving options default
7 participants