Skip to content

Use occupancy masks for VU pipeline queues - #245

Open
GTTeancum wants to merge 3 commits into
ran-j:mainfrom
GTTeancum:codex/vu-pipeline-occupancy-masks
Open

GTTeancum wants to merge 3 commits into
ran-j:mainfrom
GTTeancum:codex/vu-pipeline-occupancy-masks

Conversation

@GTTeancum

@GTTeancum GTTeancum commented Sep 2, 2026

Copy link
Copy Markdown

Summary

  • Track occupied VU flag, store, VF, VI, and ACC pipeline slots with compact bitmasks.
  • Allocate the first free slot with std::countr_zero.
  • Visit only occupied slots when committing results or checking pending work.

Motivation

The fixed pipeline arrays are usually sparse. Earlier X-Men Legends bring-up
profiling identified VU execution and pipeline retirement as major costs, so
checking empty slots on every cycle is avoidable work. Allocation and retirement
must retain their original ascending slot order, timing, and reset behavior.

This is not a claim of current playable gameplay speed. Earlier title-screen
timings are not a sustained gameplay benchmark. The September 4 follow-up adds
regression coverage only; it makes no further runtime or performance change.

Testing

  • Windows 11, Visual Studio 2022 Release, one BelowNormal build worker.
  • Original branch: 425 passed, 0 failed.
  • With the new regression tests: 427 passed, 0 failed.
  • Forty independent upper/lower instruction pairs, checked at every cycle
    across 48 one-cycle slices with intervening zero-cycle resumes. Reused VF
    destinations receive alternating values so missing or late later writes are
    observable. The test also checks same-pair FSSET priority and MAC/STATUS.
  • Twelve restart/reset cases ensure cancelled pending flag/VF writes cannot
    reappear after a fresh execution, including restarts at nonzero cycle counts.

All new test programs and inputs are synthetic; no game data is included.

@GTTeancum

Copy link
Copy Markdown
Author

Added a small follow-up to clear retired FlagPipelineEntry objects directly. With MSVC 19.44, the aggregate assignment built a zeroed stack temporary and copied it back; direct clearing emits zero stores to the integer/bool entry instead. Deadline checks, slot retirement order, sticky accumulation, and occupancy masks are unchanged. The existing upstream-based Release suite passes 427/427. In the separate X-Men development branch, the analogous interpreter/native-block change also passes 126 focused VU tests and exact recorded state, memory, GIF bytes and cycle checks at normal and 1/8/16/64-cycle slicing. Those game-specific replay fixtures and native-block changes are not part of this PR. No whole-game FPS claim is made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant