perf(riscv64): fast path interrupt polling - #1074
Merged
Merged
Conversation
xiaokamikami
requested review from
Anzooooo,
good-circle and
poemonsense
as code owners
June 15, 2026 08:41
xiaokamikami
force-pushed
the
perf/execute-intr-research
branch
from
June 29, 2026 02:17
7417b12 to
1e396b2
Compare
xiaokamikami
force-pushed
the
perf/execute-intr-research
branch
2 times, most recently
from
July 9, 2026 02:30
fcbee9e to
4ec2445
Compare
NEMU Performance Results - XS Interpreter
NEMU Performance Results - XS Ref Shared Object
|
xiaokamikami
force-pushed
the
perf/execute-intr-research
branch
from
July 10, 2026 08:09
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.
sinceforYy
reviewed
Jul 17, 2026
sinceforYy
approved these changes
Jul 17, 2026
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.
xiaokamikami
force-pushed
the
perf/execute-intr-research
branch
from
July 17, 2026 05:03
97ca9c9 to
132c3e7
Compare
NEMU Performance Results - XS Interpreter
NEMU Performance Results - XS Ref Shared Object
|
poemonsense
approved these changes
Jul 20, 2026
klin02
pushed a commit
that referenced
this pull request
Jul 30, 2026
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.
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: