GPU: register pipeline demand after asynchronous compilation timeout #1643

Closed
github-bot wants to merge 1 commit from gh-pr/1643/head into gh-pr/1643/base
Owner

@⁠santiago-andreiu on GitHub · 2026-11-24 20:19 UTC · original
santiago-andreiu:nvidia-gpu-compatibility → main · +157 −27 · 2 files · 1 commits · closed without merging

<html>

Problem

Pipeline demand is currently recorded only when ready() returns a successfully compiled pipeline.

When a draw or dispatch exceeds the 500 ms waiting budget and the compilation worker completes afterward, the pipeline may never be registered in the early pipeline list unless another rendering operation requests it.

This can cause the same compilation delay to recur in subsequent runs.

Root Cause

Rendering demand and asynchronous compilation completion were not tracked independently. A successful compilation occurring after the waiting budget expired could therefore remain unregistered.

Implementation

Introduce independent atomic event tracking using AtomicU8:

  • REQUESTED: actual rendering demand has occurred.

  • COMPILED: pipeline compilation has completed successfully.

The operation that adds the second distinct event registers the pipeline through note_used().

This approach:

  • Supports either event ordering.

  • Prevents duplicate registration per Pending instance.

  • Excludes purely speculative warmups.

  • Excludes unsuccessful compilations.

  • Preserves pipeline publication through OnceLock.

  • Preserves the existing waiting budget, cache format and retention policy.

Modified Files

  • crates/victory-gpu/src/pipeline/make.rs

  • crates/victory-gpu/src/pipeline/library.rs

Regression Tests

Four CPU-only regression tests were added:

  • late_success_registers_demand_without_a_second_draw

  • warmup_registers_only_on_real_demand_and_only_once

  • failed_compilation_never_registers_demand

  • demand_and_compilation_on_separate_threads_register_once

The late-completion regression test was confirmed to fail before the correction and pass afterward.

Validation

Check | Result -- | -- Default GPU tests | 54 passed, 0 failed, 1 ignored GPU tests with all features | 57 passed, 0 failed, 1 ignored Workspace Clippy, default features | Passed Workspace Clippy, all features | Passed Repository asset policy | Passed Git diff check | Passed

Existing rustfmt discrepancies were reproduced on the original code and were intentionally left unchanged.

Testing Environment

  • CPU: Intel Core i5-12600KF

  • GPU: NVIDIA GeForce RTX 3060 12 GB

  • RAM: 20 GB

  • OS: Windows x64

Known Limitations

This change does not recover rendering operations already discarded after a timeout.

A worker completing after the final cache snapshot during process termination may still produce a registration that is not persisted. Shutdown synchronization is intentionally outside the scope of this contribution.

No in-game rendering or performance improvements have been measured.

Related Work

PR #983 addresses the retention policy of the early pipeline list. This contribution addresses when successfully compiled pipelines become eligible for registration.

The changes are intended to complement each other.

Development Disclosure

Development and testing were assisted by OpenAI Codex. No proprietary game assets were used.

</html>
**@⁠santiago-andreiu** on GitHub · 2026-11-24 20:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/1643) `santiago-andreiu:nvidia-gpu-compatibility` → `main` · +157 −27 · 2 files · 1 commits · closed without merging <html><body> <!--StartFragment--><h2><span>Problem</span></h2><p><span>Pipeline demand is currently recorded only when </span><code><span>ready()</span></code><span> returns a successfully compiled pipeline.</span></p><p><span>When a draw or dispatch exceeds the 500 ms waiting budget and the compilation worker completes afterward, the pipeline may never be registered in the early pipeline list unless another rendering operation requests it.</span></p><p><span>This can cause the same compilation delay to recur in subsequent runs.</span></p><h2><span>Root Cause</span></h2><p><span>Rendering demand and asynchronous compilation completion were not tracked independently. A successful compilation occurring after the waiting budget expired could therefore remain unregistered.</span></p><h2><span>Implementation</span></h2><p><span>Introduce independent atomic event tracking using </span><code><span>AtomicU8</span></code><span>:</span></p><ul><li><p><code><span>REQUESTED</span></code><span>: actual rendering demand has occurred.</span></p></li><li><p><code><span>COMPILED</span></code><span>: pipeline compilation has completed successfully.</span></p></li></ul><p><span>The operation that adds the second distinct event registers the pipeline through </span><code><span>note_used()</span></code><span>.</span></p><p><span>This approach:</span></p><ul><li><p><span>Supports either event ordering.</span></p></li><li><p><span>Prevents duplicate registration per </span><code><span>Pending</span></code><span> instance.</span></p></li><li><p><span>Excludes purely speculative warmups.</span></p></li><li><p><span>Excludes unsuccessful compilations.</span></p></li><li><p><span>Preserves pipeline publication through </span><code><span>OnceLock</span></code><span>.</span></p></li><li><p><span>Preserves the existing waiting budget, cache format and retention policy.</span></p></li></ul><h2><span>Modified Files</span></h2><ul><li><p><code><span>crates/victory-gpu/src/pipeline/make.rs</span></code></p></li><li><p><code><span>crates/victory-gpu/src/pipeline/library.rs</span></code></p></li></ul><h2><span>Regression Tests</span></h2><p><span>Four CPU-only regression tests were added:</span></p><ul><li><p><code><span>late_success_registers_demand_without_a_second_draw</span></code></p></li><li><p><code><span>warmup_registers_only_on_real_demand_and_only_once</span></code></p></li><li><p><code><span>failed_compilation_never_registers_demand</span></code></p></li><li><p><code><span>demand_and_compilation_on_separate_threads_register_once</span></code></p></li></ul><p><span>The late-completion regression test was confirmed to fail before the correction and pass afterward.</span></p><h2><span>Validation</span></h2> Check | Result -- | -- Default GPU tests | 54 passed, 0 failed, 1 ignored GPU tests with all features | 57 passed, 0 failed, 1 ignored Workspace Clippy, default features | Passed Workspace Clippy, all features | Passed Repository asset policy | Passed Git diff check | Passed <p><span>Existing rustfmt discrepancies were reproduced on the original code and were intentionally left unchanged.</span></p><h2><span>Testing Environment</span></h2><ul><li><p><span>CPU: Intel Core i5-12600KF</span></p></li><li><p><span>GPU: NVIDIA GeForce RTX 3060 12 GB</span></p></li><li><p><span>RAM: 20 GB</span></p></li><li><p><span>OS: Windows x64</span></p></li></ul><h2><span>Known Limitations</span></h2><p><span>This change does not recover rendering operations already discarded after a timeout.</span></p><p><span>A worker completing after the final cache snapshot during process termination may still produce a registration that is not persisted. Shutdown synchronization is intentionally outside the scope of this contribution.</span></p><p><span>No in-game rendering or performance improvements have been measured.</span></p><h2><span>Related Work</span></h2><p><span>PR #983 addresses the retention policy of the early pipeline list. This contribution addresses when successfully compiled pipelines become eligible for registration.</span></p><p><span>The changes are intended to complement each other.</span></p><h2><span>Development Disclosure</span></h2><p><span>Development and testing were assisted by OpenAI Codex. No proprietary game assets were used.</span></p><!--EndFragment--> </body> </html>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:39:32 +00:00
github-bot closed this pull request 2026-11-26 04:39:32 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:22 UTC · original

Automated triage for the maintainers. Closing because this change is already in main, or main has since replaced the code it patches.

Already in main, and more: ready() lists a pipeline for an early start at its first use whether or not it was made in time (make.rs). Body is pasted HTML.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

**@⁠Marvisak** on GitHub · 2026-11-25 01:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1643#issuecomment-7149482694) Automated triage for the maintainers. Closing because this change is already in `main`, or `main` has since replaced the code it patches. Already in main, and more: ready() lists a pipeline for an early start at its first use whether or not it was made in time (make.rs). Body is pasted HTML. If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:33 UTC · original

Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-gpu/src/pipeline/library.rs, crates/victory-gpu/src/pipeline/make.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/1643#issuecomment-7149676271) <!-- victory-triage v1 head=c79f4c8912545193565048f9799844af79f2edc9 verdict=needs-rebase at=2026-11-25T01:33:04Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-gpu/src/pipeline/library.rs`, `crates/victory-gpu/src/pipeline/make.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!1643
No description provided.