Skip to content

D3D12.X: keep reusable allocators after a failed Reset - #1009

Closed
nova-aryan wants to merge 1 commit into
xcl-dev:mainfrom
nova-aryan:contrib/allocator-reuse-retry
Closed

nova-aryan wants to merge 1 commit into
xcl-dev:mainfrom
nova-aryan:contrib/allocator-reuse-retry

Conversation

@nova-aryan

Copy link
Copy Markdown
Contributor

A failed Reset of a reusable command allocator currently removes that spare from its owner's pool before returning the error. Keep it owned and available until Reset succeeds, so a retry uses the same backing instead of abandoning it and allocating another. Fixes #1004.

Independent of #994: that PR handles failure to create a new replacement; this handles failure to reset an existing spare.

What is in it

  • alloc_pool.rs: publish the reuse transition only after successful Reset. Extract the existing transition into a private helper taking the native Reset call, so an isolated regression can inject two failures and a successful retry without a device or shared global state.
  • README.md: document retry behavior. One commit, no dependencies or game data.

Tested

  • Source review on main 6efdabc; git diff --check: exit 0.
  • Regression added for retained ownership, unchanged current backing/recording, reuse of the same spare, and exactly one successful swap. No tests, builds or GPU/game workloads were run locally, at the user's request.

Regression run
Not run. Main/head retail smoke blocks are missing; keep this a draft pending Windows validation.

Not tested

  • Compilation, the new regression's execution, the full workspace/GPU suite, actual driver failures and retail gameplay.
  • Expected negative control from source inspection: removing the spare before the injected failed Reset leaves aside empty and fails the first ownership assertion. Not executed.
  • No claim of a measured memory reduction or a fix for the retail title's watchdog/null-write crash.

AI use
Codex (GPT-6) inspected the code, wrote the patch/regression and prepared this description. The exact backend model identifier was not provided in this session.

Keep the spare owned until its native Reset succeeds, so failures remain retryable without abandoning a backing. Add an isolated failure/retry regression; local execution is disabled at the user's request. Fixes xcl-dev#1004.
@ivall

ivall commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks – your commit is f52ec36 on main. Merged into main together with #1009, #1012 and #1023 (merge 384f7f7). Taken without its README sentence: the README tells users what works, and these are internal details. #1012 and #1023 both added code right after move_list and tests at the same place; the conflicts were resolved by keeping both.

Tested on the merged tree (it was not run before, so here it is):

  • cargo build --workspace: no warnings. cargo test --workspace --no-fail-fast -- --test-threads=4: 737 passed, 0 failed, 41 ignored, no SKIPPED.
  • Each new test fails with its fix undone: a_spare_whose_reset_fails_stays_available_for_retry (spare removed before the Reset), released_lists_leave_only_live_recordings_and_gpu_work_holding_the_backing (no forget_list in on_release), reset_commits_state_only_after_native_success_and_always_restores_vtable (association committed on a failed Reset).
  • Retail title, 90 s with scripted presses, against main before it the same way: no crash, no device removal, exit 0; 1500 frames against 1200; peak process commit 29.2 GB against 29.7 GB; the same allocator swap counts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D3D12.X: failed Reset removes a reusable allocator from its pool

2 participants