Repository navigation
Conversation
…checks in console_heap Follow-up to xcl-dev#1991 (shared shader-visible PC sampler heap `GLOBAL_SAMPLER`) fixing three bugs in `crates/xcl/src/hle/d3d12x/console_heap.rs`: 1. `release_global_sampler` pushed raw `(first, count)` entries into `s.free` without guarding `count == 0` or coalescing via `merge_release` (unlike `release_global`). Freeing adjacent small sampler pages (< 8 slots) left unmerged shards that could not satisfy an 8-slot `SAMPLER_PAGE_SLOTS` request, prematurely exhausting the 2048-descriptor `GLOBAL_SAMPLER` heap and dropping new pages onto reserved zero-sampler slot 0. Guard `count == 0` and coalesce through `merge_release(&mut s.free, first, count)`. 2. `in_global(obj)` checked `h.obj == obj && !h.pages.is_empty()` without `!h.sampler`, so shared sampler heaps (which now populate `h.pages`) falsely reported true for the shared view heap. Add `&& !h.sampler`. 3. `census()` compared sampler `w[3] & 0xFFF == k` instead of the shared sampler page index, misreporting live shared samplers as "with another" in `XCL_TRACE_FRAME`. Extract `sampler_own_index(&h.pages, k)` (matching `slot()` and view-heap `own_index`) and use it in `census()`. Assisted-by: Google Antigravity (Gemini 4 Neon)
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
Contributor
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is in it
Follow-up to #1991 fixing three bugs in
crates/xcl/src/hle/d3d12x/console_heap.rs(GLOBAL_SAMPLERshared shader-visible PC sampler heap):release_global_sampler):release_global_samplerpreviously pushed raw(first, count)entries ontos.freewithout guardingcount == 0or callingmerge_release(&mut s.free, first, count)(unlikerelease_global). Because D3D12 capsGLOBAL_SAMPLERat 2048 descriptors (2047 usable) and small/tail sampler pages reserve< 8slots, freeing adjacent small sampler heaps left unmerged shards (e.g.[(1, 4), (5, 4)]) that could not satisfy an 8-slotSAMPLER_PAGE_SLOTSrequest, causing premature exhaustion and fallback to reserved zero-sampler slot 0. Guardif count == 0 { return; }and coalesce viamerge_release(&mut s.free, first, count).in_global(obj):in_global(obj)checkedh.obj == obj && !h.pages.is_empty()without!h.sampler. Once D3D12.X: global shader-visible sampler heap, typed UAV validation, and occlusion/query VA fixes #1991 populatedh.pagesfor shared sampler heaps,in_globalfalsely returnedtruefor every shared sampler heap (even though it queries membership in the shared view heap). Add&& !h.sampler.census()(sampler_own_index):census()compared samplerw[3] & 0xFFF == kinstead of the slot's actual index inGLOBAL_SAMPLER, misreporting live shared samplers as"with another"underXCL_TRACE_FRAME. Extractsampler_own_index(&h.pages, k)(returningf + (k % SAMPLER_PAGE_SLOTS)when mapped, orsampler_unmapped_index(!pages.is_empty(), k)when unmapped/unhosted — matchingslot()and view-heapown_index) and use it incensus().Tested
1.9.2609.5(01b62ad4), release build.0 passed, 3 failed:release_global_sampler_merges_adjacent_ranges_and_ignores_zero_countsaw unmerged[(5, 4), (1, 4), (1, 0)]instead of[(1, 8)],in_global_excludes_shared_sampler_heapsfailed!in_global(0xC100), andsampler_own_index_tracks_mapped_pages_and_fallbacksreturned0instead of1).cargo test --release -p xcl --lib hle::d3d12x::console_heap::tests -- --test-threads=4 --nocapture): 12 passed, 0 failed, 0 ignored (0.24 s; all 9 existingconsole_heaptests including real RTX 4060 shared-heap tests + 3 new pure-CPU CI-safe tests:release_global_sampler_merges_adjacent_ranges_and_ignores_zero_count,in_global_excludes_shared_sampler_heaps, andsampler_own_index_tracks_mapped_pages_and_fallbacks).cargo build --release --workspaceandcargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture): 23 test binaries, 1246 passed, 0 failed, 46 ignored, plus 27 runtimeSKIPPEDlines (20no wave64on RTX 4060,3wave32 per-lane formrefusedby driver,2missingd3d12SDKLayers.dll/ D3D12 debug layer,1driver shader cache toggle unavailable,1no heap windows).Regression run
Baseline (
origin/main426a5a74):PR head (
a45cffdc):Not tested
#[ignore]tests on this machine.XCL_TRACE_FRAMElog output from a retail title saturatingGLOBAL_SAMPLER(thesampler_own_indexmapping,in_globalseparation, andrelease_global_samplercoalescing/unregister paths are verified by the new deterministic unit tests, while normal shared sampler/view heap runtime operation is verified byconsole_heap::testsand the 60 s RTX 4060 smoke run).AI use
Implemented and verified with Google Antigravity (Gemini 4 Neon). All code changes, failing-first and post-fix unit tests, full workspace release tests, and paired 60 s RTX 4060 smoke runs were reviewed and executed locally.