D3D12.X: reserve split compute scratch before allocating it #2532
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!2532
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2532"
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?
@razormontana on GitHub · 2026-11-25 21:47 UTC · original
razormontana:d3d12x/reserve-split-scratch-before-allocation→main· +105 −16 · 2 files · 1 commits · openTwo command lists could both ask D3D12 for 256 MiB of split-compute scratch under a shared 384 MiB budget. Each recording checked the available space before either driver allocation had returned. XCL now reserves a recording’s allowance when it chooses the buffer size. Part of #1833.
What is in it
real/dispatch_chain.rscovers the allocation in progress and then the buffer’s lifetime. An allocation failure immediately returns the reservation. Live and peak scratch counters still measure successful allocations.mainat6d12f58. #2469 covers reusing a recording’s existing buffer after a failed growth request. The two patches conflict inscratch_for, and #2469 already has a separate test hunk that overlaps with #2118 onmain.Tested
bb33ceed26be32dba18b4799d0b6396649bed840. The focused admission tests run on the CPU.cargo +stable-x86_64-pc-windows-msvc test --offline --locked -p xcl --lib hle::d3d12x::real::dispatch_chain::tests:: -- --nocapture --test-threads=1 --skip a_list_recorded_after_another_goes_on_in_its_scratch. The original charge-after-allocation behavior with the test seam produced 1 pass and 2 failures. Concurrent recordings each requested 256 MiB and an in-progress 16 MiB allocation counted as zero. After the fix, 3 passed, 0 failed, 0 ignored and 0 runtime skips. The concurrent requests were 256 and 128 MiB.cargo build --offline --locked --workspaceandcargo build --offline --locked --release --workspacesucceeded. The debugcargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4 --show-outputrun withXCL_ADAPTER=3070reported 1,425 passed, 0 failed and 46 ignored across 37 targets. The pass count includes 26SKIPPEDnotices (21 native-wave64 checks, 3 unsupported per-lane forms, 1 reserved cube with mips and 1 heap-window check).Regression run
Both clean release builds ran
scripts/smoke.ps1 -Game <folder> -Seconds 60on the same retail title in the Series S profile on the RTX 3070. They usedXCL_DIRECT_DXIL=1, networking off and identical starting copies of XCL's warmed cache. NVIDIA's driver cache settings were left at their defaults.Main
Candidate
Not tested
Both retail smoke logs reported zero chained dispatches and 0 MiB peak split scratch. The concurrent-admission case is covered by the synthetic test. Retail prevalence, effect on NVIDIA device removals, and behavior on AMD and Intel GPUs remain unmeasured.
AI use
OpenAI Codex (GPT-6.2 Astra) inspected the recording path, wrote the code and tests, ran the focused tests and drafted this description. OpenAI Codex (GPT-6.2 Sol) independently reviewed the diff and evidence and edited this description. The lead agent ran the workspace suite and retail smoke using OpenAI Codex (GPT-6.2).
@DavidM1911 on GitHub · 2026-11-25 22:08 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!
@emirduran707 on GitHub · 2026-11-25 22:38 UTC · original
Independent AMD RDNA4 (native wave64) test report on exact head
bb33ceed26be32dba18b4799d0b6396649bed840(clean detached checkout, no local changes).Tested
stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1423 passed, 2 failed, 46 ignored; 8 SKIPPED (6 inlower_dxil::tests::{f16,f32}_programs_on_the_gpurefused by per-lane form;heap_window_out_of_memory_falls_back_to_the_switch_form;pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.hle::d3d12x::real::dispatch_chain::tests::pending_scratch_releases_its_charge_on_allocation_failureandsimultaneous_scratch_allocations_share_the_total.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1seed 722 andfuzz_validate_and_gpu_3seed 1599) are pre-existing on unmodifiedmainon this GPU.Regression run (60 s retail-title smoke,
XCL_NETWORK=0, release)(Matched
main68a284abaseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)Not tested
AI use
@xpatfussy69x on GitHub · 2026-11-25 22:40 UTC · original
Test run on exact head
bb33cee(bb33ceed26be32dba18b4799d0b6396649bed840, on its base6d12f58), clean tree.Tested
cargo test --workspace -- --test-threads=4: 1425 passed, 0 failed, 46 ignoredV_MUL_F16/V_PK_MUL_F16/V_CVT_F16_F32(onmaintoo)cargo test -p xcl --lib scratch: 7 passed, 0 failedsimultaneous_scratch_allocations_share_the_total: okpending_scratch_releases_its_charge_on_allocation_failure: okcrates/xcl/src/hle/d3d12x/real/dispatch_chain.rs(git merge-treeof both heads); whichever lands second needs a rebaseRegression run (60 s, default settings, a retail title)
main:
this PR:
No crash or device removal; frames 105 % of
main's, peak commit 100 %.Not tested
main(tested on its own base; it merges intoe1d84b7without conflicts)AI use
@SlopTart on GitHub · 2026-11-25 23:07 UTC · original
Tested: current PR head merged onto current
origin/main(clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo targetx86_64-pc-windows-gnurun under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).gpu_suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.Targeted run of
pending_scratch_releases_its_charge_on_allocation_failureandsimultaneous_scratch_allocations_share_the_total: 2 passed.Not tested: retail titles (no title data on this lane, counts only).
AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.
@Prime1997 on GitHub · 2026-11-26 13:30 UTC · original · reviewed
Good within the targeted test scope; retain for integration. Reserves scratch allocation charges atomically across concurrent callers and releases failed allocation charges.
Reviewed PR head
bb33ceed26be32dba18b4799d0b6396649bed840. Tested an isolated, uncommitted merge-tree integration with latest mainb49be1836844fe0b0cdb3211dce3cb7fb4e21ac7, treee4c55ae457a47405bc9c2e1b6ae7c33ad5e53c77; this is not a clean PR-head run. Integration source overlay SHA-256:b2678aaed83e7a4a03919ea87f1bc64eb22a68e5118ca474ae5963734a8ca68f.Measured: 2 passed, 0 failed, 0 ignored, 0 skipped. Exact selected filters, each run in a fresh process:
hle::d3d12x::real::dispatch_chain::tests::simultaneous_scratch_allocations_share_the_totalhle::d3d12x::real::dispatch_chain::tests::pending_scratch_releases_its_charge_on_allocation_failureBuild:
cargo test --locked --offline -p xcl --lib --no-run --message-format=json --target-dir <isolated-target>. Run each:<test-exe> <exact-filter> --exact --test-threads=1 --nocapture. Private target/executable paths are placeholders. Windows 11 Pro 26200, i5-10400, 32 GiB, Rust 1.100.0 MSVC debug; private temporary/cache paths, two low-priority build jobs, 90-second per-test bound.Scope: CPU mutex/barrier reservation model covering simultaneous reservations, failure rollback and reuse. No CreateCommittedResource call or real memory exhaustion was induced. No full suite, retail run, sustained memory pressure or performance benefit is established. Passing these fixtures is not merge certification.
AI use: Codex (GPT-6) inspected the changes and fixtures, ran the checks and verified raw receipts. Optional temporary Discord for coordinating contributor work, testing and comparing results.
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.