Repository navigation
Stop DMA chain walks on real loops instead of a 4096-tag cap - #417
Open
0xLeathery wants to merge 2 commits into
Open
0xLeathery wants to merge 2 commits into
0xLeathery wants to merge 2 commits into
Conversation
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.
Problem
The chain-mode DMA walk in
ps2_memory.cppstopped afterkMaxChainTags = 4096tags, silently, with no log. The remaining tags were never transferred. The real DMAC has no tag limit, and large 3D frames go past 4096.Sly 2 (SCUS-97316) builds its first in-game frame as a VIF1 chain of 5,132 tags, mostly CALL/RET subroutine pairs carrying about 4.8 MB. Its tail was dropped, including the VU1 microprograms that draw (
XGKICK) and the work that ends in the GS FINISH. The render thread then waited on FINISH forever.Change
The cap only needed to stop chains that never end. Guest memory doesn't change while one chain is walked, so a chain loops forever exactly when it reaches a tag it has already processed with the same CALL/RET return state. The walk now detects that directly.
[DMA] <channel> chain stopped at tag 0x… : <reason> after N tags, M bytesthroughRUNTIME_ERROR, becauseRUNTIME_LOGcompiles out in Release. That's limited to 8 warnings per channel.end,refe, RET at ASP 0, TIE+IRQ), and the TADR/ASR/CHCR write-back after the walk.Testing
New tests in
ps2_memory_tests.cpp, all of which failed before the change:Results:
ps2x_testspasses 450/450.XGKICKs start and the render thread no longer hangs on FINISH.Known limits, not changed here
std::setkeeps the code simple.unordered_setwould make CALL/RET-heavy walks about 5x faster if that ever matters.Built and tested on macOS arm64 (Apple clang).