Skip to content

D3D12.X: retained binds wait by the graphics and compute PSO budgets - #3579

Closed
raylitebull wants to merge 1 commit into
mainfrom
fix/retained-pso-budgets
Closed

raylitebull wants to merge 1 commit into
mainfrom
fix/retained-pso-budgets

Conversation

@raylitebull

Copy link
Copy Markdown
Member

bind.rs resolve_pipeline uses resolve_retained_for_emission for retained draws and dispatches, and that function waited for a pipeline still being built by XCL_PSO_WAIT_MS alone. XCL_GFX_PSO_WAIT_MS and XCL_CS_PSO_WAIT_MS, which resolve_wait honours, did not apply there. So with only those set, a retained bind held the title's thread until its pipeline was built. Nothing changes while the budgets are unset, which is the default.

What is in it

  • pso_async.rs: resolve_wait_pending_budgets applies resolve_wait_budgets' policy to the retained Pending: the graphics budget as a share of the thread's time, the compute one by budget_for. It does this without looking the title address up again.
  • Not ported from amd-dev: its override for kept (bake) pipelines, which main does not have.
  • Test: a_retained_bind_waits_by_the_budget_of_its_kind.

Tested

  • No Windows machine or GPU here: a Linux x86_64 cloud machine (Ubuntu 24.04), rustc 1.99.0, debug build.
  • cargo check --workspace --all-targets --target x86_64-pc-windows-gnu: no errors, no new warnings.
  • The lib unit tests of the touched modules, built for x86_64-pc-windows-gnu and run under Wine 9.0 (no GPU) with --test-threads=4, next to the same filters on main b2b1f109:
    • hle::d3d12x::pso_async: 194 passed, 0 failed (main: 193 / 0)
      The failures are the same tests on both, ones that need a D3D12 device or Windows' working-set queries, which Wine lacks.

Regression run
Not run yet: there was no Windows machine or title here. scripts/smoke.ps1 still has to run on a title, built from main and from this head, so PR checks fails until those two blocks are added.

Not tested

  • The Windows (MSVC) build and the whole suite (cargo test --workspace -- --test-threads=4) on Windows, with or without a GPU; CI's no-GPU job is the first Windows run.
  • Any title on main, and any performance on main: the numbers above are from amd-dev.

AI use

  • Capy with Claude Opus 5.5 ported raylitebull's amd-dev commit 4d6d4a77 to main, split it into this PR and five others, and wrote the test, the commit message and this description. The amd-dev measurements are raylitebull's own runs.

Open in Capy

resolve_retained_for_emission, which bind.rs resolve_pipeline uses for
retained draws and dispatches, waited for a pipeline still being built by
XCL_PSO_WAIT_MS alone. XCL_GFX_PSO_WAIT_MS and XCL_CS_PSO_WAIT_MS, which
resolve_wait honours, did not apply there: with only those set, a retained
bind held the title's thread until its pipeline was built.

resolve_wait_pending_budgets applies resolve_wait_budgets' policy to the
retained Pending, without looking its title address up again. Nothing
changes while the budgets are unset (the default).

Ported from amd-dev 4d6d4a7; its kept-pipeline override has no
counterpart on main.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot added area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) labels Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Review (head 398acfe, diff read, not a merge-check; draft):

Fine: the graphics branch uses gfx_wait_left / gfx_wait_spent exactly as resolve_wait_budgets does, compute goes through budget_for, and with the budgets unset budget_for returns wait_budget(), so the default behaviour is unchanged.

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

@raylitebull raylitebull added the gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks) label Dec 1, 2026
@capy-ai

capy-ai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Closing as a duplicate of #3318 (thanks @Foniass). #3318 shares the same helper with resolve_wait_budgets, also covers resolve_and_pin_pending, resolve_for_indirect and select_for_native_bind, and already has a GPU run, smoke blocks and measurements.

AI use: written by Capy (Claude Opus 5.5) and posted on raylitebull's behalf, with their go-ahead.

@capy-ai capy-ai Bot closed this Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:d3d12 D3D12.X runtime, command lists, resources, sparse memory area:shaders Shader cache, PSO compilation, pipeline libraries, precompilation gpu:amd Code is specific to AMD / RDNA / wave64 GPUs (scope tag; see needs:amd-test) gpu:both Code affects both AMD and NVIDIA GPUs (scope tag; see needs:*-test for remaining checks)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants