gpu: fence timestamp slots before asynchronous reuse #136

Closed
opened 2026-11-27 18:46:19 +00:00 by github-bot · 2 comments
Owner

@⁠krofty on GitHub · 2026-11-27 18:41 UTC · original

The optional asynchronous GPU timestamp ring (VICTORY_CARD_SPANS=1) reads, zeros and re-executes each query slot after 512 submissions without checking whether its earlier execution has completed. Submission age is not a GPU completion guarantee. Under a backlog this can read incomplete results and reuse query/list/readback storage still in use.

Use the already reserved submission fence value and existing queue signal to protect each slot. Skip sampling rather than wait if the slot is still busy. A slot with no prior execution must not read uninitialized mapped data; completed results need not be zeroed by the CPU. Device-loss sentinel values must not authorize reuse.

Acceptance:

  • Reuse/read a previously executed slot only after its recorded fence completes.
  • No waits or command-allocator resets, and no behavior change with timestamps disabled.
  • Focused fence-state regressions cover unused, incomplete, completed and device-loss cases.
  • Report skipped samples, and label time between measured submissions accurately: uploads/fetches outside the bracket can occur there, so it is not all idle.
  • Verify in a diagnostics build and one normal asynchronous game run before relying on its GPU execution numbers.

Claim: Codex / krofty will implement this isolated safety fix. It supports selecting the next substantial optimization under Snaacky/ztrx#249; it is not a new profiler or an FPS improvement claim. PR remains open and unmerged.

**@⁠krofty** on GitHub · 2026-11-27 18:41 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/136) The optional asynchronous GPU timestamp ring (`VICTORY_CARD_SPANS=1`) reads, zeros and re-executes each query slot after 512 submissions without checking whether its earlier execution has completed. Submission age is not a GPU completion guarantee. Under a backlog this can read incomplete results and reuse query/list/readback storage still in use. Use the already reserved submission fence value and existing queue signal to protect each slot. Skip sampling rather than wait if the slot is still busy. A slot with no prior execution must not read uninitialized mapped data; completed results need not be zeroed by the CPU. Device-loss sentinel values must not authorize reuse. Acceptance: - Reuse/read a previously executed slot only after its recorded fence completes. - No waits or command-allocator resets, and no behavior change with timestamps disabled. - Focused fence-state regressions cover unused, incomplete, completed and device-loss cases. - Report skipped samples, and label time between measured submissions accurately: uploads/fetches outside the bracket can occur there, so it is not all idle. - Verify in a diagnostics build and one normal asynchronous game run before relying on its GPU execution numbers. Claim: Codex / krofty will implement this isolated safety fix. It supports selecting the next substantial optimization under Snaacky/ztrx#249; it is not a new profiler or an FPS improvement claim. PR remains open and unmerged.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 18:46:19 +00:00
Author
Owner

@⁠krofty on GitHub · 2026-11-27 19:18 UTC · original

Implemented in PR #144. Diagnostics integration build 293 passed through build.sh. Five exact production-source tests pass; removing the completion check makes the pending-slot regression fail. Independent source review passed.

Normal asynchronous run 307 closed normally without a logged exception/device removal. Final three host intervals: 42.7/44.3/43.1 ms (23.4/22.6/23.2 FPS). Last eight queued GPU bracket readings: 38.3–39.4 ms/frame, 29 stamped submissions/frame, zero skipped samples. The brackets include runtime work, exclude other helpers, and use delayed samples divided by current host frame counts; they are not completed-frame percentiles or pure title time.

No gameplay speedup is claimed. The measurement lifetime repair is ready for review; releasing the implementation claim. PR remains open and unmerged.

**@⁠krofty** on GitHub · 2026-11-27 19:18 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/136#issuecomment-7226404376) Implemented in PR #144. Diagnostics integration build 293 passed through build.sh. Five exact production-source tests pass; removing the completion check makes the pending-slot regression fail. Independent source review passed. Normal asynchronous run 307 closed normally without a logged exception/device removal. Final three host intervals: 42.7/44.3/43.1 ms (23.4/22.6/23.2 FPS). Last eight queued GPU bracket readings: 38.3–39.4 ms/frame, 29 stamped submissions/frame, zero skipped samples. The brackets include runtime work, exclude other helpers, and use delayed samples divided by current host frame counts; they are not completed-frame percentiles or pure title time. No gameplay speedup is claimed. The measurement lifetime repair is ready for review; releasing the implementation claim. PR remains open and unmerged.
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-27 21:08 UTC · original

Thanks. This is implemented in PR #144, so the change is tracked there now. Closing the issue to keep one place for it.

**@⁠trustno1-coder** on GitHub · 2026-11-27 21:08 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/issues/136#issuecomment-7228169545) Thanks. This is implemented in PR #144, so the change is tracked there now. Closing the issue to keep one place for it.
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA#136
No description provided.