Memory: skip VirtualQuery on committed coherent UMA windows in cpu_writes and kernelx #1005
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!1005
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1005/head"
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?
@raylitebull on GitHub · 2026-11-24 10:19 UTC · original
raylitebull:pr/vq-coherent-window→main· +115 −15 · 3 files · 1 commits · merged 2026-11-24 23:41 UTCAvoid kernel
VirtualQuerycalls on committed coherent UMA windows incpu_writes,kernelx, andlist_x. On Windows, callingVirtualQueryon a 4 GiBOpenExistingHeapFromAddresscoherent window walks the whole region (~75-80 ms) while holdingMmLockAddressSpace, stallingGetWriteWatchon other threads.eh::is_writablealready checksuma.in_committed_window()first; this extends the same fast path to the remaining call sites.What is in it
crates/xcl/src/hle/d3d12x/cpu_writes.rs: fast-pathwrite_now,write_u64_now, andwritablewhen[va, va + bytes)lies inside a committed coherent UMA window.crates/xcl/src/hle/kernelx.rs: exportVirtualQueryandVirtualQueryEx, fast-path them plusXMemVirtualQuery,committed_range, andcommitted_page_inon committed coherent UMA windows, and add a unit test (virtual_query_fastpath_covers_committed_coherent_window).crates/xcl/src/hle/d3d12x/list_x.rs: route theXCL_TRACE_FRAMEvertex-bufferVirtualQuerythroughkernelx::VirtualQuery.Tested
rustc 1.99.1 (58cf8f9c3 2026-10-13), release + test profilescargo test --workspace -- --test-threads=4: 728 passed, 0 failed, 41 ignored (0 SKIPPED GPU tests)Regression run
main:
PR:
Not tested
AI use
origin/main, ported and refined the coherent-window fast path and unit test, ran the full test suite and smoke runs, and drafted this description.@poucosaudavel on GitHub · 2026-11-24 11:06 UTC · original
Test report for the exact head
c1a9b5245380b46276e71d7cba3412ef7464c7f0, since Not tested lists NVIDIA GPUs.Tested
main(6efdabcdaac93ce5cc123a85e85deba5d49cb294) as the baselinecargo build --workspace, thencargo test --workspace -- --test-threads=4:hle::kernelx::tests::virtual_query_fastpath_covers_committed_coherent_window; no test present on the base is missing or failing on the PR.realon the RTX 5060 Ti).gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_maskandgpu::recomp::tests::gpu_wave32_program_in_wave64_hardware(no wave64)Not tested
scripts/smoke.ps1regression run on a retail title: this covers the test suite only, so it says nothing about theVirtualQuerysavings on a running title.AI use
@DavidM1911 on GitHub · 2026-11-24 11:35 UTC · original
Independent verification, merged onto current
main384f7f7locally (clean merge).Machine: Windows 11, Ryzen 9 7900X + RTX 3060 Ti (8 GiB); Rust stable MSVC, debug.
cargo test -p xcl --lib kernelx: 33 passed, 0 failed, 1 ignored — covers the new committed-coherent-window path inkernelx.cargo test -p xcl --lib cpu_writes: 3 passed, 0 failed —writes_land_after_the_queue,readback_u64_lands_after_the_queue,gpu_mirror_upload_follows_cpu_writes_and_later_mapping_changesall exercise the real UMA backend on this adapter.AI use: test runs by Devin (Cognition, SWE-2); no code changes.
@thehollowedone on GitHub · 2026-11-24 14:00 UTC · original
Independent timing for
c1a9b52applied to930e8b4. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, release.On the same 4095 MiB coherent window imported with
OpenExistingHeapFromAddress, nativeVirtualQuerytook 17.5–22.3 ms at the median across three passes (p95 23.8–28.0 ms). XCL’s fast path took about 0.1 µs at the median (p95 0.2 µs). All eight comparedMEMORY_BASIC_INFORMATIONfields matched at offsets near the start, middle, and end of the window.A second thread probed
GetWriteWatchon a separate dirty 4 KiB page. Its p95 was 7.4–8.6 µs during repeated native queries and 5.1–7.5 µs during fast-path queries. Neither condition produced a millisecond-scale stall. The stock query and GPU mirror readback tests also passed. Synthetic workloads only. AI-assisted. Codex (GPT-6, exact variant unavailable) wrote and ran the scratch benchmark and drafted this report.@thaqiart139-alt on GitHub · 2026-11-24 22:49 UTC · original
Test report for this PR's head
c1a9b52, 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)virtual_query_fastpath_covers_committed_coherent_window.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
@DavidM1911 on GitHub · 2026-11-26 03:32 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