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

Add wall clock time CSR and optimize interpreter #309

Draft
wants to merge 3 commits into
base: refactor/new-readme
Choose a base branch
from

Conversation

edubart
Copy link
Collaborator

@edubart edubart commented Jan 31, 2025

WIP. This is a experiment on #308 .

This PR stops propagating mcycle everywhere in the interpreter and allows to make a more efficient interpreter hot loop, saving 1 instruction in the Fetch+Decode+Execute (down from 12 to 11 x86_64 instructions for the FENCE instruction trace). My preliminary benchmarks says this improves about ~4% the emulator performance in fibonacci benchmark (will benchmark more later).

It also introduces a new mtime CSR, declopping machine time from machine cycle, so the machine can effectively jump its wall clock. For instance this is used during WFI instructions, so now waiting many cycles in interactive mode does not increment mcycle anymore.

@edubart edubart added the enhancement New feature or request label Jan 31, 2025
@edubart edubart added this to the v0.20.0 milestone Jan 31, 2025
@edubart edubart self-assigned this Jan 31, 2025
@edubart edubart changed the base branch from main to refactor/new-readme January 31, 2025 19:25
@edubart edubart linked an issue Jan 31, 2025 that may be closed by this pull request
@edubart edubart force-pushed the feature/mtime branch 2 times, most recently from 86a19e0 to cbe4dd4 Compare February 2, 2025 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Opportunity to save 1 instruction from mcycle checks
1 participant