Finish scanning past the dynamic descriptor cursor #8

Closed
github-bot wants to merge 1 commit from gh-pr/8/head into gh-pr/8/base
Owner

@⁠Lilith133T on GitHub · 2026-11-25 03:34 UTC · original
Lilith133T:fix/dynamic-descriptor-wrap-scan → main · +25 −23 · 1 files · 1 commits · closed without merging

Problem

The wraparound scan extends the second pass by n − 1 slots to find a free range that straddles the cursor. The DYNAMIC iteration cap truncates that extension on a full-size view heap. The allocator can then report exhaustion even when a contiguous range is free.

The existing test leaves the tail of the heap free. The allocator legitimately chooses the next range at the cursor, so the test does not exercise wraparound.

Change

Walk both bounded ranges when the free-slot check permits a search. Keep the check that prevents an allocation from crossing the physical end of the heap. The regression now fills the heap and leaves a single four-slot range with two free slots on each side of the cursor.

Verification

  • The revised fixture returns None on main at 32d7848 and finds slot 18 with the fix.
  • The Windows descriptor host tests pass (10 tests).
  • Workspace Clippy passes with all targets, all features, and warnings denied.
**@⁠Lilith133T** on GitHub · 2026-11-25 03:34 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/8) `Lilith133T:fix/dynamic-descriptor-wrap-scan` → `main` · +25 −23 · 1 files · 1 commits · closed without merging ## Problem The wraparound scan extends the second pass by n − 1 slots to find a free range that straddles the cursor. The DYNAMIC iteration cap truncates that extension on a full-size view heap. The allocator can then report exhaustion even when a contiguous range is free. The existing test leaves the tail of the heap free. The allocator legitimately chooses the next range at the cursor, so the test does not exercise wraparound. ## Change Walk both bounded ranges when the free-slot check permits a search. Keep the check that prevents an allocation from crossing the physical end of the heap. The regression now fills the heap and leaves a single four-slot range with two free slots on each side of the cursor. ## Verification - The revised fixture returns None on main at 32d7848 and finds slot 18 with the fix. - The Windows descriptor host tests pass (10 tests). - Workspace Clippy passes with all targets, all features, and warnings denied.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:38 +00:00
github-bot closed this pull request 2026-11-26 03:40:38 +00:00
Author
Owner

@⁠flale1 on GitHub · 2026-11-25 04:00 UTC · original

Read through the change (not run): both bounded ranges are finite, the n - 1 extension covers a range that straddles the cursor, and the run reset at slot 0 still keeps an allocation from crossing the physical end of the heap. Tracing the new regression by hand, the old scan stops before revisiting slots 16-17 and returns None, and the new one returns 18, matching the description.

For context: upstream Marvisak/VIctory does not cap this scan (its loop walks starts without the DYNAMIC limit), so the truncation seems specific to this tree's adaptation of c1c3281.

One note: the test returns early when the heap cannot be created (no GPU), so on a runner without a usable adapter it passes without checking anything. A line in the log when it skips would make that visible.

AI-assisted (Claude Code).

**@⁠flale1** on GitHub · 2026-11-25 04:00 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/8#issuecomment-7152447805) Read through the change (not run): both bounded ranges are finite, the `n - 1` extension covers a range that straddles the cursor, and the run reset at slot 0 still keeps an allocation from crossing the physical end of the heap. Tracing the new regression by hand, the old scan stops before revisiting slots 16-17 and returns `None`, and the new one returns 18, matching the description. For context: upstream Marvisak/VIctory does not cap this scan (its loop walks `starts` without the `DYNAMIC` limit), so the truncation seems specific to this tree's adaptation of `c1c3281`. One note: the test returns early when the heap cannot be created (no GPU), so on a runner without a usable adapter it passes without checking anything. A line in the log when it skips would make that visible. AI-assisted (Claude Code).
Author
Owner

@⁠Yoshi-233 on GitHub · 2026-11-25 06:08 UTC · original

I reproduced the false exhaustion on aa85bb0 and verified the fix on 3af493e. I ran the actual HostHeap::dynamic and release methods in a Linux CPU harness with an in-memory heap, so the check ran even without a D3D12 adapter.

With 262,144 dynamic slots, the base returned None on both cursor-crossing fixtures. This head returned slot 18 for the fixture here and slot 14 for the one from #9. Two slots at the physical end plus two at the beginning were correctly refused as a four-slot allocation. Releasing two more slots next to the first two then allowed a retry at the beginning.

I also scaled the capacity to eight slots and compared against a reference that checks each candidate start in cursor order. Across all 256 occupancy patterns × 8 cursors × 8 request sizes, the base missed 450 valid allocations. This head matched the reference in all 16,384 cases, including which slot was chosen. #9 also passed the same matrix.

**@⁠Yoshi-233** on GitHub · 2026-11-25 06:08 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/8#issuecomment-7154487229) I reproduced the false exhaustion on `aa85bb0` and verified the fix on `3af493e`. I ran the actual `HostHeap::dynamic` and `release` methods in a Linux CPU harness with an in-memory heap, so the check ran even without a D3D12 adapter. With 262,144 dynamic slots, the base returned `None` on both cursor-crossing fixtures. This head returned slot 18 for the fixture here and slot 14 for the one from #9. Two slots at the physical end plus two at the beginning were correctly refused as a four-slot allocation. Releasing two more slots next to the first two then allowed a retry at the beginning. I also scaled the capacity to eight slots and compared against a reference that checks each candidate start in cursor order. Across all 256 occupancy patterns × 8 cursors × 8 request sizes, the base missed 450 valid allocations. This head matched the reference in all 16,384 cases, including which slot was chosen. #9 also passed the same matrix.
Author
Owner

@⁠uiliannn on GitHub · 2026-11-25 10:10 UTC · original

Obrigado pela contribuição! Esse fix de wraparound no scan de descritores dinâmicos já foi integrado na main via commit a91ef70 (backport de c1c3281). Por outro lado, o seu PR #7 (fix de stride de 16 bytes no SLOT_VIEWS) foi mergeado na main em d396d11 — muito obrigado pelo achado!

**@⁠uiliannn** on GitHub · 2026-11-25 10:10 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/8#issuecomment-7159322740) Obrigado pela contribuição! Esse fix de wraparound no scan de descritores dinâmicos já foi integrado na `main` via commit `a91ef70` (backport de `c1c3281`). Por outro lado, o seu PR #7 (fix de stride de 16 bytes no `SLOT_VIEWS`) foi mergeado na `main` em `d396d11` — muito obrigado pelo achado!

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.