feat: ahead of time (AOT) compilation of VmExe on x86_64#2195
Merged
Conversation
…and Metered execution mode (#2166) ## Description This PR adds support for AOT execution mode with interpreter fallback. Check `crates/vm/src/arch/aot.md` for a detailed description of AOT. In the AOT execution, we generate an assembly code and build it along with the rust bridge crate into a dynamic library. We also generate `pre_compute_instructions` and store it in the `AotInstance` struct. This `AotInstance` struct is analogous to the `InterpretedInstance` struct we have for interpreter mode. During execution phase, we create a vmstate and pass its pointer to the assembly. ## How Has This Been Tested? I configured `air_test_impl` of `stark_utils.py` to run both the AOT and Interpreted Pure & Metered Execution. Then I asserted that the `instret` and `pc` are equal and also the segments generated for the Metered Execution to be equal. ``` /* Assertions for Pure Execution AOT */ { let interp_state = vm .interpreter(&exe)? .execute(input.clone(), None) .expect("Failed to execute"); let aot_state = vm .get_aot_instance(&exe)? .execute(input.clone(), None) .expect("Failed to execute"); assert_eq!(interp_state.pc(), aot_state.pc()); assert_eq!(interp_state.instret(), aot_state.instret()); let system_config: &SystemConfig = config.as_ref(); let addr_spaces = &system_config.memory_config.addr_spaces; for r in 0..addr_spaces[1].num_cells { let interp = unsafe { interp_state.memory.read::<u8, 1>(1, r as u32) }; let aot_interp = unsafe { aot_state.memory.read::<u8, 1>(1, r as u32) }; assert_eq!(interp, aot_interp); } } /* Assertions for Metered AOT */ { let (aot_segments, aot_state) = vm .get_metered_aot_instance(&exe)? .execute_metered(input.clone(), metered_ctx.clone())?; let (segments, interp_state) = vm .metered_interpreter(&exe)? .execute_metered(input.clone(), metered_ctx.clone())?; assert_eq!(interp_state.pc(), aot_state.pc()); assert_eq!(interp_state.instret(), aot_state.instret()); let system_config: &SystemConfig = config.as_ref(); let addr_spaces = &system_config.memory_config.addr_spaces; for r in 0..addr_spaces[1].num_cells { let interp = unsafe { interp_state.memory.read::<u8, 1>(1, r as u32) }; let aot_interp = unsafe { aot_state.memory.read::<u8, 1>(1, r as u32) }; assert_eq!(interp, aot_interp); } assert_eq!(segments.len(), aot_segments.len()); for i in 0..segments.len() { assert_eq!(segments[i].instret_start, aot_segments[i].instret_start); assert_eq!(segments[i].num_insns, aot_segments[i].num_insns); assert_eq!(segments[i].trace_heights, aot_segments[i].trace_heights); } } ``` **Test Configuration:** - [x] Unit tests pass - [x] Integration tests pass - [x] Manual testing completed ## Checklist - [x] I have performed a self-review of my own code - [x] I have added tests that prove my fix is effective or that my feature works - [ ] I have added new tests to CI Closes INT-5195 Closes INT-5196 --------- Co-authored-by: Ubuntu <ubuntu@ip-172-31-18-208.ec2.internal> Co-authored-by: Maillew <lin.s.william0147@gmail.com>
…reth benchmark work
Add starting code for `AotTraits` to handle x86 assembly generation. Refer to design overview here: https://hackmd.io/iSSvk3HsQ0uDqS3i_9UyAA?both#AOT-Traits --------- Co-authored-by: Gunadi Gani <87816385+GunaDD@users.noreply.github.com> Co-authored-by: Ubuntu <ubuntu@ip-172-31-18-208.ec2.internal>
…-E1-should-suspend
Closes INT-5263, INT-5261, INT-5262
close INT-5260
closes INT-5259 --------- Co-authored-by: Ubuntu <ubuntu@ip-172-31-18-208.ec2.internal> Co-authored-by: Xinding Wei <weixinding@gmail.com>
Closes INT-5263, INT-5262 --------- Co-authored-by: Ubuntu <ubuntu@ip-172-31-18-208.ec2.internal> Co-authored-by: Xinding Wei <weixinding@gmail.com>
This comment has been minimized.
This comment has been minimized.
Closes INT-5493
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Closes INT-5487
Commit: 3cd5959 |
Commit: 14bef6c |
Commit: d164be5 |
closes INT-5486 --------- Co-authored-by: Xinding Wei <weixinding@gmail.com>
Commit: c4606d0 |
Closes INT-5503
Commit: e1afe83 |
Closes INT-5504
Commit: b0a067d |
Closes INT-5484
Commit: de55e29 |
Commit: 0cbc78c |
Co-authored-by: Jonathan Wang <31040440+jonathanpwang@users.noreply.github.com>
Commit: 47f0e0a |
yi-sun
approved these changes
Nov 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.