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

jit: Improve MMU efficiency in system simulation #500

Open
vacantron opened this issue Oct 11, 2024 · 2 comments
Open

jit: Improve MMU efficiency in system simulation #500

vacantron opened this issue Oct 11, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request research Study certain topics

Comments

@vacantron
Copy link
Collaborator

In the current flow of the JIT compilation, the simulation will be reverted back to the interpreter mode to deal with the translation of the virtual address to the physical address when reaching the memory operation (lw/sw) in the system simulation. This is going to have a significant impact to the performance due to the mode switching.

The one of the possible solutions is to implement the translation lookaside buffer (TLB). However, the situation mentioned above will still happen if the cache misses.

@vacantron vacantron added research Study certain topics enhancement New feature or request labels Oct 11, 2024
@jserv jserv added this to the release-2024.2 milestone Oct 19, 2024
@jserv jserv changed the title jit: improve the efficiency of MMU in the system simulation jit: Improve the efficiency of MMU in the system simulation Oct 28, 2024
@jserv jserv changed the title jit: Improve the efficiency of MMU in the system simulation jit: Improve MMU efficiency in system simulation Oct 28, 2024
@jserv
Copy link
Contributor

jserv commented Feb 21, 2025

TODO:

  • Find an effective way to measure elapsed time when running benchmark programs inside Linux guest.
  • Clarify the reasons for slowdown because of JIT compilation.

@vacantron
Copy link
Collaborator Author

vacantron commented Feb 22, 2025

In the current flow of the JIT compilation, the simulation will be reverted back to the interpreter mode to deal with the translation of the virtual address to the physical address when reaching the memory operation (lw/sw) in the system simulation.

In #521, we implemented MMU with JIT system simulation by redirecting the current execution flow to jit_mmu_handler() by the jump instruction. In this handler, we translate the virtual address to physical address and return it to the JIT. A MMIO check is also to be done in the meanwhile. The overhead of this check might be the one of the reason that causes the performance drop.

To improve the memory address translation, we could cache the translated virtual address instead of jumping to jit_mmu_handler(). However, we still need to check if it is a MMIO or not first to avoid the unexpected behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request research Study certain topics
Projects
None yet
Development

No branches or pull requests

2 participants