D3D12.X: stage upload arguments for indirect mesh draws #3105
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3105"
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?
Imported from ivall/xcl. Originally posted by Prime1997 on 2026-11-28T07:04:57Z.
Enable standalone UPLOAD-heap arguments/counts for two-pass indirect mesh draws on
nvidia-dev. The existing path only accepts console UMA inputs.Rebased onto main (2026-11-28).
nvidia-devwas merged intomainby #3203, so this PR now targetsmainand its branch was rebased ontomain765b2c5bfff6754e8c9886a73e188a86aca3c64c: heada54edd3735b9268fcc70dd537239b4c9983fd2aa(was95ff502bb2badc516b71836ed9c9c3578b36c567). The one conflict was inexecute_indirect_classified(bind.rs): this PR's checked offsets are kept, onmain'sdispatches,args_off_titleanddraw_pipeline(pso, bound_unbuilt), and the new test'sFakeAdoptedListgainedmain'slast_psofield. That port needs a review. The widerindirecttest filter is not counted: on this PC it ends in an access violation on plainmain765b2c5btoo (3 of 3 runs), wheredispatch_chain::tests::failed_binding_keeps_indirect_commands_until_allocator_resetalso fails alone withadopted class. On the rebased head, on the same RTX 3060 Ti PC, debug profile:cargo check -p xcl --all-targetsexited 0, andcargo test -p xcl --lib -- --test-threads=4 gpu_upload_indirect_preparation_uses_its_recording_arena_and_sources gpu_upload_indirect_staging_keeps_inputs_counts_and_canaries indirect_known_console_ranges_never_fall_back_to_the_pc_buffer indirect_upload_layout_bounds_both_inputs_and_outputs indirect_upload_source_classification_and_failed_submit_retention invalid_indirect_count_records_no_gpu_workgave 6 passed, 0 failed, 0 ignored, no SKIPPED. The whole suite and the paired title runs have not been rerun on this head; every other result below is from the earlier head. The rebase and its conflict resolution were done with Claude Code.What is in it
e429936cstill skips two-pass mesh ExecuteIndirect; #869 and draft #3012 address different ordinary-signature paths.Tested
cargo test --locked -p xcl --lib --target-dir <isolated-target> --no-run: passed.cargo test --locked -p xcl --lib --target-dir <isolated-target> hle::d3d12x::bind::tests::<test> -- --exact --nocapture --test-threads=1: 13 passed, 0 failed, 0 ignored; no SKIPPED messages (1,811 filtered per invocation).indirect_upload_layout_bounds_both_inputs_and_outputs,indirect_known_console_ranges_never_fall_back_to_the_pc_buffer,indirect_upload_source_classification_and_failed_submit_retention,invalid_indirect_count_records_no_gpu_work,gpu_upload_indirect_staging_keeps_inputs_counts_and_canaries,gpu_upload_indirect_preparation_uses_its_recording_arena_and_sources.Regression run
Pending paired clean-head main/PR title runs; no smoke block claimed. Draft until required validation is complete.
Not tested
AI use
Codex (GPT-6) reviewed the related work and actual main source, implemented the bounded NVIDIA adaptation, ran the targeted tests and prepared this PR.
Optional temporary Discord for coordinating contributor work, testing and comparing results: https://discord.gg/6B4TykyC4W
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-28T11:05:37Z.
I checked head
95ff502on an RTX 3080 Ti. All six newbind::testscases passed in four focused invocations (6 passed, 0 failed, 0 ignored, no skips). The two GPU fixtures executed on the adapter. The full workspace and title smoke were not run.One lifetime case needs a regression before this leaves draft.
alloc_pool::executedcallstwo_pass_submitted(..., None, ...)if fence creation orSignalfails after submission. It then leaves no completion mark on the PC allocator backing. Retirement quarantines only blocks with uploadsources(the argument scratch). The two-pass draw also reads its separate record buffer and scaler constants in the recording's UMA arena. On reset, an unmarked backing can appear idle todone_with, allowing those other dependencies to be reused before the submitted GPU work is known complete. The existing failed-submit test checks only the scratch and its upload reference.Suggested recovery and regression
Keep the complete recording dependency set held when a submitted queue has no completion proof: scratch and upload sources, record buffer, allocator backing, and UMA constants. A replacement fence signal on that same queue, issued after the failed marking attempt, can establish a new ordered completion point; release only after it and every other queue mark for the recording complete. If a replacement mark cannot be established, retain the complete set without recycling it. A later proved mark should drain the retained set; the current process-global
UNFENCED_UPLOADShas no drain even after a transient failure.A regression can block a queue behind an unsignaled gate, inject a failed completion mark after submission, reset the recording, and assert that none of the three allocations is reusable. Include two queues: completion on only one must not release the recording; completion on both may release it once.
The focused commands were
cargo test --offline --locked -j 4 -p xcl --lib <filter> -- --nocapture --test-threads=1, with filtersindirect_upload_(2 passed),gpu_upload_indirect_(2),invalid_indirect_count_records_no_gpu_work(1), andindirect_known_console_ranges_never_fall_back_to_the_pc_buffer(1). Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti driver 621.35, DXC 1.8.2502.11. This finding is source-traced; I did not inject a real fence failure. AI use: Codex (GPT-6.2 Sol) reviewed the path and ran the tests; Codex (GPT-6.2 Astra) independently audited the lifetime path.Imported from ivall/xcl. Originally posted by andrewDoing on 2026-11-28T20:50:20Z.
I tested the rebased indirect caller at
a54edd3735b9268fcc70dd537239b4c9983fd2aaon RTX 5070, driver 616.92. Standalone UPLOAD arguments and counts at nonzero byte offsets produced the expected mesh geometry throughexecute_indirect→execute_indirect_classifiedon a tracked direct list.The fixture registered a real native compute/mesh PSO pair as a two-pass pipeline and used the production signature-creation hook to create the DispatchMesh signature and its companion Dispatch signature. The UPLOAD argument buffer held two records starting at byte 16 (16-byte stride, one group then two). A separate UPLOAD count buffer supplied the count at byte 8. The preceding words were zero. The native compute pass wrote each group's ID to the record buffer; the mesh pass read it to distinguish the left and right halves of a 4×4 target.
All four fresh processes logged the production two-pass ExecuteIndirect path. Every pixel matched after a completion fence; zero skips. This exercises the rebased exact/native pipeline route, both checked nonzero offsets, GPU argument rewriting and real indirect command consumption. The PSO pair was synthetic, batching was disabled, and the inputs stayed alive through submission. The test does not cover pending asynchronous PSO resolution, retention after early release, or retail rendering.
AI use: OpenAI Codex adapted the native geometry fixture, ran the four controls, and wrote this report.
Imported from ivall/xcl. Originally posted by vasanex on 2026-11-29T04:23:23Z.
How this was run: the suite ran once on the 11 of your PRs that build on this base, merged together (#3047 #3048 #3049 #3091 #3092 #3103 #3104 #3105 #3107 #3123 #3125; a local tree, only #3125 needed a resolution in README and the
sparse.rstest module); the base alone gave 2608 passed, 0 failed, 49 ignored with the same 27SKIPPEDlines (21 no wave64, 3 refused per-lane f16/f32 forms, 2 heap windows opt-in, 1 driver cache needs Developer Mode). This PR alone was merged onto the base, built (cargo build --workspace, then release), its modules' lib tests run (debug), and smoke-run once for 60 s (scripts/smoke.ps1, retail title, front end,XCL_PREPARE=0). The smoke numbers are for my local merged tree, not a clean-head block for the description.AI use: Claude Code (Claude Opus 5.5 and Claude Fable 5.2) ran the builds, tests and title runs, reviewed the diff and wrote this; the code points cited were checked against the merged tree.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-29T04:58:59Z.
Follow-up to my earlier lifetime review on head
a54edd3: I no longer find premature allocator/UMA reuse for a tracked recording.begin_submitpins the exact backing beforeExecuteCommandLists; a failed fence creation orSignalkeeps that pin, andBackingProbe::freerefuses reuse. My earlier warning about apparently idle scratch, record storage, and scaler UMA applied to the older head.The remaining memory failure mode is retention after a transient fence error. I made an uncommitted candidate that retries completion marking once in the same ordered queue turn and on the same
PendingSubmit. FailedSignalvalues are burned; the retry reserves a fresh value. It checks marker identity before retrying or releasing pins. A second failure leaves the submit pinned. The normal successful path adds no driver call or state-lock acquisition. The best-effort timing receipt also shares this retry budget, so its failed sample may make one extra driver attempt.On the untouched PR head, the new transient-
Signalregression failed (0 passed, 1 failed). With the candidate,cargo test --offline --locked -j 4 -p xcl --lib hle::d3d12x::alloc_pool::tests:: -- --test-threads=4passed 30/30, andcargo test --offline --locked -j 4 -p xcl --lib gpu_upload_indirect_ -- --test-threads=1 --nocapturepassed 2/2 on Windows 11 build 26300, RTX 3080 Ti / 621.35, Ryzen 7 9800X3D. No GPU skip was printed in that focused run.cargo build --offline --locked --workspacepassed.The full
cargo test --offline --locked -j 4 --workspace --no-fail-fast -- --test-threads=4run recorded 2,601 passed, 4 failed attempts, 49 ignored, 26 GPU skip notices. The failures were the mesh HLSL cache test, the two-pass driver-cache test (failed twice through its own retry), anda_preparation_worker_also_builds_a_split_programs_whole_form. The first two had already failed on untouched main in a prior paired check. I reran the compute test on the untoucheda54edd3PR head; it failed there with the same “no split program” result (0 passed, 1 failed). These failures are not attributed to the candidate. I have not run clean-commit paired title smoke or an AMD/Intel adapter check, so this is a candidate for the author to adapt and verify, not a merge-readiness claim.Uncommitted candidate diff and focused regressions
AI use: Codex (GPT-6.2 Sol) investigated, wrote the candidate and regressions, and ran the checks; Codex (GPT-6.2 Astra) independently reviewed the low-level lifetime and retry paths.
Imported from ivall/xcl. Originally posted by Kalmarv on 2026-11-29T22:38:32Z.
merge-check
base:
beeb81be4b(mergeable cleanly on current main)head:
a54edd3735merge: clean
build: cargo check -p xcl --all-targets -> ok
tests: non-GPU lib tests of touched module (bind 17 passed). Full workspace suite and device/GPU tests not run.
review: none blocking. UPLOAD-heap indirect arguments are staged into scratch only on tracked DIRECT recordings, offsets/sizes are overflow-checked, and blocks without a completion fence are quarantined. Note minor behaviour change: ExecuteIndirect with a null argument buffer now counts as skipped mesh work and warns instead of returning silently.
performance: one copy per staged indirect mesh draw; no regression seen in combined run. Tested in a combined 600 s retail run on main
beeb81be+ 13 PRs (warm cache, defaults) vs baseline: presents/2 s 3.27 vs 3.29, peak commit 35,016 vs 35,767 MB, local video memory 14.19-14.76 vs 14.32-14.95 GB, 0 pipeline waits >= 1 s vs 5, 0 device removals, 0 crashes. Combined result across all 13 PRs, not isolated to this PR.verdict: not yet: full workspace suite, device tests, and per-PR visual check not run.
hardware / tool and model: NVIDIA GeForce RTX 5070 Ti, driver 32.0.16.1074, AMD Ryzen 9 9950X, Windows 11 Pro 26200 / Claude Code (claude-opus-5-5)
Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T22:44:19Z.
Review: COMMENTED
Critical review of current head
a54edd37. The currentbegin_submit/backing pin corrects the earlier premature allocator-reuse concern for tracked direct recordings; the follow-up review confirms that correction. I found no new source-level blocker in that ownership route. The critical unverified cases are anExecuteIndirectcount/argument buffer rewritten during recording, failed fence creation orSignal, and allocator reset before submission. Please keep exact-head GPU fixtures for those paths and report retained bytes after a transient failure, since deliberate retention is the remaining memory cost. No local Windows run.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:33:05Z.
Review (head
a54edd37, diff read, not a merge-check; draft, so not built or run):bind.rs~3692) runs beforedraw_pipeline, so an overflowing dispatch or PC ExecuteIndirect is logged as "two-pass ExecuteIndirect skipped" and counted in DRAWS_SKIPPED.XCL_ALLOC_SWAP=0), but the GPU tests only coverrecord_scaled_sources/prepare_scaled_sources_inin isolation; nothing drivesexecute_indirect_snapshotthroughrecords_forandrun_two_pass_planwith upload sources, and no title was run.if max == 0 { return; }(~3729) drops the draw count, the render-target note and the flush of deferred draws that main does, andargs == 0is now counted as skipped (bookkeeping only).UNFENCED_UPLOADS(~93, ~621) is never emptied; it only fills when a submit gets no fence, so rare.Fine: the copy is recorded on the GPU, so it reads the upload buffer at execution time as native ExecuteIndirect does; an upload buffer's GENERIC_READ already allows copying from it; the source buffers are held until the fence completes or the allocator is reset; the copies and the doubled rewritten arguments use separate scratch spans.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T17:03:27Z.
Test report (not a merge-check: draft,
PR descriptionred)base:
b2b1f109d2head:
a54edd3735merge: clean (no textual conflict)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> the lib test target doesn't compile on the merge: error[E0428],
set_test_console_bufferis defined twice incrates/xcl/src/hle/d3d12x/real.rs(main's at ~505,(res, range: Option<(usize, usize)>); this PR's at ~2315,(res, entry: Option<(usize, usize)>)). Main added the same test helper after this PR's base, so the rebase should keep one (and the callers' meaning of the tuple: range vs entry). No tests ran.review: not repeated here; my review of this same head is at https://github.com/xcl-dev/xcl/pull/3105#issuecomment-7301888798, and its findings stand. This run adds what reading couldn't: whether the change merges, builds and passes the whole suite on current main.
performance: not measured.
assessment: needs a rebase onto current main that keeps one
set_test_console_buffer; the findings in my review standhardware / tool and model: RTX 5070 Ti (driver 621.14), Ryzen 7 7800X3D, Windows 11 26300 / Claude Code with Claude Opus 5.5
AI-written and posted by Foniass without a human check of each point.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.