Skip to content

D3D12.X: a freed descriptor range at the cursor serves requests into the tail - #1970

Merged
raylitebull merged 1 commit into
xcl-dev:mainfrom
brandostrong:cursor-straddle
Nov 25, 2026
Merged

raylitebull merged 1 commit into
xcl-dev:mainfrom
brandostrong:cursor-straddle

Conversation

@brandostrong

@brandostrong brandostrong commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

The shared console descriptor heap reported itself full while a contiguous run was free: a freed range ending exactly at the allocation cursor is contiguous with the never-used tail, but take_range checked the freed list and the tail separately and refused requests larger than the freed range — the false-exhaustion shape a public sibling project reported for the same allocator design (Marvisak/VIctory#871; facts only, no code ported). Part of the D3D12.X contract line claimed on #1269.

What is in it

  • crates/xcl/src/hle/d3d12x/console_heap.rs: take_range takes a freed range that ends at the cursor whole and bumps the cursor over into the tail; release_global merges touching released ranges (merge_release) so first-fit sees whole runs; two unit tests (cursor straddle, release merge)

Tested

  • RTX 4090, i9-13900K, 32 GB RAM, Windows 11 26200, cargo 1.100.0, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on 527e7dd: 988 passed, 0 failed, 45 ignored; 22 SKIPPED, all adapter limits of this wave32 card (the wave64 lowering/comparison GPU tests and heap_window_out_of_memory_falls_back_to_the_switch_form); head 646b439 is the same code with a shorter comment header, and it builds release clean
  • the straddle test asserts Some(8) for exactly the input the old code returned None for (freed 4 at the cursor, 4 of tail, request 8) — it pins the fixed shape

Regression run

  • both runs on the same title state (the head run first, the main run from the state it left), same 150 s window; both end on the same stall screen before the world, so the counts compare the same screen:

main 62265d3:

xcl-smoke v1
commit: 62265d3bbde2255f849fb650cc29872df91a4cf0
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 150
exit: 0x0
frames shown: 1638 (PresentX 1638)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 34164 MB

head 646b439 (no uncommitted changes):

xcl-smoke v1
commit: 646b439e195f401cfa0890bedea428d26d7d10d8
gpu: NVIDIA GeForce RTX 4090
title: 3c290c16
seconds: 150
exit: 0x0
frames shown: 1625 (PresentX 1625)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 34049 MB

Not tested

  • AMD / RADV

AI use

  • Claude Code, Claude Opus 5.5: wrote the fix, the tests, and this description, and ran the suite; the user reviewed the diff.

🤖 Generated with Claude Code

…the tail

take_range checked the freed list and the never-used tail separately: a freed
range ending exactly at the cursor is contiguous with the tail, but a request
larger than the range was refused as full even though the run was there (the
false-exhaustion shape a public sibling project reported for the same design,
Marvisak/VIctory#871 - facts only, no code taken). take_range now takes such a
range whole and bumps the cursor over into the tail; release_global merges
adjacent released ranges so first-fit sees whole runs. Found while writing the
descriptor-allocator contract tests for xcl-dev#1269.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@brandostrong
brandostrong marked this pull request as ready for review November 25, 2026 00:32
anoyarou pushed a commit to anoyarou/xcl that referenced this pull request Nov 25, 2026
…the tail (xcl-dev#1970)

take_range checked the freed list and the never-used tail separately: a freed
range ending exactly at the cursor is contiguous with the tail, but a request
larger than the range was refused as full even though the run was there (the
false-exhaustion shape a public sibling project reported for the same design,
Marvisak/VIctory#871 - facts only, no code taken). take_range now takes such a
range whole and bumps the cursor over into the tail; release_global merges
adjacent released ranges so first-fit sees whole runs. Found while writing the
descriptor-allocator contract tests for xcl-dev#1269.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@raylitebull

Copy link
Copy Markdown
Member

Code review on 646b439:

  • take_range in crates/xcl/src/hle/d3d12x/console_heap.rs cleanly bridges a freed range ending at *next into the unused tail (using u64 for the sum check), release_global early-returns on count == 0, and merge_release sorts and coalesces adjacent freed ranges so multi-release runs stay contiguous.
  • Both CI checks are green and the unit tests cover both cursor straddling and chained merges.

What is still needed before merge: Independent AMD and NVIDIA verification (currently author RTX 4090 only).

@futurepro62

futurepro62 commented Nov 25, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 646b439 (on its base 62265d3).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_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::dxil::fuzz_tests: 978 passed, 0 failed, 43 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.
  • The new tests ran and passed: a_freed_range_at_the_cursor_continues_into_the_never_used_tail, released_ranges_touching_one_another_merge_into_one.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 987 passed, 0 failed, 45 ignored. SKIPPED: f16_programs_on_the_gpu (f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), f16_programs_on_the_gpu (f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #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 gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426 semantics differ from the console's))), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • --skip leaves out tests that fail on main 7994cd1 too, not because of this PR. On NVIDIA: heap_window_out_of_memory_falls_back_to_the_switch_form (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), the four gpu::recomp::lower_dxil::tests::*_programs_on_the_gpu tests and const_and_null_mask_operands_agree_with_hlsl_on_the_gpu (follow-up on #1651) fail because runner::skip_test turns their skips into failures under XCL_REQUIRE_GPU=mesh, and gpu::dxil::fuzz_tests seeds 70, 545, 1019 and 1507 fail CreateComputePipelineState with E_OUTOFMEMORY on this card (drivers 616.64 and 621.40). On AMD: fuzz_validate_and_gpu_1 fails on seed 540 (res[833] 0x7 vs CPU 0x6). The AMD run does not set XCL_REQUIRE_GPU.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@JJAutoCompare

Copy link
Copy Markdown

PR #1970 verification on STOR-WINLAB

PR head 646b439e195f401cfa0890bedea428d26d7d10d8, fetched from origin at refs/pull/1970/head and confirmed again after the run. origin/main was 86719eec1e9fc4c36c5fb568ec4951fd47a31b88. git merge-tree --write-tree origin/main HEAD exited 0 and returned tree 489a13a21ef8eb44e6c33150e4d41c20b0627b23.

What is in it

  • crates/xcl/src/hle/d3d12x/console_heap.rs lets a descriptor allocation span a freed range at the cursor and the unused tail. It also coalesces adjacent released ranges. The two new tests exercise these paths.

Tested

  • Windows 11 Enterprise Evaluation build 26200.9974, AMD Ryzen 7 3800X, Intel Arc A770 16 GiB, driver 32.0.101.9175, waves 8–32, DoublePrecisionFloatShaderOps=0. DXC and DXIL 1.9.2609.5. Rust 1.100.0 (0ef1bc386 2026-11-09). Debug profiles with debug info and incremental compilation disabled.
  • The assigned slot had no checkout, so I created a detached checkout under L:\XclTooling\neon-slot-4\source. The worktree was clean before and after testing.
  • cargo build --workspace and cargo test --workspace --no-run succeeded outside the GPU lock.
  • cargo test -p xcl --lib a_freed_range_at_the_cursor_continues_into_the_never_used_tail -- --show-output and cargo test -p xcl --lib released_ranges_touching_one_another_merge_into_one -- --show-output each reported 1 passed, 0 failed, 0 ignored, and 0 explicit skips outside the GPU lock.
  • One run under L:/XclTooling/Invoke-ArcTest.ps1 with process-local execution policy Bypass: cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output exited 101 after all 20 targets reported. Libtest reported 963 passed, 25 failed, 45 ignored. The log contains 25 explicit SKIPPED entries. Libtest can include skipped cases in its pass count. Those cases provide no coverage for the skipped paths.
Test target Passed Failed Ignored
xcl library unit tests 915 24 25
xcl CLI unit tests 0 0 0
bcpack_parity.rs 1 0 0
console_dlls_e2e.rs 13 0 0
console_shaders.rs 3 0 4
disasm_e2e.rs 1 0 0
e2e.rs 2 1 0
gpu_compute_e2e.rs 4 0 0
gpu_pso_e2e.rs 7 0 0
heap_probe.rs 0 0 4
low_va.rs 1 0 0
pls_quota.rs 1 0 0
predication_e2e.rs 1 0 0
rpf_e2e.rs 2 0 0
shaders_e2e.rs 4 0 0
sparse_reinit.rs 1 0 0
texture_states.rs 1 0 0
xg_oracle.rs 6 0 12
xcl-testtitle CLI unit tests 0 0 0
Doc-tests xcl 0 0 0

Failures

  • CreateComputePipelineState returned 0x80070057 in 20 unit tests:
    • gpu::dxil::fuzz_tests: fuzz_validate_and_gpu_0 (seed 2), fuzz_validate_and_gpu_1 (506), fuzz_validate_and_gpu_2 (1003), fuzz_validate_and_gpu_3 (1501).
    • gpu::dxil::ops_tests: doubles_match_cpu, groupshared_barrier_and_atomics_run.
    • gpu::dxil::round_tests: gpu_direct_f32_round_modes_dynamic_and_denormals, gpu_direct_f32_round_modes_static.
    • gpu::recomp::lower_dxil::tests: f64_programs_on_the_gpu.
    • gpu::recomp::tests: gpu_clamp_and_omod_per_instruction, gpu_f64_class_compare, gpu_f64_compares_with_nan, gpu_f64_literal_high_word, gpu_f64_math_random, gpu_f64_roots, gpu_f64_rounding_and_conversions, gpu_float_compares_random, gpu_frexp_f64_exp_and_mant, gpu_ldexp_f64, gpu_rndne_f64.
  • Four further assertions failed in gpu::recomp::tests: gpu_nonfused_mad_and_mac_prevent_fma_contraction returned infinity in the fused overflow control, gpu_ps_image_sample_offset_implicit_lod_between_mips gave 25.609375 vs 26 at pixel (0,0), gpu_valu_16_and_64_bit zeroed the value in the lane 0 v_add_f16 high-half preservation check, and gpu_wave64_ps_whole_wave_reductions gave [2, 217, 2] vs [2, 216, 2] at pixel 0 on 16-lane waves.
  • e2e::test_title_runs_and_game_folder_is_untouched failed the synthetic title's RSSetDepthBiasX(-1000.5) depth check (Split wave64: masks read only lane by lane stay in their half #94). The top-right pixel was blue, with green expected.

Explicit skips

SKIPPED gpu::recomp::lower::tests::a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower::tests::the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::a_per_lane_2d_or_3d_group_runs_on_the_gpu: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::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))
SKIPPED gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu: f16 packed, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 compares, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer arithmetic, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::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))
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 conversions, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 rounding, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu: integer carries, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 transcendentals, wave64: no wave64
SKIPPED gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu: f32 three-source, wave64: no wave64
SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
SKIPPED shaders::tests::pso_measurement_compiles_an_exact_synthetic_record: cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D)
SKIPPED placed_title_textures_share_vram_and_preserve_pixels: tiled tier < 2
SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (The application requested an operation that depends on an SDK component that is missing or mismatched. (0x887A002D))

Not tested

  • A comparative suite run on main and real-title scripts/smoke.ps1 runs on either commit are outside this run. The observed failures have no same-host baseline for attribution.
  • Other GPUs and release profiles. The log also records fixture or feature early returns for unset XCL_SAMPLE_RPF, XCL_SAMPLE_TTPF, and XCL_SAMPLE_AWC, and unavailable audio, system XGameRuntime, or heap windows.

AI use

T3 Code / Codex (gpt-6.2-sol) ran the build and tests and drafted this report. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against pr1970-suite.log and published this report.

@raylitebull
raylitebull merged commit bdda528 into xcl-dev:main Nov 25, 2026
3 of 5 checks passed
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants