[gpu] Keep a guest's early call queued while a job finishes #7

Closed
doloro wants to merge 3 commits from doloro/Inkypaint:gpu-queue-early-call into main
Collaborator

We drop a lock while job is being polled, so we never get the item from the job (gpu read) and we dont know when its done.
Is what i think is going on.

Deepseek v4.1 explanation run_pass drops the queue lock while a poll item or a job runs. gpu_call_early inserts a texel read or write ahead of the first non-early item, so the head or the predecessor that run_pass read before the run can be out of date. Unlinking the finished item with that value skipped the new early call. The item leaked, g_qearly stayed above the listed items, and a lost texel read never raised the readback syncpoint. nvn_read_texels then waited on it for good, and a game sat on a loading screen with no file reads and an idle GPU thread.

queue_unlink re-finds the item from the head when prev no longer
leads to it, and fixes g_qtail with the real predecessor.

Verified with a run through the scene that hung. The load passed the
point, read 1541 more files in 25 s and completed 63506 readbacks,
against 12308 in the hung run. gdb at the hang showed g_qearly above
zero with no early item in the queue list.

What was wrong or missing, and what this changes, in a few lines. Name the game or the system when there is one.
  • [area] commit subject: why, one bullet for each commit. A pull request of one commit can skip this list.

Testing: what you ran and what it showed. A test that fails without the change is the best proof. For a runtime change, the game, the scene and how many runs.
Not tested: what you did not check. Leave the line out if there is nothing.

Fixes #

  • No keys, dumps, game files or saves in the commits or the description.
  • A new file starts with SPDX-License-Identifier: GPL-3.0-or-later and the project's copyright line.
  • Code ported from another project keeps its copyright lines, names where it came from and is listed in docs/CREDITS.md.
We drop a lock while job is being polled, so we never get the item from the job (gpu read) and we dont know when its done. Is what i think is going on. <details> <summary>Deepseek v4.1 explanation</summary> run_pass drops the queue lock while a poll item or a job runs. gpu_call_early inserts a texel read or write ahead of the first non-early item, so the head or the predecessor that run_pass read before the run can be out of date. Unlinking the finished item with that value skipped the new early call. The item leaked, g_qearly stayed above the listed items, and a lost texel read never raised the readback syncpoint. nvn_read_texels then waited on it for good, and a game sat on a loading screen with no file reads and an idle GPU thread. queue_unlink re-finds the item from the head when prev no longer leads to it, and fixes g_qtail with the real predecessor. Verified with a run through the scene that hung. The load passed the point, read 1541 more files in 25 s and completed 63506 readbacks, against 12308 in the hung run. gdb at the hang showed g_qearly above zero with no early item in the queue list. </details> <!-- SPDX-License-Identifier: GPL-3.0-or-later Copyright 2026 the ScarletNX contributors The title is `[area] an imperative sentence`, like the commits' (`[gpu] Set the threads making new pipelines`). Delete these comments before you open the pull request. --> What was wrong or missing, and what this changes, in a few lines. Name the game or the system when there is one. - `[area] commit subject`: why, one bullet for each commit. A pull request of one commit can skip this list. Testing: what you ran and what it showed. A test that fails without the change is the best proof. For a runtime change, the game, the scene and how many runs. Not tested: what you did not check. Leave the line out if there is nothing. Fixes # <!-- `Part of #n` when this is one step of several. --> - [ ] No keys, dumps, game files or saves in the commits or the description. - [ ] A new file starts with `SPDX-License-Identifier: GPL-3.0-or-later` and the project's copyright line. - [ ] Code ported from another project keeps its copyright lines, names where it came from and is listed in `docs/CREDITS.md`.
run_pass drops the queue lock while a poll item or a job runs.
gpu_call_early inserts a texel read or write ahead of the first
non-early item, so the head or the predecessor that run_pass read
before the run can be out of date. Unlinking the finished item with
that value skipped the new early call. The item leaked, g_qearly
stayed above the listed items, and a lost texel read never raised the
readback syncpoint. nvn_read_texels then waited on it for good, and a
game sat on a loading screen with no file reads and an idle GPU
thread.

queue_unlink re-finds the item from the head when prev no longer
leads to it, and fixes g_qtail with the real predecessor.

Verified with a run through the scene that hung. The load passed the
point, read 1541 more files in 25 s and completed 63506 readbacks,
against 12308 in the hung run. gdb at the hang showed g_qearly above
zero with no early item in the queue list.
doloro closed this pull request 2026-11-12 00:07:10 +00:00
Author
Collaborator

cause you merged it

cause you merged it
Owner

@doloro wrote in #7 (comment):

cause you merged it

no worries

@doloro wrote in https://git.doughston.dev/GRID0-net/Inkypaint/pulls/7#issuecomment-16: > cause you merged it no worries

Pull request closed

Sign in to join this conversation.
No description provided.