Repository navigation
Conversation
… hot-path formatting
Eliminate hot-path formatting, mutex contention, and unbounded session-lifetime memory growth in `device_x::note_alias`:
- Store a `Copy` `PlacedDescSummary` (`dim`, `width`, `height`, `format`, `flags`) with `Display` formatting `"dimension {} {}x{} format {} flags {:#x}"` only when an alias is actually logged (zero heap allocation on non-aliasing calls).
- Add a lock-free `N.load(Ordering::Relaxed) >= MAX_ALIAS_LOGS` (`16`) fast-path in `note_alias`, drop the tracking `HashMap` (`*seen = None`) once 16 aliases have been logged, bound transient entries to `MAX_ALIAS_TRACKED` (`16_384`), and release `SEEN` before calling `xlog_info!`.
- Add CPU unit tests (`note_alias_logs_first_16_and_drops_table_after_cap`, `note_alias_bounds_tracked_entries_without_aliases`, `note_alias_short_circuits_when_cap_already_reached`).
Part of xcl-dev#1773
Part of xcl-dev#1833
Assisted-by: Google Antigravity (Gemini 4 Neon)
|
Test report: passes on NVIDIA. Exact head Tested
Not tested
Claude Code (Claude Opus 5.5) ran the tests and wrote this report. |
bmjask
pushed a commit
to bmjask/xcl
that referenced
this pull request
Nov 26, 2026
Replace per-placement String formatting with a compact copyable descriptor summary, release the alias mutex before logging, and take a lock-free return after the 16 diagnostic lines have been emitted. Bound pre-cap unique-address tracking and free the table at the cap. GNU Windows-target cargo check passed. Windows/MSVC, long-run placement behavior, GPU tests, and title smoke were not run on this host. Adapted from PR xcl-dev#2636. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
bmjask
pushed a commit
to bmjask/xcl
that referenced
this pull request
Nov 26, 2026
Replace per-placement String formatting with a compact copyable descriptor summary, release the alias mutex before logging, and take a lock-free return after the 16 diagnostic lines have been emitted. Bound pre-cap unique-address tracking and free the table at the cap. GNU Windows-target cargo check passed. Windows/MSVC, long-run placement behavior, GPU tests, and title smoke were not run on this host. Adapted from PR xcl-dev#2636. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
|
Tested on AMD Radeon RX 9070 (RDNA4) at this PR's head Tested
Not tested
AI use
|
bmjask
pushed a commit
to bmjask/xcl
that referenced
this pull request
Nov 27, 2026
Replace per-placement String formatting with a compact copyable descriptor summary, release the alias mutex before logging, and take a lock-free return after the 16 diagnostic lines have been emitted. Bound pre-cap unique-address tracking and free the table at the cap. GNU Windows-target cargo check passed. Windows/MSVC, long-run placement behavior, GPU tests, and title smoke were not run on this host. Adapted from PR xcl-dev#2636. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol)
bmjask
pushed a commit
to bmjask/xcl
that referenced
this pull request
Nov 27, 2026
Replace per-placement String formatting with a compact copyable descriptor summary, release the alias mutex before logging, and take a lock-free return after the 16 diagnostic lines have been emitted. Bound pre-cap unique-address tracking and free the table at the cap. GNU Windows-target cargo check passed. Windows/MSVC, long-run placement behavior, GPU tests, and title smoke were not run on this host. Adapted from PR xcl-dev#2636. Assisted-by: Google Antigravity (Gemini 4 Neon) Assisted-by: Codex (GPT-5.6-sol) Assisted-by: Codex (GPT-5.6-sol)
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
Fixes unbounded growth, hot-path string formatting, and lock-held logging in
note_alias(crates/xcl/src/hle/d3d12x/device_x.rs), called on everyCreatePlacedResourceXresource placement:note_aliaskept inserting(va, String)into a process-globalMutex<Option<HashMap<usize, String>>>forever, even after all 16 diagnostic alias lines had been logged. A lock-freeN.load(Ordering::Relaxed) >= MAX_ALIAS_LOGSfast-path now returns immediately once the cap is reached, andrecord_alias_inclearsSEENtoNonewhen the 16th alias is logged so the backing map is freed.record_alias_instops inserting new VA entries onceMAX_ALIAS_TRACKED(16_384) entries are tracked while still detecting aliases against already-tracked addresses.format!(...)Stringvalue with aCopyPlacedDescSummarystruct (preserving the exact"dimension {} {}x{} format {} flags {:#x}"format viaDisplay) and dropped theSEENmutex guard before callingcrate::xlog_info!.Part of #1773
Part of #1833
Tested
record_alias_insemantics (cargo test --release -p xcl --lib "hle::d3d12x::device_x::tests::note_alias" -- --test-threads=1 --nocapture): all 3 new unit tests failed (0 passed; 3 failed; 0 ignored):note_alias_bounds_tracked_entries_without_aliasesfailed (left: 13, right: 8, unbounded VA table growth)note_alias_logs_first_16_and_drops_table_after_capfailed (16th alias did not drop the tracking table)note_alias_short_circuits_when_cap_already_reachedfailed (residual map was not freed once cap was reached)XCL_ADAPTER=warp,XCL_WARP=1,cargo test --release -p xcl --lib "hle::d3d12x::device_x::tests::" -- --test-threads=1 --nocapture):17 passed; 0 failed; 0 ignored; 0 skipped(0.44s), zero new compiler warnings indevice_x.rs.cargo test --release -p xcl --lib "hle::d3d12x::device_x::tests::" -- --test-threads=1 --nocapture):17 passed; 0 failed; 0 ignored; 0 skipped(0.40s), zero new compiler warnings indevice_x.rs.Regression run
Full release workspace on RTX 4060 (
cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture):37test binaries,1438 passed; 0 failed; 47 ignored,29pre-existing environment-gatedSKIPPEDlines:21skipped:no wave64(RTX 4060 is wave32)3skipped: wave32per-lane form: refusedby driver (f16 arithmetic,f16 packed,f32 conversions)3skipped: no D3D12 debug layer (d3d12SDKLayers.dllunavailable on host: debug-layerdred: false/trueanduploads_start_from_each_subresources_state)1skipped:pso_measurement_compiles_an_exact_synthetic_record(cannot disable driver cache on Windows)1skipped:heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)Paired 60 s RTX 4060 smoke capture (
scripts/smoke.ps1):Base (
origin/mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7):PR (
ce86b00e30e7a4eedfabf215cb3e0a0b2b6b6a89):Not tested
29host-gated workspace tests skipped on this RTX 4060 machine (wave64 hardware, wave32 per-lane driver support, D3D12 SDK debug layer, driver cache disable, and heap windows).AI use
Google Antigravity (Gemini 4 Neon) wrote the patch, unit tests, and PR description; all commands, test runs, and paired 60 s GPU smoke captures were executed directly in this workspace.