gpu/descriptor: 2-level 64-bit bitmap DynamicSlots allocator and batc… #234

Closed
mint17 wants to merge 531 commits from upstream-pr/234 into main
mint17 commented 2026-11-27 11:22:44 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by mint17 on 2026-11-27T11:22:44Z.


…hed reclamation

Replace the byte-per-slot Vec linear scan in HostHeap::dynamic and per-range release_dynamic lock storms in State::drop / State::tables_done:

  • Add pure-Rust DynamicSlots (crates/victory-gpu/src/descriptor/slots.rs) with a 64-bit Level-0 occupancy bitmap (8x smaller) and Level-1 full-word summary bitmap (skipping 4,096 taken slots per word), preserving exact next-fit cursor wrap-around, free count, and too_long watermark semantics (resetting too_long only when slots actually transition 1 -> 0).
  • Add descriptor::release_dynamic_batch and HostHeap::release_batch so State::drop and State::tables_done acquire SHADER_HEAPS.read() once and host.next.lock() once per distinct (heap, id) (zero-alloc single-heap fast path).
  • Verified with 127,500-op randomized Vec oracle parity tests across 13 capacities, batched reclamation tests, and opt-in release microbenchmark (17.8x speedup in fragmented regimes, 2.3x-3.8x normal/high-occupancy).
<!-- greyfinch-sync:TaynanGT/Vice-Tay:issue:5525784799 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/234). Originally posted by [mint17](https://github.com/mint17) on 2026-11-27T11:22:44Z. --- …hed reclamation Replace the byte-per-slot Vec<bool> linear scan in HostHeap::dynamic and per-range release_dynamic lock storms in State::drop / State::tables_done: - Add pure-Rust DynamicSlots (crates/victory-gpu/src/descriptor/slots.rs) with a 64-bit Level-0 occupancy bitmap (8x smaller) and Level-1 full-word summary bitmap (skipping 4,096 taken slots per word), preserving exact next-fit cursor wrap-around, free count, and too_long watermark semantics (resetting too_long only when slots actually transition 1 -> 0). - Add descriptor::release_dynamic_batch and HostHeap::release_batch so State::drop and State::tables_done acquire SHADER_HEAPS.read() once and host.next.lock() once per distinct (heap, id) (zero-alloc single-heap fast path). - Verified with 127,500-op randomized Vec<bool> oracle parity tests across 13 capacities, batched reclamation tests, and opt-in release microbenchmark (17.8x speedup in fragmented regimes, 2.3x-3.8x normal/high-occupancy).
TaynanGT commented 2026-11-27 11:42:20 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-27T11:42:20Z.


@mint17 The allocator oracle gives us confidence in next-fit placement and wraparound. For the batch path, I’ll check that ranges across different heap IDs become eligible at the same fences as before. The 17.8× result describes the fragmented allocator benchmark.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7217380026 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/234#issuecomment-7217380026). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-27T11:42:20Z. --- @mint17 The allocator oracle gives us confidence in next-fit placement and wraparound. For the batch path, I’ll check that ranges across different heap IDs become eligible at the same fences as before. The 17.8× result describes the fragmented allocator benchmark.
TaynanGT commented 2026-11-30 17:15:24 +00:00 (Migrated from github.com)

Imported from TaynanGT/Vice-Tay. Originally posted by TaynanGT on 2026-11-30T17:15:24Z.


main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

<!-- greyfinch-sync:TaynanGT/Vice-Tay:comment:7285971182 --> Imported from [TaynanGT/Vice-Tay](https://github.com/TaynanGT/Vice-Tay/pull/234#issuecomment-7285971182). Originally posted by [TaynanGT](https://github.com/TaynanGT) on 2026-11-30T17:15:24Z. --- `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

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
TaynanGT/Vice-Tay!234
No description provided.