Skip to content

Clear retired view metadata before reusing descriptor slots - #7

Closed
MichaelSmithAI wants to merge 1 commit into
r4tedx:shader/unknown-stride-view-kindsfrom
MichaelSmithAI:retire-view-metadata-before-reuse
Closed

MichaelSmithAI wants to merge 1 commit into
r4tedx:shader/unknown-stride-view-kindsfrom
MichaelSmithAI:retire-view-metadata-before-reuse

Conversation

@MichaelSmithAI

@MichaelSmithAI MichaelSmithAI commented Nov 24, 2026 •

Copy link
Copy Markdown

On the branch for Marvisak#704, a descriptor slot could become available while its former owner was still clearing the alias and stride entries. That cleanup could erase the new command list’s binding.

The patch finishes clearing the retiring list’s entries before publishing the slots as free. The two locks are still acquired separately. A CPU-only allocator check observed that the slot remained reserved throughout cleanup and became available immediately afterward. The Windows GPU test target type-checked from Linux.

On a Linux RTX 4090 we also ran the branch's dynamic-selector fixture in the culling integration tree at 2b2e219, which contains this commit. The Win64 D3D12 test ran under Wine 11.22, vkd3d-proton 3.1 and DXVK 3.1.1. Four buffer readbacks and the slot retirement assertions passed, with the completion marker emitted after the assertions. This exercises dynamic view reads and reuse on the integrated build. The ordering check above is the separate control for the fix itself. Windows-native and title results remain unmeasured. AI-assisted implementation and review.

@r4tedx

r4tedx commented Nov 24, 2026

Copy link
Copy Markdown
Owner

You are right, and thank you: this is a real ordering bug in 30a93f9, found within minutes of the PR going up.

release marked the dynamic slots free under the next lock, dropped it, and only then cleared their table entries and raw views. dynamic takes the same lock, so another list could lease those slots in between, write its entries through make_at, and have them wiped by the retiring list's forget_view. A wiped entry reads as "the slot itself is raw", which for a structured view is exactly the wrong-address read Marvisak#704 exists to remove. Clearing first, while the slots are still marked taken, closes it, and since forget_view takes its locks separately there is no nesting to worry about.

It is in the branch as 4e03086, cherry-picked with your authorship, so upstream Marvisak#704's head now carries it and its description credits you. GitHub will not mark this PR merged because it went in by cherry-pick; it can be closed.

What I ran with it on an RTX 5070 and WARP: cargo test -p victory-shader 73 passed; cargo test -p victory-gpu 43 passed and 1 failed, the failure being frame::tests::waits_end_on_ticks_and_count_frames, a frame-clock timing test this branch does not touch, which also fails intermittently on main and failed once here when run alone. No test reproduces the interleaving itself; if you have a way to force it deterministically (your allocator check, as a test in raw_view_tests.rs), that would be worth having.

The title was not used in these tests. AI-assisted.

@MichaelSmithAI

Copy link
Copy Markdown
Author

Thanks for cherry-picking the fix into Marvisak#704. The requested allocator regression is in #8. On an RTX 4090 via Wine it caught slot 65536 being leased during cleanup with the old order and passed with your cherry-pick. Closing this delivery PR as requested.

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.

3 participants