hle/kernelx: write complete XMemVirtualQuery flags #2048
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!2048
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2048/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?
@Adika713 on GitHub · 2026-11-25 02:00 UTC · original
Adika713:fix/xmem-virtual-query-flags→main· +73 −6 · 1 files · 1 commits · merged 2026-11-25 10:42 UTCPart of #1489 (XCL-BT-044).
XMemVirtualQuerywrote only the lowu32of the 16-byte flags field at offset +48 ofXMEM_BASIC_INFORMATION, leaving bytes +52..+63 as caller stack garbage. It also reported only CPU readability (bit 0) and never set bit 1 for GPU-accessible coherent UMA or real sparse-VRAM allocations. The field is now zeroed completely before writing the known bits, and bit 1 is set for memory the title can actually reach from the GPU.Compare: https://github.com/xcl-dev/xcl/compare/main...Adika713:fix/xmem-virtual-query-flags
What is in it
crates/xcl/src/hle/kernelx.rs: addwrite_xmem_flags()to zero all 16 bytes at +48 and write the flags; addxmem_gpu_visible()and set bit 1 for committed coherent UMA and real title sparse-VRAM allocations (not arbitrary PC addresses that merely fall inside the sparse window numerically); set both bits on the committed-window fast path.crates/xcl/src/hle/kernelx.rs: add a regression test for the entire flag field, CPU/GPU visibility, reserved pages, coherent UMA, sparse VRAM, and the committed-window fast path; update the existing fast-path assertion from1to3.Tested
cargo test -p xcl --lib hle::kernelx::tests::xmem_virtual_query_writes_the_whole_flag_field_and_gpu_visibility -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed, 0 ignored. With the production change temporarily reverted on the same test, it failed with flags[1, 0, 0, 0, 0xCC x 12]; restoring the change made it pass.cargo test -p xcl --lib hle::kernelx::tests::virtual_query_fastpath_covers_committed_coherent_window -- --exact --test-threads=1: 1 passed, 0 failed, 0 ignored.cargo build --workspace --locked: finished successfully (two pre-existingAtomic::fetch_updatedeprecation warnings).cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1102 passed, 0 failed, 46 ignored, 1 filtered out across all 20 test binaries;xcllib 1053 passed, 0 failed, 26 ignored, 1 filtered out. All e2e andxg_oracletargets passed.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1was rerun on unmodified upstream8f5fca5bb9ad6e695093d75294ad2cec023bba60and failed identically atcrates/xcl/src/gpu/dxil/fuzz_tests.rs:1171; it is not caused by this change.cargo build --release -p xcl --locked: passed for bothaaa093657bd96a146c05c0c1a9b61149fe761453(main) and this PR's head in separateCARGO_TARGET_DIRs.0x0with no device removals or crashes; the PR head showed 464 frames against main's 393 and peak commit 16275 MB against 15910 MB.git diff --check: clean. Head commit7f0c1a3; smoke main commitaaa0936; original base8f5fca5.Regression run
aaa093657bd96a146c05c0c1a9b61149fe761453, a commit ofmain):7f0c1a3bf5e462cabeb9d29a875e3b300b73a247, clean worktree):Both runs used the same game folder and the title label produced by
scripts/smoke.ps1at the PR head, withXCL_NETWORK=0, clean worktrees and release binaries. The title does not callXMemVirtualQuery; see Not tested.Not tested
XMemVirtualQuery. The low-level use of the full 16-byteXMEM_BASIC_INFORMATIONflags field was reproduced by unit test, not by this smoke title.AI use
CONTRIBUTING.md.@raylitebull on GitHub · 2026-11-25 02:04 UTC · original
Code review on
7f0c1a3:write_xmem_flagsandxmem_gpu_visibleincrates/xcl/src/hle/kernelx.rscleanly zero the full 16-byte+48field before writing CPU-readable (bit 0) and UMA/sparse-VRAM GPU-visibility (bit 1) flags, andxmem_virtual_query_writes_the_whole_flag_field_and_gpu_visibilitycovers stack, reserved, UMA, and sparse allocations cleanly.Build and test (Windows, no GPU)is currently running.Remaining before merge:
PR descriptioncheck.Build and testfinishes green.7f0c1a3.@Adika713 on GitHub · 2026-11-25 02:06 UTC · original
Thanks for the review.
Item 2 is resolved:
Build and test (Windows, no GPU)finished green on7f0c1a3(run45529876776, job138922229109).On item 3, AMD verification was run on the exact PR head
7f0c1a3bf5e462cabeb9d29a875e3b300b73a247:cargo test -p xcl --lib hle::kernelx::tests::xmem_virtual_query_writes_the_whole_flag_field_and_gpu_visibility -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed. With the production change temporarily removed, the same test failed with flags[1, 0, 0, 0, 0xCC x 12].cargo test -p xcl --lib hle::kernelx::tests::virtual_query_fastpath_covers_committed_coherent_window -- --exact --test-threads=1: 1 passed, 0 failed.cargo build --workspace --locked: passed (two pre-existingAtomic::fetch_updatedeprecation warnings).cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1102 passed, 0 failed, 46 ignored, 1 filtered out across 20 test binaries;xcllib 1053 passed, 0 failed, 26 ignored, 1 filtered out; all e2e andxg_oracletargets passed.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1fails identically on unmodified upstream8f5fca5bb9ad6e695093d75294ad2cec023bba60atcrates/xcl/src/gpu/dxil/fuzz_tests.rs:1171, so it is pre-existing and unrelated to this change.git diff --check: clean.No NVIDIA hardware was available for this branch, so NVIDIA verification is still outstanding.
On item 1, the failing
PR descriptioncheck is the required real-titlexcl-smokecomparison for a runtime change. No smoke pair was run for this head, and no result has been fabricated. A maintainer can either have the author supply a valid pair on upstreammainand this exact head, or review the diff as test-only and apply thetest-onlylabel.AI use: OpenCode with Big Pickle (opencode/big-pickle) prepared this draft from the full PR thread,
ghcheck reads and the saved local test logs. It has not been posted.@futurepro62 on GitHub · 2026-11-25 03:37 UTC · original
Full-suite run, since this PR has no test report yet. Tested exact head
7f0c1a3(on its base8f5fca5).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::recomp::lower_dxil::tests::mask_ff0_and_flbit_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 1092 passed, 0 failed, 44 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_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,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.hle::acphal::tests::xapu_connect_returns_oom_and_cleans_up_on_failure(VirtualQueryon the freed data buffer sawMEM_COMMIT(4096), notMEM_FREE). The test reads the state of an address after freeing it, so another test running in parallel can reuse the address. This PR changes onlykernelx.rs. The rerun above, with nothing else running, passed it, and so did the AMD run.xmem_virtual_query_writes_the_whole_flag_field_and_gpu_visibility.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1102 passed, 0 failed, 46 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on maincbc296atoo, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests,const_and_null_mask_operands_agree_with_hlsl_on_the_gpuandmask_ff0_and_flbit_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@DavidM1911 on GitHub · 2026-11-25 04:41 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!