[pr-fix][memory] Release eligible resources behind out-of-order retirement entries #81
Loading…
Reference in a new issue
No description provided.
Delete branch "ALeCs1080/Darner:fix/general-retirement-order"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
The general resource retirement queue previously relied on retirement entries arriving in ascending submission order. Producers sample submission numbers before acquiring their shard lock, so concurrent producers can insert entries out of order.
The existing prefix drain stops at the first entry whose retirement number exceeds the completion threshold. This can leave otherwise eligible resources waiting behind a future entry.
A regression test reproduced this through the original production
bury()path:110[90, 120, 100, 105, 110][120, 100, 105, 110][120]This change introduces a per-shard ordering flag, retaining the existing prefix-drain fast path for ordered queues and selecting all eligible entries when an inversion has been detected.
The queue automatically returns to its ordered fast path once the remaining entries are ordered again.
The existing submission threshold, retirement safety lag, asynchronous destruction and destruction outside shard locks are preserved. Relative arrival order is retained within the selected and remaining groups.
How it was tested
Tested revision: changes committed as
412a0ecc09163ff5bbd873f178663059ca5524b1, based on Main1a5286a78daa512f1f715d682a3192b94232e16a. Validation was performed on the changes before committing.Commands and results:
cargo test --locked -p darner-gpu --lib host::bury_tests:: -- --nocapture --test-threads=1— 10 passed.cargo test --locked -p darner-gpu --features diagnostics --lib host::bury_tests:: -- --nocapture --test-threads=1— 10 passed.cargo clippy --workspace --all-targets --locked -- -D warnings— passed.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings— passed.cargo test --workspace --locked— compiled successfully, but GPU test execution terminated with exit code 3.cargo test --workspace --locked -- --nocapture --test-threads=1reproduced the identical failure atambient::tests::the_passes_build.git diff --cached --check— passed.cargo xtask policy --staged— passed, one file checked.Gameplay, when relevant: Not tested. Development system uses Windows 10 22H2 and an NVIDIA RTX 4080.
Before and after, when relevant:
A standalone optimised synthetic queue benchmark was run using seven alternating samples.
In the unordered half-ready scenario, the original implementation selected zero entries, while the corrected implementation selected all 4,096 eligible entries.
The unordered path requires a full traversal. The ordered path retains the original prefix-drain approach.
Shader wave sizes tested, when relevant: Not applicable.
Coverage gaps:
Checklist
main.docs/asset-policy.md.Checked for overlap
Open and closed issues, PR descriptions, available discussion comments and exported source diffs were reviewed on 3 December 2026. No directly competing general retirement queue correction was identified.
Historical records and inline review coverage remain limited following the repository migrations.