UMA: used and sparse_used are running totals, alloc_in searches its window only #522
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!522
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-522"
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?
@TG0000 on GitHub · 2026-11-24 01:15 UTC · original
TG0000:perf/xcl-perf3→main· +86 −13 · 1 files · 1 commits · openUma::used()added up every live block on each call, andUma::sparse_used()added up every sparse reservation.used()is asked before every coherent graphicsVirtualAlloc(kernelx.rs:315), every committed placed resource (real.rs:1235) and every readback heap (real.rs:1263). So N title allocations cost O(N²) under the UMA lock. Both are now running totals, kept up to date where blocks and reservations are taken and returned.alloc_in(k)also filtered the whole free map for window k. A free range never crosses a window boundary (each window is shorter thanWINDOW), so it now walks only the keys in k's 4 GiB range. First-fit order and results are unchanged.This doesn't change
take_sparse_in's search; #483 bounds that one. The two PRs merge cleanly in either order (checked withgit merge-tree).What is in it
crates/xcl/src/gpu/uma.rsonly:Inner::used_bytesis updated inreserve_pool,alloc_whereandfree.used()and theXCL_TRACE_MEMtrace read it.Uma::sparse_bytesis updated through a newtake_sparsewrapper (used bysparse_reserve,sparse_alloc_inandsparse_alloc) and insparse_release.sparse_used()reads it.alloc_wheresearchesfree.range(k·WINDOW..(k+1)·WINDOW)when it is given a window.used_totals_follow_allocations_and_frees: the totals match the blocks and reservations through allocations, frees, coalescing, failed requests and unknown addresses.Tested
cargo test -p xcl --lib: 634 passed, 3 failed, 21 ignored. The 3 failures are intitle_textures::tests/vram::tests, and the same tests fail onorigin/main(4 failures there on this machine).cargo test -p xcl --lib uma: 10 passed.for_runtime(1 GiB):reserves, each preceded by asize() - used()check, plus 100kused() + sparse_used()reads: 592 ms → 0.97 ms (~600×).sparse_alloc_in(0, 64 KiB)+sparse_used(): 12.2 ms → 0.43 ms (~28×).Regression run
main:
PR:
Not tested
cargo test --workspace(only thexcllib tests were run), other GPUs, MinGW builds.AI use
🤖 Generated with Claude Code
@thehollowedone on GitHub · 2026-11-24 01:23 UTC · original
Tested
I built and tested the full synthetic workspace on the RTX 3080 Ti (driver 621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, debug. For both revisions I ran
cargo build --offline --locked --workspacefollowed bycargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4, with allXCL_SAMPLE_*variables unset.The PR adds one UMA accounting test, and the texture and VRAM failures reported on the RX 6800 did not occur in either run here. Both revisions reported the same wave64 skips (
gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware).Not tested
Retail titles, release performance, or the PR integrated with newer main commits.
AI use
Codex with GPT-6.2 Sol ran the tests and drafted this report.
@MesshM on GitHub · 2026-11-24 03:04 UTC · original
Test run of
638c03951413279f24af06fbe3532f9732d67096on AMD RDNA4. I merged it onto currentmaindd2ae9alocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 691 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 651 passed, 0 failed, 21 ignoredSKIPPED;used_totals_follow_allocations_and_freespasses.Review: I checked that the running totals cannot drift: in
uma.rsat the PR head, bothused.inserts add toused_bytesand the oneused.removesubtracts the removed size; every reservation goes throughtake_sparse, which adds the samesizetake_sparse_ininserts, andsparse_releasesubtracts the size it removes from the map.alloc_in'srange(k·WINDOW..(k+1)·WINDOW)relies on free ranges not crossing a window, which holds since each window is shorter thanWINDOW. I found nothing to change.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@thaqiart139-alt on GitHub · 2026-11-24 22:48 UTC · original
Test report for this PR's head
638c039, merged intomain689f2db(no conflicts), on AMD RDNA2 with native 64-lane waves and on a 32-lane NVIDIA card.Tested
XCL_ADAPTER.cargo test --workspace --no-fail-fast -- --test-threads=4:main689f2dbmain, from #1679's new fuzz tests, and both are already reported on #1679:fuzz_validate_and_gpu_0to_3(CreateComputePipelineState:0x8007000E)fuzz_validate_and_gpu_1(seed 540: res[833] = 0x7, CPU 0x6)used_totals_follow_allocations_and_frees.xcllib tests were run there).SKIPPED tests (the same on
mainand with this PR)gpu::recomp::lower::tests:a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpugpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu, and the wave64 cases of itsf16/f32/f64/integer_programs_on_the_gpugpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwarelower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused ("its #1426 semantics differ from the console's")heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)pso_measurement_compiles_an_exact_synthetic_record(Windows Developer Mode is off)gpu::dxil::geometry_tests::gpu_geometry_direct_records,emitted_ms_primitive_attribute_reaches_the_pixel_shader,emitted_ms_ps_draw_a_triangle,gpu_geometry_mode_es_gs_strip,gpu_geometry_mode_es_gs_strip_with_branches,gpu_mesh_mode_two_passeslower_dxil's f16 arithmetic, f16 packed and f32 conversions: refused, as aboveheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows)pso_measurement_compiles_an_exact_synthetic_record(Developer Mode is off)Not tested
AI use
@TG0000 on GitHub · 2026-11-25 12:28 UTC · original
Rebased onto main
1a0bbe3: headaf0f5b8. The conflict was in the tests only. I also checked main's new window layouts: every place that takes or returns a block or a sparse range goes through the running totals.Run on this head (Ryzen 9 5900X, Windows 11, MSVC):
cargo test -p xcl --lib uma: 16 passed, 0 failed. Clippy stops on threeTAUconstants in files this PR does not touch, with this toolchain.Not run on this head: the whole suite, the microbenchmark and the
xcl-smokepair. The blocks in the description are of638c039, so the description check is expected to ask for a fresh one until it is run.AI-assisted (Claude Code).
@DavidM1911 on GitHub · 2026-11-25 13:53 UTC · original
Verification on RTX 3060 Ti (Windows 11): merge conflict with current
main— needs a rebase before it can be tested.@TG0000 on GitHub · 2026-11-25 15:04 UTC · original
@DavidM1911 Rebased onto latest
main(head1af0171) — thanks for testing!@DavidM1911 on GitHub · 2026-11-26 02:45 UTC · original
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.Thanks!
— Devin
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.