GPU: the dynamic slot search finds a free run across its starting point (port of VIctory#974) #201
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!201
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-201"
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?
@lcg007xd-c on GitHub · 2026-11-25 21:31 UTC · original
lcg007xd-c:port/dynamic-wrap-scan→main· +26 −2 · 1 files · 1 commits · openHostHeap::dynamiclooks fornfree slots in a row. It searches fromnextto the end, then from 0 tonext. A free run that starts beforenextand ends after it is never seen whole: the first pass sees only its tail, and the second pass stops atnext. If that run is the only one big enough, the search fails even though the slots are free, and then:no_runis set ton, so no table ofnslots or more is made on that heap until the next release;So a heap with enough free slots can still drop tables, which is the README's known problem "when they run out, some draws of a frame are dropped".
What
c1c3281, pushkarreddyy), cherry-picked with-x. The second pass now goesn - 1slots pastnext(but never past the end), so a run that crossesnextis found. This is a two-line change. The walk cap and theno_runmemo of this fork are unchanged.next(16 and up) rather than the run across it, so it did not test the bug. The new test,a_free_run_across_the_search_start_is_found, leaves exactly one free run of 20 acrossnext. Main misses it; this branch returns it.Tested (Linux, no GPU)
victory-gpu does not build on Linux, so I copied the search loop, old and new, into a small program:
None, the new one returns the run;nextandn), compared with a brute-force search. The new loop finds a run exactly when one exists, and every run it returns is free. The old loop missed an existing run in 5,875 of those heaps.Also:
cargo clippy -p victory-gpu --no-deps --all-targets --target x86_64-pc-windows-msvc: the same findings as main, none new.cargo check -p victory-gpu --tests --target x86_64-pc-windows-msvc: builds.Not tested
nextin a heavy frame, so I can't say how many dropped tables this recovers.🤖 Generated with Claude Code
@qtLkz on GitHub · 2026-11-25 22:09 UTC · original
Tested on NVIDIA, where the view heap is capped at 1,000,000: RTX 4070 Ti, driver 621.01, Windows 11 Pro 26300, this PR on main
4f62c2a.On its own, the new test fails here:
On a capped heap the dynamic range starts after the title slots (933,440), not at 4. This is the same assumption that makes
dynamic_slots_are_held_until_releasedfail on NVIDIA on main. With #153 applied as well, both tests pass, so it's the test's expectation rather than the search itself. Comparing against the heap's first dynamic slot, rather than a literal 4, would make it pass on its own.AI-assisted (Claude).
@qtLkz on GitHub · 2026-11-25 22:44 UTC · original
A fix for the NVIDIA failure of the new test, verified on an RTX 4070 Ti (capped 1,000,000-slot heap), on top of this PR's head
5f03aee.One commit, cherry-pickable: https://github.com/qtLkz/VIctory-Belobug-AMD/tree/pr201-capped-heap-test
The test assumed the dynamic slots start at 4. On a capped heap they start after the 933,440 title slots, so it now takes the start from
heap.count:The search it checks is unchanged, and on an uncapped heap
heap.countis still 4.cargo test -p victory-gpu --lib --locked, three runs:a_free_run_across_the_search_start_is_found ... okeach time (it failed withleft: (933440, 933490), right: (4, 54)before). The one remaining failure,dynamic_slots_are_held_until_released, is the pre-existing main one that #153 fixes; it is not from this PR.AI-assisted (Claude).
@Yoshi-233 on GitHub · 2026-11-26 01:06 UTC · original
I checked the allocator logic on Ubuntu x86-64 using the actual
HostHeap::dynamicandreleasemethod bodies from4f62c2aand5f03aeein a CPU harness.For each of two dynamic range starts (4 and 933,440), I swept all 256 occupancy masks of an eight-slot range, eight cursor positions, and requests of one to eight slots. A separate oracle tried every valid contiguous start in cursor order. On each 16,384-case sweep, main falsely reported exhaustion 450 times. The PR had zero mismatches. Releasing successful allocations restored the original bitmap.
With 65,536 spare slots, the 20-slot run crossing the cursor was also found at the expected absolute index for both starts: 65,520 and 998,956. Main missed both. This independently supports using the heap's actual start in the hardware test, as qtLkz suggested above. The D3D12 device and heap construction were outside this check.
@adrianmjim on GitHub · 2026-11-26 19:47 UTC · original
Tested natively on Windows with an AMD card: RX 7900 XT (RDNA3), driver 32.0.32029.2010, Windows 11 Pro 26300. Head
5f03aeeon4f62c2a. The heap tests run on the hardware adapter, not WARP. On this card the view heap is not capped (1,048,576 dynamic slots).a_free_run_across_the_search_start_is_foundpasses on this branch, alone and in 30 of 30 full-lib runs. All 13descriptor::hosttests pass, includingdynamic_slots_are_held_until_released.4f62c2a, it fails every run withleft: None, right: Some(1048560). So on real hardware the test catches the missed run when the fix is not there.cargo test -p victory-gpu --lib(debug), 30 runs each of base and branch, interleaved: none of the branch's failures is new.frame::tests::waits_end_on_ticks_and_count_framesfailed in 20 of 30 base runs and 23 of 30 branch runs.watch::testswrite-report tests failed a few times on both.query::tests::host_timestamps_are_on_the_title_clockandqueue::tests::work_after_a_wait_runs_once_the_other_queue_signals. Both also fail on base when the query and queue tests are run again on their own (1 of 100 and 2 of 40).Not tested:
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.