Skip to content

vm, runtime: implement direct mapping supercharged#6332

Merged
topointon-jump merged 1 commit intomainfrom
topointon/stricter_abi_and_runtime_constraints
Oct 15, 2025
Merged

vm, runtime: implement direct mapping supercharged#6332
topointon-jump merged 1 commit intomainfrom
topointon/stricter_abi_and_runtime_constraints

Conversation

@topointon-jump
Copy link
Copy Markdown
Contributor

@topointon-jump topointon-jump commented Sep 11, 2025

Implements both the the latest incarnation of account_data_direct_mapping (anza-xyz/agave#5871) and the tightly-coupled stricter_abi_and_runtime_constraints (anza-xyz/agave#7113) feature gates.

  • Multi-region accesses are no longer allowed, which meant I was able to significantly simplify some aspects of the vm. This change results in a 2-3% speedup in vm execution - even with both feature gates disabled!
  • stricter_abi_and_runtime_constraints must be activated before account_data_direct_mapping. Therefore all fuzzing, ledgers and unit tests with account_data_direct_mapping activated also activate stricter_abi_and_runtime_constraints.

Both feature gates have been extensively fuzzed and tested. Ledgers for each have been added to CI. Fuzz fixtures have been added to test vectors. The vm unit tests have been updated to reflect the new behaviour.

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch 3 times, most recently from c4ba46a to 507a56d Compare September 18, 2025 17:57
@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch 10 times, most recently from e80f90e to 596896f Compare September 25, 2025 14:32
@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch 3 times, most recently from 5505ff3 to c5675b1 Compare October 1, 2025 22:04
@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch 2 times, most recently from dce0041 to 58301df Compare October 9, 2025 14:34
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 9, 2025

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.099101 s 0.094789 s -4.351%
backtest mainnet-368528500-perf snapshot load 2.9 s 2.9 s 0.000%
backtest mainnet-368528500-perf total elapsed 99.100565 s 94.788768 s -4.351%
firedancer mem usage with mainnet.toml 1008.12 GiB 1008.12 GiB 0.000%

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Oct 9, 2025

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.087209 s 0.083327 s -4.451%
backtest mainnet-368528500-perf snapshot load 2.9 s 2.9 s 0.000%
backtest mainnet-368528500-perf total elapsed 87.20888 s 83.327365 s -4.451%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.084744 s 0.082755 s -2.347%
backtest mainnet-368528500-perf snapshot load 2.9 s 2.9 s 0.000%
backtest mainnet-368528500-perf total elapsed 84.744093 s 82.754901 s -2.347%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.084918 s 0.082847 s -2.439%
backtest mainnet-368528500-perf snapshot load 2.9 s 2.9 s 0.000%
backtest mainnet-368528500-perf total elapsed 84.917788 s 82.847156 s -2.438%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.084291 s 0.08224 s -2.433%
backtest mainnet-368528500-perf snapshot load 2.971 s 2.888 s -2.794%
backtest mainnet-368528500-perf total elapsed 84.29076 s 82.240121 s -2.433%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.084364 s 0.08223 s -2.530%
backtest mainnet-368528500-perf snapshot load 2.949 s 2.926 s -0.780%
backtest mainnet-368528500-perf total elapsed 84.363845 s 82.229508 s -2.530%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from 0be0250 to 6492736 Compare October 13, 2025 15:21
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.084156 s 0.080422 s -4.437%
backtest mainnet-368528500-perf snapshot load 2.937 s 2.887 s -1.702%
backtest mainnet-368528500-perf total elapsed 84.156367 s 80.422175 s -4.437%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from 1de66fe to d6c4d05 Compare October 13, 2025 16:14
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.081583 s 0.078599 s -3.658%
backtest mainnet-368528500-perf snapshot load 2.926 s 2.885 s -1.401%
backtest mainnet-368528500-perf total elapsed 81.583184 s 78.598683 s -3.658%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.081817 s 0.078749 s -3.750%
backtest mainnet-368528500-perf snapshot load 2.961 s 2.911 s -1.689%
backtest mainnet-368528500-perf total elapsed 81.816677 s 78.748798 s -3.750%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from 3d022c3 to 4646ef1 Compare October 13, 2025 20:50
@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from 13a8f54 to 3eb4b41 Compare October 13, 2025 21:44
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.083739 s 0.081003 s -3.267%
backtest mainnet-368528500-perf snapshot load 2.905 s 2.875 s -1.033%
backtest mainnet-368528500-perf total elapsed 83.73852 s 81.003348 s -3.266%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from 3eb4b41 to e7c5498 Compare October 13, 2025 21:53
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.082423 s 0.079457 s -3.599%
backtest mainnet-368528500-perf snapshot load 2.91 s 2.888 s -0.756%
backtest mainnet-368528500-perf total elapsed 82.423386 s 79.457397 s -3.598%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from e7c5498 to afc8e8a Compare October 13, 2025 22:16
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.082122 s 0.079457 s -3.245%
backtest mainnet-368528500-perf snapshot load 2.914 s 2.885 s -0.995%
backtest mainnet-368528500-perf total elapsed 82.121633 s 79.457328 s -3.244%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@topointon-jump topointon-jump changed the title [WIP] Implement direct mapping supercharged vm, runtime: Implement Direct Mapping Supercharged Oct 14, 2025
Copy link
Copy Markdown
Contributor

@ibhatt-jumptrading ibhatt-jumptrading left a comment

Choose a reason for hiding this comment

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

logic seems good to me, it would be nice if you added comments for the different cases in bpf_serlalize and cpi_common explaining what they do/are.

Also worth combing over for style, I didn't point out every style issue

Comment thread src/flamenco/vm/fd_vm.c Outdated
Comment thread src/flamenco/vm/fd_vm.h
Comment thread src/flamenco/vm/fd_vm_interp_core.c Outdated
Comment thread src/flamenco/vm/syscall/fd_vm_syscall_cpi.c
Comment thread src/flamenco/vm/syscall/fd_vm_syscall_cpi.c Outdated
Comment thread src/flamenco/vm/syscall/fd_vm_syscall_cpi_common.c Outdated
Comment thread src/flamenco/vm/syscall/fd_vm_syscall_cpi_common.c Outdated
Comment thread src/flamenco/vm/syscall/fd_vm_syscall_cpi_common.c Outdated
Comment thread src/flamenco/vm/syscall/fd_vm_syscall_cpi_common.c
Comment thread src/flamenco/vm/syscall/fd_vm_syscall_cpi_common.c Outdated
@ibhatt-jumptrading ibhatt-jumptrading changed the title vm, runtime: Implement Direct Mapping Supercharged vm, runtime: implement direct mapping supercharged Oct 14, 2025
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.083928 s 0.080621 s -3.940%
backtest mainnet-368528500-perf snapshot load 3.021 s 2.879 s -4.700%
backtest mainnet-368528500-perf total elapsed 83.927567 s 80.620989 s -3.940%
firedancer mem usage with mainnet.toml 1014.12 GiB 1014.12 GiB 0.000%

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch 4 times, most recently from d5148ba to 1152428 Compare October 15, 2025 01:44
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.079323 s 0.076514 s -3.541%
backtest mainnet-368528500-perf snapshot load 2.933 s 2.879 s -1.841%
backtest mainnet-368528500-perf total elapsed 79.323124 s 76.513601 s -3.542%
firedancer mem usage with mainnet.toml 1017.12 GiB 1017.12 GiB 0.000%

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from 1152428 to 8a27f67 Compare October 15, 2025 02:57
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.07977 s 0.076703 s -3.845%
backtest mainnet-368528500-perf snapshot load 2.936 s 2.888 s -1.635%
backtest mainnet-368528500-perf total elapsed 79.769587 s 76.703392 s -3.844%
firedancer mem usage with mainnet.toml 1017.12 GiB 1017.12 GiB 0.000%

@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from 8a27f67 to f8becfb Compare October 15, 2025 14:44
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.081304 s 0.078436 s -3.528%
backtest mainnet-368528500-perf snapshot load 2.898 s 2.879 s -0.656%
backtest mainnet-368528500-perf total elapsed 81.303844 s 78.435666 s -3.528%
firedancer mem usage with mainnet.toml 1017.12 GiB 1017.12 GiB 0.000%

Comment thread src/flamenco/runtime/program/fd_bpf_loader_program.c Outdated
@topointon-jump topointon-jump force-pushed the topointon/stricter_abi_and_runtime_constraints branch from f8becfb to 3b10a4f Compare October 15, 2025 16:29
@github-actions
Copy link
Copy Markdown

Performance Measurements ⏳

Suite Baseline New Change
backtest mainnet-368528500-perf per slot 0.081499 s 0.078568 s -3.596%
backtest mainnet-368528500-perf snapshot load 2.899 s 2.857 s -1.449%
backtest mainnet-368528500-perf total elapsed 81.499034 s 78.567833 s -3.597%
firedancer mem usage with mainnet.toml 1017.12 GiB 1017.12 GiB 0.000%

@topointon-jump topointon-jump added this pull request to the merge queue Oct 15, 2025
Merged via the queue into main with commit 78790b9 Oct 15, 2025
49 of 56 checks passed
@topointon-jump topointon-jump deleted the topointon/stricter_abi_and_runtime_constraints branch October 15, 2025 17:53
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.

3 participants