D3D12.X: add opt-in per-frame PSO wait budget (XCL_PSO_FRAME_WAIT_MS) #1921

Open
gsucristo wants to merge 1 commit from upstream-pr/1931 into main
gsucristo commented 2026-11-24 23:40:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gsucristo on 2026-11-24T23:40:45Z.


Adds an opt-in shared per-frame wait budget (XCL_PSO_FRAME_WAIT_MS=<ms>, off by default) for pso_async::resolve_wait. When a title binds dozens of uncompiled compute pipelines in a single frame, a per-pipeline timeout (XCL_PSO_WAIT_MS) multiplies across each pending pipeline and can stall a frame for seconds; sharing one budget across the frame caps total stall time and refills on PresentX.

What is in it

  • crates/xcl/src/hle/d3d12x/pso_async.rs: parse XCL_PSO_FRAME_WAIT_MS, track remaining microsecond wait budget for the current frame, cap each resolve_wait by min(XCL_PSO_WAIT_MS, frame_remaining), deduct elapsed wait time, and expose begin_frame() to refill the budget. Pipelines skipped solely because the frame budget ran out are not marked permanently late, so they can still be waited for on the next frame if not finished by a worker yet.
  • crates/xcl/src/hle/d3d12x/present.rs: call super::pso_async::begin_frame() in present_x_frame.
  • README.md: document XCL_PSO_FRAME_WAIT_MS.
  • Unit test shared_frame_budget_caps_multiple_slow_pipelines_and_refills_on_next_frame verifying that a second pending pipeline returns immediately once the shared frame budget is spent and resolves after refill.

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 4090 (Linux NVIDIA driver 610.57.4 via Proton / Wine + vkd3d-proton), AMD Ryzen 9 7950X3D, rustc 1.98.1, debug test build cross-compiled to x86_64-pc-windows-msvc
  • cargo test --target x86_64-pc-windows-msvc -p xcl --lib -- pso_async::: 7 passed, 0 failed, 0 ignored

Regression run

main:

PR:

Not tested

  • Native Windows 10/11 build and full cargo test --workspace -- --test-threads=4
  • scripts/smoke.ps1 regression run on main and this PR (required before leaving draft)

AI use

  • Antigravity (exact model name not provided to the agent): implemented the per-frame budget, unit test, README note, ran the pso_async:: unit tests under Wine, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5482233308 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931). Originally posted by [gsucristo](https://github.com/gsucristo) on 2026-11-24T23:40:45Z. --- Adds an opt-in shared per-frame wait budget (`XCL_PSO_FRAME_WAIT_MS=<ms>`, off by default) for `pso_async::resolve_wait`. When a title binds dozens of uncompiled compute pipelines in a single frame, a per-pipeline timeout (`XCL_PSO_WAIT_MS`) multiplies across each pending pipeline and can stall a frame for seconds; sharing one budget across the frame caps total stall time and refills on `PresentX`. **What is in it** - `crates/xcl/src/hle/d3d12x/pso_async.rs`: parse `XCL_PSO_FRAME_WAIT_MS`, track remaining microsecond wait budget for the current frame, cap each `resolve_wait` by `min(XCL_PSO_WAIT_MS, frame_remaining)`, deduct elapsed wait time, and expose `begin_frame()` to refill the budget. Pipelines skipped solely because the frame budget ran out are not marked permanently `late`, so they can still be waited for on the next frame if not finished by a worker yet. - `crates/xcl/src/hle/d3d12x/present.rs`: call `super::pso_async::begin_frame()` in `present_x_frame`. - `README.md`: document `XCL_PSO_FRAME_WAIT_MS`. - Unit test `shared_frame_budget_caps_multiple_slow_pipelines_and_refills_on_next_frame` verifying that a second pending pipeline returns immediately once the shared frame budget is spent and resolves after refill. **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce RTX 4090 (Linux NVIDIA driver 610.57.4 via Proton / Wine + vkd3d-proton), AMD Ryzen 9 7950X3D, `rustc 1.98.1`, debug test build cross-compiled to `x86_64-pc-windows-msvc` - `cargo test --target x86_64-pc-windows-msvc -p xcl --lib -- pso_async::`: 7 passed, 0 failed, 0 ignored **Regression run** main: PR: **Not tested** - Native Windows 10/11 build and full `cargo test --workspace -- --test-threads=4` - `scripts/smoke.ps1` regression run on main and this PR (required before leaving draft) **AI use** - Antigravity (exact model name not provided to the agent): implemented the per-frame budget, unit test, README note, ran the `pso_async::` unit tests under Wine, and drafted this PR description.
raylitebull commented 2026-11-25 01:10:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T00:57:07Z.


Code review on \e870dd2:\n\n- \XCL_PSO_FRAME_WAIT_MS\ in \pso_async.rs\ and \present.rs\ cleanly shares a microsecond per-frame budget across
esolve_wait\ calls, refills on \PresentX, avoids marking frame-budget-exhausted pipelines permanently \late, and handles \udget.is_zero()\ after \p.want(). \Build and test (Windows, no GPU)\ is green.\n\nWhat is still needed before merge:\n1. Fix the \PR description\ check (include an exact-head \xcl-smoke\ pair in the PR body for \hle/d3d12x/*\ changes).\n2. Independent AMD and NVIDIA verification on \e870dd2.

<!-- greyfinch-sync:ivall/xcl:comment:7149056208 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#issuecomment-7149056208). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T00:57:07Z. --- Code review on \e870dd2\:\n\n- \XCL_PSO_FRAME_WAIT_MS\ in \pso_async.rs\ and \present.rs\ cleanly shares a microsecond per-frame budget across \ esolve_wait\ calls, refills on \PresentX\, avoids marking frame-budget-exhausted pipelines permanently \late\, and handles \udget.is_zero()\ after \p.want()\. \Build and test (Windows, no GPU)\ is green.\n\n**What is still needed before merge:**\n1. Fix the \PR description\ check (include an exact-head \xcl-smoke\ pair in the PR body for \hle/d3d12x/*\ changes).\n2. Independent **AMD** and **NVIDIA** verification on \e870dd2\.
Pipodi commented 2026-11-25 02:08:52 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-25T01:35:26Z.


Test report: #1931 on the retail title's world load

I tested head e870dd2, merged without conflicts onto main bf9eebd (local merge 2bce47f), in a release build. The title stops presenting at about 76 s on main. With XCL_PSO_FRAME_WAIT_MS=500 it gets past that point, but then it crawls, and with a warm cache it crashes.

Setup

  • RTX 4090 (driver 617.42), i9-13900K, 32 GB, Windows 11 Pro 26300.
  • 300 s runs, XCL_PRESS_AT=16:A, default settings otherwise (no direct DXIL, no heap windows).

Results

main bf9eebd, fresh cache #1931 at 500 ms, fresh cache #1931 at 500 ms, warm cache (the fresh run's)
presents end 76 s, then none until 300 s 0–4 per 10 s after ~100 s, until 289 s 1–6 per 10 s after 76 s; last at 128 s
frames 1368 1391 1397
queue.Wait watchdog lines 0 163 (111–246 s) 25 (127–133 s)
draws: translated / skipped – 15,602 / 49,886 14,406 / 27,447
dispatches: run / skipped – 40,487 / 77,580 52,914 / 14,469
peak commit 29.6 GB 46.9 GB 38.8 GB
end alive at 300 s alive at 300 s access violation at 134 s, title code reading 0xFFFFFFFFFFFFFFFF; no device removal

Findings

  • The budget works as described: binds that wait past the budget skip their draws and dispatches, and the title keeps presenting.
  • The warm cache doesn't fix the crawl: with the pipelines built, it skips far fewer dispatches, but presents stay at a few per 10 s. So the wait that remains is not only pipeline builds.
  • The crash follows a burst of bridged queue.Wait timeouts: each waits on a value one step past what the GPU has completed. It is the same access violation @STmihan reported on #1269 (comment), which they tie to split recordings whose older segments are not reset. I did not test that fix; it has no PR. #1993 conflicts with main in sparse.rs, so I did not run it.

Not tested

  • Other budgets (only 500 ms).
  • Runs longer than 300 s.
  • More than one run per configuration.
  • XCL_DIRECT_DXIL, heap windows, AMD.

AI use

  • Claude Code. Claude Sonnet 5.5 (a second session) ran the three title runs and read the logs.
  • Claude Opus 5.5 checked the numbers and wrote this report.
<!-- greyfinch-sync:ivall/xcl:comment:7149723141 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#issuecomment-7149723141). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-11-25T01:35:26Z. --- **Test report: #1931 on the retail title's world load** I tested head `e870dd2`, merged without conflicts onto `main` `bf9eebd` (local merge `2bce47f`), in a release build. The title stops presenting at about 76 s on `main`. With `XCL_PSO_FRAME_WAIT_MS=500` it gets past that point, but then it crawls, and with a warm cache it crashes. **Setup** - RTX 4090 (driver 617.42), i9-13900K, 32 GB, Windows 11 Pro 26300. - 300 s runs, `XCL_PRESS_AT=16:A`, default settings otherwise (no direct DXIL, no heap windows). **Results** | | `main` `bf9eebd`, fresh cache | #1931 at 500 ms, fresh cache | #1931 at 500 ms, warm cache (the fresh run's) | |---|---|---|---| | presents end | 76 s, then none until 300 s | 0–4 per 10 s after ~100 s, until 289 s | 1–6 per 10 s after 76 s; last at 128 s | | frames | 1368 | 1391 | 1397 | | `queue.Wait` watchdog lines | 0 | 163 (111–246 s) | 25 (127–133 s) | | draws: translated / skipped | – | 15,602 / 49,886 | 14,406 / 27,447 | | dispatches: run / skipped | – | 40,487 / 77,580 | 52,914 / 14,469 | | peak commit | 29.6 GB | 46.9 GB | 38.8 GB | | end | alive at 300 s | alive at 300 s | access violation at 134 s, title code reading `0xFFFFFFFFFFFFFFFF`; no device removal | **Findings** - **The budget works as described:** binds that wait past the budget skip their draws and dispatches, and the title keeps presenting. - **The warm cache doesn't fix the crawl:** with the pipelines built, it skips far fewer dispatches, but presents stay at a few per 10 s. So the wait that remains is not only pipeline builds. - **The crash follows a burst of bridged `queue.Wait` timeouts:** each waits on a value one step past what the GPU has completed. It is the same access violation @STmihan reported on #1269 ([comment](https://github.com/xcl-dev/xcl/issues/1269#issuecomment-7149397612)), which they tie to split recordings whose older segments are not reset. I did not test that fix; it has no PR. #1993 conflicts with `main` in `sparse.rs`, so I did not run it. **Not tested** - Other budgets (only 500 ms). - Runs longer than 300 s. - More than one run per configuration. - `XCL_DIRECT_DXIL`, heap windows, AMD. **AI use** - Claude Code. Claude Sonnet 5.5 (a second session) ran the three title runs and read the logs. - Claude Opus 5.5 checked the numbers and wrote this report.
DavidM1911 commented 2026-11-25 03:05:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T02:40:59Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7151040969 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#issuecomment-7151040969). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T02:40:59Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
Dezmonius commented 2026-11-25 07:05:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Dezmonius on 2026-11-25T06:54:07Z.


Native Windows comparison of the runtime hunks from e870dd2, applied to cbc296ab with the same local DirectStorage late-page adaptation and activity counters in both runs. RTX 5070 / 610.88, i7-7700K, 32 GiB RAM, Windows 10 19045, Rust 1.100.0 release. Both runs were offline with direct DXIL, Series X profile, same scripted input and same warm cache location. XCL_PSO_WAIT_MS=1000 in both; the 500 ms frame budget ran second.

Frame budget off Frame budget 500 ms
PresentX calls (sampled) 817 821
Last 2 s activity sample with presents (one-based) 93 106
Samples reporting a title thread waiting for PSO 53 1
GPU queue.Wait watchdog releases 0 10
Timing/end 300 s timer, exit 0 title exception 0xc0000005 at 266.6 s

The enabled run had only a few later presents. The last sampled image remained loading artwork, and I did not verify any rendered gameplay. The final queue timeouts included a producer whose fence had been submitted but was still one value short of the requested completion. This directly shows the PSO wait signal dropping and queue timeouts appearing in this pair, without establishing that the timeouts caused the crash.

cargo test --locked --offline -j 4 -p xcl --lib pso_async:: -- --test-threads=1: 7 passed, 0 failed, 0 ignored on the candidate. Full suite not run. No game assets or raw logs attached. AI-assisted (OpenAI Codex, GPT-6).

<!-- greyfinch-sync:ivall/xcl:comment:7155276940 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#issuecomment-7155276940). Originally posted by [Dezmonius](https://github.com/Dezmonius) on 2026-11-25T06:54:07Z. --- Native Windows comparison of the runtime hunks from `e870dd2`, applied to `cbc296ab` with the same local DirectStorage late-page adaptation and activity counters in both runs. RTX 5070 / 610.88, i7-7700K, 32 GiB RAM, Windows 10 19045, Rust 1.100.0 release. Both runs were offline with direct DXIL, Series X profile, same scripted input and same warm cache location. `XCL_PSO_WAIT_MS=1000` in both; the 500 ms frame budget ran second. | | Frame budget off | Frame budget 500 ms | | --- | ---: | ---: | | PresentX calls (sampled) | 817 | 821 | | Last 2 s activity sample with presents (one-based) | 93 | 106 | | Samples reporting a title thread waiting for PSO | 53 | 1 | | GPU queue.Wait watchdog releases | 0 | 10 | | Timing/end | 300 s timer, exit 0 | title exception 0xc0000005 at 266.6 s | The enabled run had only a few later presents. The last sampled image remained loading artwork, and I did not verify any rendered gameplay. The final queue timeouts included a producer whose fence had been submitted but was still one value short of the requested completion. This directly shows the PSO wait signal dropping and queue timeouts appearing in this pair, without establishing that the timeouts caused the crash. `cargo test --locked --offline -j 4 -p xcl --lib pso_async:: -- --test-threads=1`: 7 passed, 0 failed, 0 ignored on the candidate. Full suite not run. No game assets or raw logs attached. AI-assisted (OpenAI Codex, GPT-6).
Pipodi commented 2026-11-25 08:08:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Pipodi on 2026-11-25T07:25:17Z.


Test report for e870dd2 (this PR's head) on main 568e7db, alone and together with #929 (b3a969b), on the retail title.

Builds: local merges, never pushed. This PR conflicts with main in README.md only; that conflict was resolved to main's side, and no code conflicted.

  • 5ada3de = main + this PR (present.rs +1, pso_async.rs +127/−7).
  • 80ffe43 = main + this PR + #929, merged one at a time (adds title_list.rs +167).

Tested

  • RTX 4090 (driver 617.42), i9-13900K, 32 GB, Windows 11 Pro 26300, release.
  • xcl run of the retail title for 300 s, with a new empty XCL_DXIL_CACHE per run. One run per row.
build env last window with presents frames end peak commit queue.Wait watchdog lines draws translated / skipped dispatches / skipped
main 568e7db default 70.0 s 1,347 alive to 300 s, exit 0 30.1 GB – 12,127 / 0 8,192 / 0
5ada3de (this PR) XCL_PSO_FRAME_WAIT_MS=500 158.1 s 1,414 access violation at 193.3 s (write at 0x0, title +0x23cf683) 38.2 GB 89 (111.6–167.0 s) 16,475 / 44,579 65,536 / 35,754
80ffe43 (this PR + #929) XCL_PSO_FRAME_WAIT_MS=500 290.2 s 1,415 access violation at 293.7 s (read, title +0x4e51965) 45.7 GB (46.8 GB at 290 s) 3 (150.3–155.0 s) 19,330 / 113,080 131,072 / 90,967
  • With the wait budget, the title presents past main's stop at about 70 s, but slowly. Presents per 10 s after the stop:
    • this PR: 8, 9, 3, 4, 1, 2, 3, 1, 2 (to 158 s), then none;
    • with #929: 25, 7, 9, 6, 5, 3, 1, 5, 3, 4, 3, 2, 3, 3, 3, 4, 1, 2, 1, 1, 3, 2, 2, 0 (to 290 s).
  • Adding #929 kept the title presenting about 130 s longer, and the watchdog lines went from 89 to 3. The access violation moved from a null write at +0x23cf683 (the offset seen on main in earlier runs) to a later bad read.
  • In both runs most of the work after the stop is skipped draws and dispatches, and peak commit grows with the run's length.
  • No device removal in any run.

Not tested

  • Other XCL_PSO_FRAME_WAIT_MS values, a warm cache, and more than one run per build.
  • AMD and other titles.
  • What causes either access violation.

AI use: Claude Code. A Claude Sonnet 5.5 session made the local merges, ran the title runs and collected the counts; Claude Opus 5.5 wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7155840748 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#issuecomment-7155840748). Originally posted by [Pipodi](https://github.com/Pipodi) on 2026-11-25T07:25:17Z. --- Test report for `e870dd2` (this PR's head) on `main` `568e7db`, alone and together with #929 (`b3a969b`), on the retail title. **Builds:** local merges, never pushed. This PR conflicts with `main` in `README.md` only; that conflict was resolved to `main`'s side, and no code conflicted. - `5ada3de` = `main` + this PR (`present.rs` +1, `pso_async.rs` +127/−7). - `80ffe43` = `main` + this PR + #929, merged one at a time (adds `title_list.rs` +167). **Tested** - RTX 4090 (driver 617.42), i9-13900K, 32 GB, Windows 11 Pro 26300, release. - `xcl run` of the retail title for 300 s, with a new empty `XCL_DXIL_CACHE` per run. One run per row. | build | env | last window with presents | frames | end | peak commit | `queue.Wait` watchdog lines | draws translated / skipped | dispatches / skipped | |---|---|---|---|---|---|---|---|---| | `main` `568e7db` | default | 70.0 s | 1,347 | alive to 300 s, exit 0 | 30.1 GB | – | 12,127 / 0 | 8,192 / 0 | | `5ada3de` (this PR) | `XCL_PSO_FRAME_WAIT_MS=500` | 158.1 s | 1,414 | access violation at 193.3 s (write at 0x0, title `+0x23cf683`) | 38.2 GB | 89 (111.6–167.0 s) | 16,475 / 44,579 | 65,536 / 35,754 | | `80ffe43` (this PR + #929) | `XCL_PSO_FRAME_WAIT_MS=500` | 290.2 s | 1,415 | access violation at 293.7 s (read, title `+0x4e51965`) | 45.7 GB (46.8 GB at 290 s) | 3 (150.3–155.0 s) | 19,330 / 113,080 | 131,072 / 90,967 | - With the wait budget, the title presents past `main`'s stop at about 70 s, but slowly. Presents per 10 s after the stop: - this PR: 8, 9, 3, 4, 1, 2, 3, 1, 2 (to 158 s), then none; - with #929: 25, 7, 9, 6, 5, 3, 1, 5, 3, 4, 3, 2, 3, 3, 3, 4, 1, 2, 1, 1, 3, 2, 2, 0 (to 290 s). - Adding #929 kept the title presenting about 130 s longer, and the watchdog lines went from 89 to 3. The access violation moved from a null write at `+0x23cf683` (the offset seen on `main` in earlier runs) to a later bad read. - In both runs most of the work after the stop is skipped draws and dispatches, and peak commit grows with the run's length. - No device removal in any run. **Not tested** - Other `XCL_PSO_FRAME_WAIT_MS` values, a warm cache, and more than one run per build. - AMD and other titles. - What causes either access violation. AI use: Claude Code. A Claude Sonnet 5.5 session made the local merges, ran the title runs and collected the counts; Claude Opus 5.5 wrote this report.
throny commented 2026-11-26 01:05:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-26T00:48:19Z.


Two contributors checked independently and found that #1652 #2114 solves the same problem (for #505) in a different way: #1607, group D95. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

<!-- greyfinch-sync:ivall/xcl:comment:7179130476 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#issuecomment-7179130476). Originally posted by [throny](https://github.com/throny) on 2026-11-26T00:48:19Z. --- <!-- xcl-1607-hint:D95 --> Two contributors checked independently and found that #1652 #2114 solves the same problem (for #505) in a different way: #1607, group D95. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
luckyteagirl commented 2026-11-26 09:04:28 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T09:04:28Z.

Review: COMMENTED


On e870dd2, the frame budget is read before resolve_wait_for_ex and debited only after it returns. Two title threads resolving different pending PSOs can each read the same 40 ms remaining value, each wait for 40 ms, and then subtract 40 ms. That admits roughly 80 ms of aggregate bind waiting in a frame whose setting promises a 40 ms total cap. The sequential unit test at lines 511–543 does not exercise simultaneous callers.

There is a related frame-boundary race: begin_frame stores the new frame's allowance while an old wait is still in flight; the old wait's later consume_frame_budget subtracts its elapsed time from the new frame. Could each caller reserve its allowance atomically before sleeping, then refund unused time only to the frame generation it reserved from? A barrier fixture that starts two pending binds together, plus one that refills during an outstanding wait, would cover both cases.

This is an exact-head source review. I did not run a concurrent repro or title smoke test.

<!-- greyfinch-sync:ivall/xcl:review:6071161414 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#pullrequestreview-6071161414). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T09:04:28Z. **Review:** COMMENTED --- On `e870dd2`, the frame budget is read before `resolve_wait_for_ex` and debited only after it returns. Two title threads resolving different pending PSOs can each read the same 40 ms remaining value, each wait for 40 ms, and then subtract 40 ms. That admits roughly 80 ms of aggregate bind waiting in a frame whose setting promises a 40 ms total cap. The sequential unit test at lines 511–543 does not exercise simultaneous callers. There is a related frame-boundary race: `begin_frame` stores the new frame's allowance while an old wait is still in flight; the old wait's later `consume_frame_budget` subtracts its elapsed time from the *new* frame. Could each caller reserve its allowance atomically before sleeping, then refund unused time only to the frame generation it reserved from? A barrier fixture that starts two pending binds together, plus one that refills during an outstanding wait, would cover both cases. This is an exact-head source review. I did not run a concurrent repro or title smoke test.
Foniass commented 2026-12-01 06:58:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:58:12Z.


Review (head e870dd2b, diff read, not a merge-check; draft and conflicting, with PR description red):

  • The pso_async hunks no longer apply. Main has rewritten resolve_wait (now resolve_wait_budgets) and resolve_within, added XCL_CS_PSO_WAIT_MS and a per-thread, per-second graphics budget (5904ad4b), and moved compute waits to the submit (#2118), so a rebase is a redesign against that code. Main has no per-frame budget; open #2988 adds a graphics frame budget and also conflicts.
  • The test doesn't exercise the change: it keeps its own counter (frame_rem, pso_async.rs ~514-522) and never calls resolve_wait, begin_frame (~673) or consume_frame_budget (~663).
  • With only XCL_PSO_FRAME_WAIT_MS set, compute pipelines that were waited for until built get their dispatches skipped once the frame budget runs out (~577-597); main's docs say a skipped dispatch corrupts what it computes, and the README should say so. Concurrent waits on different threads each subtract their full wait from the one shared budget, so it runs out faster than the frame's wall-clock time.
  • No xcl-smoke blocks (why PR description fails); AI use doesn't name the model.

Fine: opt-in and off by default, refilled from present_x_frame, and it doesn't mark pipelines late when only the frame budget ran out. Recommendation: rewrite on main's budget code with a test through resolve_wait / begin_frame, or close in favour of the per-thread budget main has.

AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.

<!-- greyfinch-sync:ivall/xcl:comment:7303492349 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#issuecomment-7303492349). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:58:12Z. --- Review (head e870dd2b, diff read, not a merge-check; draft and conflicting, with `PR description` red): - **The pso_async hunks no longer apply.** Main has rewritten `resolve_wait` (now `resolve_wait_budgets`) and `resolve_within`, added `XCL_CS_PSO_WAIT_MS` and a per-thread, per-second graphics budget (5904ad4b), and moved compute waits to the submit (#2118), so a rebase is a redesign against that code. Main has no per-frame budget; open #2988 adds a graphics frame budget and also conflicts. - **The test doesn't exercise the change:** it keeps its own counter (`frame_rem`, `pso_async.rs` ~514-522) and never calls `resolve_wait`, `begin_frame` (~673) or `consume_frame_budget` (~663). - With only `XCL_PSO_FRAME_WAIT_MS` set, compute pipelines that were waited for until built get their dispatches skipped once the frame budget runs out (~577-597); main's docs say a skipped dispatch corrupts what it computes, and the README should say so. Concurrent waits on different threads each subtract their full wait from the one shared budget, so it runs out faster than the frame's wall-clock time. - No xcl-smoke blocks (why `PR description` fails); AI use doesn't name the model. Fine: opt-in and off by default, refilled from `present_x_frame`, and it doesn't mark pipelines `late` when only the frame budget ran out. Recommendation: rewrite on main's budget code with a test through `resolve_wait` / `begin_frame`, or close in favour of the per-thread budget main has. AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Foniass commented 2026-12-01 07:06:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:06:33Z.


Triage (#1607) – head e870dd2

Overlaps the D95 group. #2114 caps bind waits per PresentX frame by default (250 ms per pipeline, 2 s per frame) and isolates the queues per lane. #1652 carries an earlier version, bundled with unrelated changes. This PR is an opt-in global budget (XCL_PSO_FRAME_WAIT_MS) that is refilled in present_x_frame. Main has since added its own cumulative limit (5904ad4b, XCL_GFX_PSO_WAIT_MS as a per-thread share of a second, gfx_wait_left) and a separate XCL_CS_PSO_WAIT_MS for compute. resolve_wait has been rewritten, so this needs a rebase onto that design.
Problems in the diff:

  • The test shared_frame_budget_caps_multiple_slow_pipelines_and_refills_on_next_frame re-implements the budget in a local closure with its own AtomicU64. It never calls resolve_wait, frame_budget_remaining, consume_frame_budget or begin_frame, so the new code is not tested.
  • The frame budget also applies to compute pipelines: a dispatch is skipped when the budget runs out. Main deliberately avoids skipping dispatches unless XCL_CS_PSO_WAIT_MS is set.
    Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7303654808 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1931#issuecomment-7303654808). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:06:33Z. --- **Triage (#1607)** – head e870dd2 Overlaps the D95 group. #2114 caps bind waits per PresentX frame by default (250 ms per pipeline, 2 s per frame) and isolates the queues per lane. #1652 carries an earlier version, bundled with unrelated changes. This PR is an opt-in global budget (`XCL_PSO_FRAME_WAIT_MS`) that is refilled in `present_x_frame`. Main has since added its own cumulative limit (5904ad4b, `XCL_GFX_PSO_WAIT_MS` as a per-thread share of a second, `gfx_wait_left`) and a separate `XCL_CS_PSO_WAIT_MS` for compute. `resolve_wait` has been rewritten, so this needs a rebase onto that design. Problems in the diff: - The test `shared_frame_budget_caps_multiple_slow_pipelines_and_refills_on_next_frame` re-implements the budget in a local closure with its own `AtomicU64`. It never calls `resolve_wait`, `frame_budget_remaining`, `consume_frame_budget` or `begin_frame`, so the new code is not tested. - The frame budget also applies to compute pipelines: a dispatch is skipped when the budget runs out. Main deliberately avoids skipping dispatches unless `XCL_CS_PSO_WAIT_MS` is set. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1931:upstream-pr/1931'
git switch 'upstream-pr/1931'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1931'
git switch 'upstream-pr/1931'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1931'
git switch 'upstream-pr/1931'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1931'
git switch 'main'
git merge --squash 'upstream-pr/1931'
git switch 'main'
git merge --ff-only 'upstream-pr/1931'
git switch 'main'
git merge 'upstream-pr/1931'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
xcl-dev/xcl!1921
No description provided.