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

Remove mutex around LLVM calls from booster #4087

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jberthold
Copy link
Member

Previously the LLVM backend was not thread-safe so the simplification calls had to be sequentialised for concurrent RPC requests.

Since thread-local storage is now used, the calls can be executed concurrently/in parallel using multiple cores. This PR removes the mutex that sequentialised the calls before.

This change should be tested in combination with K release 7.1.198 or higher (LLVM backend using thread-local storage).

Previously the LLVM backend was not thread-safe so the simplification calls had to be sequentialised for concurrent RPC requests.

Since thread-local storage is now used, the calls can be executed concurrently/in parallel using multiple cores. This PR removes the mutex that sequentialised the calls before.
@jberthold jberthold force-pushed the enable-parallel-calls-to-llvm branch from 8d90457 to 070305f Compare January 17, 2025 05:17
@jberthold
Copy link
Member Author

No significant performance changes to KEVM or kontrol tests

Test enable-parallel-calls-to-llvm time master-f6e0f33aa time (enable-parallel-calls-to-llvm/master-f6e0f33aa) time
mcd/end-subuu-pass-spec.k 54.05 55.96 0.965868477483917
erc20/ds/transferFrom-success-2-spec.k 60.64 58.56 1.03551912568306
kontrol/test-expectreverttest-test_expectrevert_bytes4-0-spec.k 65.84 63.47 1.037340475815346
TOTAL 180.53 177.99 1.0142704646328444
Test enable-parallel-calls-to-llvm time master-f6e0f33aa time (enable-parallel-calls-to-llvm/master-f6e0f33aa) time
kontrol/src/tests/integration/test_foundry_prove.py::test_foundry_xml_report 18.98 28.23 0.6723343960325895
FreshCheatcodes.test_freshSymbolicWord() 12.32 15.59 0.7902501603592046
ExternalLibTest.testSum() 15.86 18.73 0.8467698878804057
PlainPrankTest.test_prank_zeroAddress_true() 20.02 22.95 0.8723311546840958
StoreTest.testStoreLoadNonExistent() 12.56 14.09 0.8914123491838184
EmitContractTest.testExpectEmitDoNotCheckData() 15.55 17.39 0.8941920644048303
ExpectRevertTest.testFail_ExpectRevert_failAndSuccess() 18.29 20.44 0.8948140900195694
ExpectRevertTest.test_expectRevert_bytes4() 17.81 19.88 0.8958752515090543
StoreTest.testLoadNonExistent() 12.22 13.44 0.9092261904761906
MockCallTestFoundry.testMockGetters() 33.13 36.33 0.9119185246352878
CounterTest.testSetNumber(uint256) 20.59 22.38 0.920017873100983
ExpectRevertTest.test_expectRevert_returnValue() 20.98 22.78 0.9209833187006146
AssertTest.checkFail_assert_false() 16.09 17.35 0.9273775216138328
MockCallTestFoundry.testMockCalldata() 35.83 38.3 0.9355091383812011
AssertTest.test_assert_false() 29.11 31.02 0.9384268214055448
kontrol/src/tests/integration/test_foundry_prove.py::test_foundry_merge_nodes 28.58 30.45 0.9385878489326764
BlockParamsTest.testBlockNumber() 11.59 12.34 0.9392220421393841
CoinBaseTest.test_coinbase_setup() 23.77 24.87 0.9557700040209086
LabelTest.testLabel() 12.12 11.7 1.035897435897436
PlainPrankTest.test_startPrankWithOrigin_true() 18.09 17.46 1.036082474226804
ExpectRevertTest.testFail_expectRevert_false() 18.6 17.95 1.0362116991643455
Setup2Test.testFail_setup() 27.36 26.23 1.043080442241708
AddrTest.test_addr_true()-trace_options1 18.49 17.72 1.0434537246049662
AssumeTest.test_assume_staticCall(bool) 14.49 13.81 1.0492396813902969
AssertTest.prove_assert_true() 12.32 11.72 1.0511945392491466
AssertTest.test_revert_branch(uint256,uint256) 48.94 46.48 1.0529259896729777
AssertTest.test_failing_branch(uint256) 46.9 44.47 1.0546435799415337
ImmutableVarsTest.test_run_deployment(uint256) 147.35 139.56 1.0558182860418457
kontrol/src/tests/integration/test_foundry_prove.py::test_foundry_show_with_hex_encoding 5.31 5.02 1.0577689243027888
],bytes32))) 13.48 12.74 1.0580847723704867
AssertTest.testFail_expect_revert() 46.65 44.08 1.0583030852994555
kontrol/src/tests/integration/test_foundry_prove.py::test_constructor_with_symbolic_args 59.74 55.77 1.071185225031379
AssumeTest.testFail_assume_false(uint256,uint256) 36.42 33.94 1.0730701237477904
ChainIdTest.test_chainid_setup() 25.18 23.34 1.078834618680377
kontrol/src/tests/integration/test_foundry_prove.py::test_foundry_extra_lemmas 168.57 155.5 1.0840514469453375
MockFunctionTest.test_mock_function_concrete_args() 42.36 39.02 1.0855971296770885
SymbolicStorageTest.testFail_SymbolicStorage(uint256) 39.81 36.24 1.0985099337748345
ExternalLibTest.testSquare(uint256) 28.95 26.32 1.0999240121580547
AssumeTest.testFail_assume_true(uint256,uint256) 34.37 31.22 1.100896860986547
],uint256)) 26.75 24.2 1.1053719008264462
StoreTest.testStoreLoad() 15.59 13.96 1.1167621776504297
BlockParamsTest.testChainId(uint256) 13.87 12.39 1.1194511702986278
CounterTest.testIncrement() 21.18 18.83 1.124800849707913
MockCallTestFoundry.testMockSelector() 29.79 26.47 1.1254250094446543
ExpectRevertTest.testFail_expectRevert_bytes4() 23.0 20.41 1.1268985791278785
MockCallTest.testSelectorMockCall() 27.57 24.19 1.1397271599834642
ExpectCallTest.testExpectRegularCall() 19.25 16.86 1.141755634638197
ExpectRevertTest.test_expectRevert_message() 20.59 18.01 1.1432537479178233
EmitContractTest.testExpectEmit() 17.69 15.31 1.1554539516655782
AssertTest.test_assert_true_branch(uint256) 29.86 25.32 1.179304897314376
kontrol/src/tests/integration/test_foundry_prove.py::test_foundry_remove_node 11.47 9.39 1.2215122470713524
FreshCheatcodes.test_bool() 15.58 12.37 1.2594987873888441
StoreTest.testGasStoreWarmUp() 19.49 15.42 1.2639429312581063
TOTAL 1520.46 1469.98 1.0343406032735138

@jberthold jberthold marked this pull request as ready for review January 20, 2025 03:34
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.

1 participant