Review: preserve live DMA2 reads and restore word-cost timing - #20
Open
Alexbeav wants to merge 4 commits into
Open
Review: preserve live DMA2 reads and restore word-cost timing#20Alexbeav wants to merge 4 commits into
Alexbeav wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Owner
Author
|
@cubic-dev-ai review this PR |
@Alexbeav I have started the AI code review. It will take a few minutes to complete. |
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 This review branch combines the corrected GPU DMA2 linked-list state machine from #13 with the lower transfer cost demonstrated by RetroPortingToolKit#299 and resubmitted as RetroPortingToolKit#302. The change keeps DMA slicing. It reads each payload word at its own guest-cycle event, rejects stale widescreen-prepass metadata, consumes every elapsed event when service is late, and removes the obsolete polygon filter. It then charges one guest clock per transferred 32-bit word, including each node header, with no separate setup charge. ## Why PR RetroPortingToolKit#277 fixed Vampire Hunter D and Spot Goes to Hollywood by allowing the guest to change later ordering-table data while DMA remains active. Its 8-clock header and 5-clock setup charges also made large Final Fantasy VII ordering tables take about three times the prior runtime cost. FF7 then reached its stuck-channel path, canceled active walks, and lost battle geometry. The one-clock model is a validated compatibility model. This branch does not claim that it is a complete physical-bus arbitration model. ## Scope gate - Upstream base:
22fbbfcab962b25e010b1b8e94cb2fa140612f63- Review head:9dfb4174adea419c259b132eda512525cf9b8dea- Commit count: 4 - Changed-file count: 13 Commits: 1.f424a814preserves live payload-word timing and prepass guards. 2.99f775c8closes the late-service, live-link, and polygon-filter review gaps. 3.bc88c06crestores one clock per transferred word.9dfb4174versions the larger DMA save-state wire and corrects the test record. Changed files: -docs/internal/FAITHFUL_TIMING_PLAN.md-runtime/CMakeLists.txtruntime/include/boot_state.h-runtime/include/dma_gpu_ll.h-runtime/include/gpu.h-runtime/include/ws_prepass_guard.h-runtime/src/dma.c-runtime/src/dma_gpu_ll.c-runtime/src/gpu.c-runtime/src/main.cpp-runtime/tests/test_dma_gpu_linked_list_timing.cruntime/tests/test_savestate_status_protocol.py-runtime/tests/test_ws_prepass_guard.cThe diagnostic counters and synchronous A/B switch from dma: charge DMA2 linked-list walks what the validated model charged RetroPortingToolKit/psxrecomp#302 are intentionally not part of this review. They can receive separate review after the transfer behavior settles. ## Source tests - The runtime and oracle targets build with Clang 22.1.8. -dma_gpu_linked_list_timing_testpasses 20 consecutive runs. -ws_prepass_guard_testpasses 20 consecutive runs.savestate_status_protocol_testpasses 20 consecutive runs. - 61 of 62 enabled runtime tests pass. -sio_dualshock_rumble_testandspu_fidelity_testremain disabled upstream. -mod_runtime_testcrashes on this branch and unchanged base22fbbfca. -git diff --checkpasses. ## Remaining gate The exact review head still needs visible Vampire Hunter D, Spot Goes to Hollywood, and Final Fantasy VII routes before an upstream submission or update. ## Review focus Please review the zero-cost setup transition, the one-event-per-payload-word contract, late-service behavior, save-state fields, determinism data, and widescreen cache invalidation. Developed with AI assistance; validated as described (test evidence in PR body). AI writes the code and the PR, but I always test before I send something up. Happy to iterate on this process with your feedback. --- ## Summary by cubic Restores the one-clock-per-word GPU DMA2 timing model while keeping each payload word read at its own guest-cycle event, so guest rewrites during an active transfer still affect later words. - Charges one guest clock per transferred 32-bit word (header and payload) with no separate setup charge; the old model charged 8 clock cycles per header plus 5 per setup. - Removes the obsolete opt-in polygon-drop filter and itsPSX_ND_SIB_FLAP_LAST/PSX_ND_OT_OPAQUE_LASTenv vars. - Widescreen prepass now fingerprints cached nodes and commands; any live RAM mismatch invalidates the cached transform metadata. - Late service calls now consume every elapsed DMA boundary, not just one. - Bumps the save-state format to v6 to serializepayload_index; older save states are rejected at the header before any state is applied. - Adds unit tests for the prepass fingerprint guard and the v6 save-state wire. Written for commit 9dfb417. Summary will update on new commits.