Repository navigation
D3D12.X: plan split-dispatch slabs without heap allocations - #2350
jeroenhaentjens wants to merge 1 commit into
Conversation
dispatch() materialized a Vec before checking whether scratch was available, so the whole-pipeline fallback could allocate one slab per group. The split path also materialized the same plan again while recording commands. Yield slabs lazily, take the fallback before planning, and count slabs during recording. Preserve slab order, root constants and UAV barriers. Empty grids terminate immediately even when the other axes are very large. A bounded allocation probe on the actual planner changes from 24 MiB and 19 allocation/reallocation calls to zero when requesting the first slab of a 1024x1024x1 grid. The 1024x1024x8 case changes from 192 MiB to zero. Six planner tests and nine dispatch-chain tests pass (one native-wave64 skip). The full workspace has 1276 passes, one existing ExecuteIndirect setup failure, 46 ignored tests and 28 explicit skip records. Retail smoke is not available. Part of xcl-dev#2088 Part of xcl-dev#1269 Assisted-by: Codex (exact model identifier unavailable)
|
Tested: current PR head merged onto current No Linux/Wine report in the thread yet; adding one.
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. |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
Independent validation for XCL #2350The optimized slab planner requested zero Rust heap allocations in eight synthetic cases. The base and candidate produced the same slab counts and order-sensitive checksums in every case, and the paired RTX 3070 tests matched the expected GPU readback. Both 60-second retail startup runs exited cleanly with zero device removals. PR #2350 Tested
Regression run Both clean release builds ran Main (PR parent) Exact PR head Not tested The allocator probe measures Rust slab-plan requests. It does not measure native command-list allocation, process commit or GPU scratch. Both retail startup logs reported zero chained dispatches and 0 MiB peak split scratch. The focused GPU fixture exercises the shared recording helper, while the runtime's whole-pipeline fallback after scratch allocation failure remains untested. AMD, native wave64 and a full workspace run were outside this independent validation. AI use One OpenAI Codex agent (GPT-6.2 Sol) reviewed the diff, built the probe, ran the focused validation and drafted this report. A second agent using GPT-6.2 Sol checked the report against the raw test and probe results. The lead agent ran the paired retail smoke using OpenAI Codex (GPT-6.2). |
The split-dispatch path builds a
Vecof every slab before checking whether scratch exists. With no scratch it uses a one-group budget, allocates the entire plan, then falls back to the whole pipeline. With scratch, recording builds the same plan a second time. This change yields slabs on demand and checks the fallback first, removing the planner's heap allocations while preserving dispatch order and barriers.Part of #2088 and #1269. Follow-up to #2080; separate from #2333's allocator/resource-lifetime changes. Draft: paired retail smoke runs are still unavailable.
What is in it
pso.rs,runner.rsandreal/dispatch_chain.rs: lazy slab iteration, count slabs while recording, and size runner scratch from only the first slab. Zero-sized grids terminate immediately. Five additional planner tests cover order, partial dimensions, huge lazy prefixes, zero axes and wide products.Tested
4cd2bc20cc2841dcfb631379870f6de376217e82; baseline main082944135cd2b96288470a595861fa608eee08dc. Windows 11 Pro build 26200, i7-9750H, 32 GB, NVIDIA Quadro RTX 3000 6 GB driver 597.06 (32.0.15.9706), Rust 1.100.0, DXC 1.9.2609.5. MSVC debug; debug symbols/incremental disabled;XCL_ADAPTER=nvidia. Game sample variables andXCL_HEAP_WINDOWSunset.cargo build --workspace --locked: passed.cargo test --workspace --locked --no-fail-fast -- --test-threads=4: 1276 passed, 1 failed, 46 ignored, 28 explicit SKIPPED records. Skips: 21 native-wave64, 3 unsupported f16, 2 missing debug layer, 1 driver cache-control, 1 disabled heap windows.hle::d3d12x::bind::tests::execute_indirect_reads_the_arguments_written_before_it, adapter/setup HRESULT0x80070057. Reproduced withcargo test --locked -p xcl --lib hle::d3d12x::bind::tests::execute_indirect_reads_the_arguments_written_before_it -- --exact --nocapture --test-threads=1on the exact clean main baseline: 0 passed, 1 failed. Existing adapter-selection issue tracked separately in Tests: honor the selected adapter in the indirect argument test #2318.cargo test --locked -p xcl --lib slab_tests -- --test-threads=1 --nocapture: 6 passed, 0 failed, 0 ignored, no skips.cargo test --locked -p xcl --lib dispatch_chain -- --test-threads=1 --nocaptureon baseline and candidate: each 9 passed, 0 failed, 0 ignored; each has 1 explicit native-wave64 skip. The 3D divergent-forward-edge fixture covers wave32 and split-wave64, whole/CPU equality, slab budgets 1/2/3/6/7/12 and guard words.rustc -O, extracting the actual planner from each revision: requesting one slab of[1024,1024,1], budget 1, changes 19 allocation/reallocation calls and 24 MiB peak requested live bytes to 0 calls / 0 bytes. The same zero-allocation assertion fails on baseline (exit 101) and passes on candidate (exit 0). The bounded[1024,1024,8], budget 1 case changes 192 MiB to zero. Across 12 comparable prefix/full-plan cases, counts and order-sensitive checksums match; all candidate cases allocate zero. This measures the planner's allocator requests, not process RSS or VRAM. No FPS or retail-crash fix is claimed.git diff --check: passed. Independent Codex subagent review found no blocking issue.Regression run
Not tested
AI use