Skip to content

gpu, docs: run repeated lists after their previous execution - #51

Merged
simnJS merged 1 commit into
mainfrom
gpu/list-named-again-in-a-submission
Nov 25, 2026
Merged

simnJS merged 1 commit into
mainfrom
gpu/list-named-again-in-a-submission

Conversation

@fogydes

@fogydes fogydes commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

A title can submit the same command list more than once. Preparing every occurrence before executing the first rewrote its prelude and predicate memory while those earlier executions still needed it; D3D12 also reports message 553 when the list executes again before its preceding execution finishes.

Host::run_as splits before a repeated list and finishes the preceding part before preparing the next. execute, submit, and title queue submissions use this path. The frame meter counts the title submission once, including every part's lists and times. Each texture predicate can then decide its next run independently; the old same-submission exception is unnecessary.

The wait releases the host submission mutex. The title queue's line lock, and the global held-release lock for held submissions, remain held and can delay other queues. Diagnostics emit cumulative submission split totals with calls, split waits, and wait microseconds to measure that cost. The frame-analysis notes now describe this behavior.

Part of: #45
Depends on: none

Area

gpu, docs: submission, completion accounting, texture/decode predicate callers, timestamps, synthetic tests, and docs/analysis/gpu-frame.md.

Tests

  • cargo xtask pr-check passes on my machine
  • New or changed behaviour has tests that need no game files, or I explain below why it cannot

Verified on base abe3f40: strict WARP diagnostics suite passed 580 unit tests and 3 UMA integration tests; all six WARP pr-check steps passed. The build recompiled this worktree's crate and ran the branch-specific tests.

  • Repeated-list execution tests cover two runs through execute and three through submit, with ordered GPU readbacks and no message 553.
  • a_split_submission_waits_between_its_parts_outside_the_lock holds the first part on a GPU gate and checks an unrelated host submission returns before that gate opens.
  • the_frame_line_counts_a_split_submission_once checks [a,b,a,c,a] counts once with all five lists and summed times.
  • The repeated texture-list test checks one upload across both executions.

Runtime measurement: a bounded 240-second Series S WARP run produced 228 meter samples. The last sample reported 9,040 submission calls, zero split waits and zero microseconds in split waits. The autopilot did not reach the world predicates, so this is front-end evidence only. It does not answer the requested world-session cost; that remains outstanding. The counters remain available for that measurement. No real logs or title-derived data are attached.

Provenance

  • I wrote all of this change myself for XTP, or it only moves code already in XTP.
  • Some of it comes from elsewhere. Each source, its licence and the files concerned are listed here, and every licence is compatible with GPL-3.0-or-later:

AI assistance: Claude Code drafted the original implementation and tests. Codex integrated the rebase and review changes, restored the reviewed tally/tests, updated callers and diagnostics, and verified the result. No external code was copied or translated. I answer for every line.

Checklist

  • No game data, keys, console SDK code or headers, and nothing that circumvents DRM (asset policy)
  • No code copied from xcl or AnyPS5 (references only: read them to understand, write your own)
  • I agree to license this contribution under GPL-3.0-or-later
  • Title and every commit follow <area>: <summary>; one topic; under 400 changed lines, or the reason is above
  • Docs updated where behaviour, commands or variables changed (README, docs/)

@fogydes
fogydes requested a review from simnJS November 25, 2026 06:27
@github-actions github-actions Bot added area/gpu touches crates/xtp-gpu size/M 100 to 399 changed lines labels Nov 25, 2026
@fogydes
fogydes changed the base branch from ci/gpu-tests-debug-layer to main November 25, 2026 06:36
@github-actions github-actions Bot added the conflict conflicts with its base branch label Nov 25, 2026
@github-actions

Copy link
Copy Markdown

This pull request now conflicts with its base branch. Please rebase it on main (or merge main into it) and resolve the conflicts; the conflict label goes away by itself once it merges cleanly.

@fogydes
fogydes force-pushed the gpu/list-named-again-in-a-submission branch from 064782c to 3621791 Compare November 25, 2026 06:51
@github-actions github-actions Bot removed the conflict conflicts with its base branch label Nov 25, 2026

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this fixes more than the layer message. On main, a list named twice re-records its one prelude (allocator.Reset, list.Reset) before either run executes, so the first run executes the barriers computed for the second. A texture in COMMON that the list first uses as a render target and leaves as a shader resource gets PIXEL_SHADER_RESOURCE to RENDER_TARGET in both runs, wrong for the first. Splitting before the repeat, with the wait outside the submission lock, fixes that cleanly, and the shift test shows both order and visibility.

Before I approve:

  1. Docs. docs/analysis/gpu-frame.md still describes the rule this removes: lines 380-382 ("a second decision there keeps the copy the first let run"), 392-393 (the test "copies in both runs") and the table row at 455 ("credited in the code", a credit this PR removes with its code). Please update them here.

  2. A count of splits. Each repeat now makes the submitting thread wait for the GPU to finish everything before it, then leaves the GPU idle while the next part is prepared. That thread is already the bottleneck in run_as (docs/analysis/30fps.md). Could you count split submissions (a counter on the frame line, or a debug! with the part sizes) so a world session can be measured before merging?

  3. Accounting (minor). Only the last part is counted, so the frame line's list count and longest submission leave out the earlier parts' lists and GPU time. Either add them to the last part or say so in the comment.

Also, please drop the Co-Authored-By trailer; the description already states the AI assistance.

@github-actions github-actions Bot added the conflict conflicts with its base branch label Nov 25, 2026
@github-actions

Copy link
Copy Markdown

This pull request now conflicts with its base branch. Please rebase it on main (or merge main into it) and resolve the conflicts; the conflict label goes away by itself once it merges cleanly.

@fogydes

fogydes commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (05db757) and pushed 4d17d66 on top, with follow-ups from an in-house review:

  • Frame-rate line: a title submission split before a repeated list is counted once, by its last part. Its count now includes every part's lists, preparing time, GPU time and copy-back time (a shared tally the earlier parts add to in complete), not only the last part's. The waits between parts count as "waited".
  • Tests:
    • a_split_submission_waits_between_its_parts_outside_the_lock: with the gate closed and submit(&[&l, &l]) waiting on another thread, an unrelated execute still returns.
    • the_frame_line_counts_a_split_submission_once: [a,b,a,c,a] in 3 parts counts as 1 submission with 5 lists.
  • texture.rs: the stale comment is fixed, and the test is renamed a_list_named_twice_in_a_submission_copies_once.

Parallel cargo test -p xtp-gpu --lib (4 runs) and the full WARP pr-check pass. Under the debug layer, the only failures are 1419s that main has too (fixed by #49), and no 553 appears.

@fogydes
fogydes force-pushed the gpu/list-named-again-in-a-submission branch from 3621791 to 4d17d66 Compare November 25, 2026 11:50
@fogydes
fogydes requested a review from simnJS November 25, 2026 11:50
@github-actions github-actions Bot added overlap another open PR changes the same files and removed conflict conflicts with its base branch labels Nov 25, 2026

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rebase and the follow-ups. Point 3 is done well: earlier parts are tallied before the last one is submitted, and the new tests cover both the sums and the lock.

Still open before I approve:

  1. docs/analysis/gpu-frame.md is unchanged. Lines 380-382 describe a case that can no longer happen, and lines 392-393 say the test copies in both runs, while it now copies once (texture.rs:2377).
  2. There is no split count yet. A held submission waits between parts inside queue::run_line, under its line lock and under release_held's global lock, so other queues stall too: the comment at host.rs:1507-1509 only holds for the host submission lock. A count from a world session would settle the cost.
  3. Both commits still carry the Co-Authored-By trailers. Please drop them (a force-push is fine); the AI line in the description is what CONTRIBUTING asks for.
  4. The description still says that the predicate rule goes and that timestamps.rs is gated, and the decide comment at texture.rs:1262-1266 describes a branch that can no longer be reached.

The gpu-debug-layer failures are the three known message-1419 tests that also fail on main; we're fixing them there.

Split host submissions before repeated command lists so each run waits
for its predecessor before rewriting its prelude and predicate words.
Keep the reviewed frame tally and regression tests: the frame line counts
all parts once, and other host submissions can proceed during a wait.

Document the retained title-queue and held-release locks. Diagnostics
report cumulative calls, split waits and wait microseconds for measuring
whether those locks affect a title session. Update both predicate callers
and the frame notes to match repeated-list execution.

Part of #45.
@fogydes
fogydes force-pushed the gpu/list-named-again-in-a-submission branch from 4d17d66 to a1367f5 Compare November 25, 2026 15:00
@fogydes fogydes changed the title gpu: run a list named again in a submission after its first run gpu, docs: run repeated lists after their previous execution Nov 25, 2026
@github-actions github-actions Bot added area/docs docs/, Markdown overlap another open PR changes the same files and removed overlap another open PR changes the same files labels Nov 25, 2026
@fogydes

fogydes commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator Author

Pushed a1367f5 on abe3f40 with the requested source/documentation changes:

  1. gpu-frame.md now describes split execution and one texture upload across repeated runs. Its comparison table names host.rs too.
  2. Diagnostics now log cumulative submission calls, split waits and wait microseconds. The comment explicitly distinguishes the released host mutex from the retained queue line lock and held-release global lock. A bounded 240-second Series S WARP run reported 9,040 calls and zero split waits, but the autopilot never reached the world predicates. That is front-end evidence only; the requested world-session cost remains outstanding. I am checking existing data folders for a usable save. No runtime log or title-derived data is attached.
  3. All commits are trailer-free; the AI disclosure remains in the description.
  4. The description matches the current implementation, and both predicate callers are updated. Current main uses the submission counter in runtime late-copy bookkeeping, so it remains available in normal builds.

I also restored the already-reviewed frame tally and its two regression tests, which had been omitted from a prepared local rebase. The final branch ran all three repeated-list/tally/lock tests. Strict WARP diagnostics passed 580 GPU unit tests plus 3 UMA integration tests, and all six full WARP PR-check steps passed. Independent source review found no blocker. The world measurement is the remaining evidence gap.

@fogydes
fogydes requested a review from simnJS November 25, 2026 15:01

@simnJS simnJS left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, all four points are addressed:

  • gpu-frame.md is updated;
  • the counters are on the Meter;
  • the lock comment is accurate;
  • the trailers are gone.

The split and the wait outside the lock look correct to me: the host queue never waits on title fences, and each part finishes before the next is prepared. One non-blocking nit for a follow-up: timestamps.rs:576/585 call the submission count diagnostics-only, but LateLists::open_for (texture.rs:774) uses it at run time.

We'll read submission split totals in our own Series S world sessions on main.

@simnJS
simnJS merged commit 01a8232 into main Nov 25, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/docs docs/, Markdown area/gpu touches crates/xtp-gpu overlap another open PR changes the same files size/M 100 to 399 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants