perf(riscv64): fast path interrupt polling#1074
Open
xiaokamikami wants to merge 1 commit into
Open
Conversation
7417b12 to
1e396b2
Compare
fcbee9e to
4ec2445
Compare
NEMU Performance Results - XS Interpreter
NEMU Performance Results - XS Ref Shared Object
|
Skip pending-state assembly when no interrupt is enabled, M-mode has interrupts globally disabled, or NMIE is closed. After a pending bit is observed, compute the effective global-enable mask once. Keeping delegation filtering after get_mip avoids adding get_hideleg to the common no-pending S/U path. Use a static byte-sized priority table so the cold selection path stays compact without rebuilding an array on every query. DynamoRIO shared-ref CoreMark host instructions drop from 6,466,360,574 to 5,507,075,491 (-14.835%) with identical guest instruction counts.
544d5c3 to
6b85e24
Compare
NEMU Performance Results - XS Interpreter
NEMU Performance Results - XS Ref Shared Object
|
NEMU Performance Results - XS Interpreter
NEMU Performance Results - XS Ref Shared Object
|
There was a problem hiding this comment.
Pull request overview
Optimizes the RISC-V (riscv64) interrupt polling hot path in isa_query_intr() by adding early-exit checks and reducing work in the common “no interrupt taken” case, while keeping the existing interrupt priority/delegation semantics.
Changes:
- Add fast-path early returns when no interrupts are enabled, M-mode global interrupts are disabled, or NMIE is closed.
- Compute delegation/effective global-enable mask once per poll and apply it to the pending vector before selection.
- Replace per-call priority arrays/loop bounds with a single static byte-sized priority table and iterate via
ARRLEN.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Optimize the hot RISC-V interrupt polling path in
isa_query_intr().Most polling calls do not result in a taken interrupt. Avoid constructing the pending interrupt state when no interrupt is enabled, M-mode interrupts are globally disabled, or NMIE is closed.
After observing a pending interrupt, compute the effective privilege and delegation mask once. Use a static byte-sized priority table to reduce the overhead of the cold interrupt selection path.
The RISC-V interrupt priority, privilege, delegation, RVH, and Sscofpmf semantics are preserved.
DynamoRIO shared REF CoreMark results with identical guest instruction counts: