Repository navigation
ps2xRuntime: reduce VU1 interpreter overhead - #278
Closed
anxiousintrovert wants to merge 1 commit into
Closed
anxiousintrovert wants to merge 1 commit into
anxiousintrovert wants to merge 1 commit into
Conversation
The VU1 interpreter was ~90% of the frame in KFIV's 3D areas. Same cycle and flag model, cheaper bookkeeping: - Hazards: each decoded pair carries the ready-time slots it reads and writes (VF lanes, VI, ACC in one array), instead of re-deriving them from the usages with nested loops on every issue. - VF/VI/ACC results are written back at issue. These registers are interlocked: every reader already stalls until the write's latency has elapsed, so the delayed write-back pipelines (and their copy-out / restore per instruction) could never be observed. A program still ends only once its last write would have landed (write-back horizon), so cycle counts are unchanged. Flags, Q, P and stores keep their pipelines. - Pipelines track occupied slots in bitmasks and the earliest pending commit, so cycles with nothing due skip the commit scan, idle cycles are skipped, and commits still run in slot order. - FMAC flags: a single-rounding (toward zero) result that is normal and below FLT_MAX can only report its sign, so the exact recomputation is skipped; ADD/SUB results that round to zero are exactly zero. Otherwise the exact result is computed in double, which classifies like the long double (a float product is exact in double); a sum that lands exactly on FLT_MAX still takes the long double. Operands are decoded once per instruction and normalized with SSE4.1 where available. - XGKICK copies a qword at a time; decoded pairs are used by reference. Verified by running the original interpreter in lockstep on every microprogram of a KFIV session (720k runs into gameplay): registers, flags, cycle counts, VU1 memory and XGKICK output identical.
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.
Summary
Reduce CPU overhead in the VU1 interpreter. In Holyland's first 3D-area measurements, VU1 dominates the EE thread and is the main remaining frame-rate limit. This change improves the interpreter itself; it does not claim to solve the complete game frame-rate issue.
Related context: Holyland performance issue #1.
Changes
The measured VU1 interpreter speedup for this change was about 2.3x. This is interpreter speed, not a 2.3x whole-game frame-rate claim.
Verification
ps2_runtimetarget from current upstreammainon Windows with MSVC (RelWithDebInfo).git diff --checkpasses.No ROM, generated game code, captures, or other game data is included. The current-upstream validation here is a runtime-library build; a complete game run requires the maintainer's local generated game files.