Repository navigation
Conversation
|
Review of In short: The PR makes three changes to split compute chains:
The LDS range analysis and the narrower barriers look sound. Two things block it: the new build queue delays dispatches that are skipped until their whole form exists, and no reported test run covers the recompiler change. High
Medium
Nit
Checked and fine
Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point. |
vasanex
left a comment
There was a problem hiding this comment.
Review of c6c9ca9 (code reading and the tests named below, not a merge-check) - 1 finding, 1 addition to an open point
In short: this adds to Foniass's review of the same head and does not repeat it. Two things from it can be answered with data: the whole suite and the new split test were run here on a merge (below), and the new GPU parity test does notice a wrong transfer. One point is new: a promoted direct dispatch keeps nothing alive for the list it was recorded on. I agree with their point 1 (the build queue) and add one detail to it.
Measured (RTX 3080, wave32, Windows 11, merge of c6c9ca9 onto main 16c2fd0 = bae972b6):
cargo build --workspace: ok.cargo test --workspace --no-fail-fast -- --test-threads=4(debug): 3015 passed, 0 failed, 56 ignored; 25 SKIPPED, the same tests as on main (main: 3012 / 0 / 56). The three new tests ran and passed,dispatch_chain_lds_vectorized_and_trimmed_rangeswith its GPU part (not skipped on this card).- Does that test notice a wrong result? Four deliberate breaks of
split.rs, one at a time, each restored:- the recorded span cut to one word (
(lo, lo + 1)): fails, at the size assertion; - spans from index 4000 up accepted but not recorded (three accessed words left out of the transfer): fails, split and whole outputs differ on the GPU;
- quads restored four words off: fails, outputs differ on the GPU;
- the bound of
waveGetLaneIndexset to 15 instead of 31: still passes. The test's indices come from the thread id, so that arm ofu32_rangehas no test.
- the recorded span cut to one word (
scripts/smoke.ps1, 60 s, offline, release: 1692 frames (main 1696), no device removal, no crash, peak commit 17831 MB (main 18885 MB; two runs of the same runtime code differed by 4 % here tonight). The smoke run does not get to the world, so it says little about the promoted path or the queued whole builds.
Findings (each in its own thread):
- Low to medium, read: a promoted dispatch records no
Recording, so the whole pipeline bound on the list is owned by theChainalone and goes with the title's finalReleaseof the pipeline, also while the list is still in flight. The split path is safe against that on main (Recording.first). - Addition to Foniass's point 1, read: after an out-of-memory whole build the direct path queues a job for every dispatch and retries the compile every 10 s for as long as the program is dispatched.
Checked and fine, beyond what is already listed there: the transfer layout is contiguous per range (quad q at 16q, tail word t at 4 * (tail_start + t) from the range's slot), a chain is cached as a unit with its dwords_per_group, LDS words that only the replayed prefix touches need no restore, and piece_has_non_scratch_uav reads the offsets XCL's own writer produces (ResourceHeapIndexing is set for every createHandleFromHeap).
Not checked: a title run into the world (plain main does not get there on this card), so neither the promoted path nor the cost of the queued whole builds was measured; AMD and wave64; which barriers are recorded on a real list; the conflicts with #3754 and #3763.
Review by Claude Code (Claude Fable 5.2), with an independent second read by a subagent (Claude Fable 5.2) whose points were checked before use, posted without a human check of each point. An automated PR review workflow is running at the request of the user.
| return Ok(()) | ||
| }; | ||
| if grid.contains(&0) { return Ok(()); } | ||
| if let Some(Ok(whole)) = chain.whole.ready() { |
There was a problem hiding this comment.
Low to medium, read (not measured).
The split path below pushes a Recording { first, chain, .. } for the allocator ("Keep the title-visible first piece alive while this recording may still execute"), and it goes at allocator_reset. This early return records nothing: the whole pipeline bound on the list has one owner, Chain.whole.
Scenario: the title records a promoted Dispatch, then does its final Release of the pipeline before that list has run on the GPU. pso_release sees the count reach zero, forget_pso -> dispatch_chain::forget drops the Chain, and with it the last reference to the whole pipeline, while a recorded or submitted list has it bound. On main the same sequence is harmless on this path: Recording.first holds a reference to the title's pipeline, the title's Release does not reach zero, and forget runs only after the allocator is reset.
Whether a title does this I cannot say from the code. late_release.rs exists because a retail title's final Release did arrive with work in flight, and pso_release already hands the real pipeline of a late-built one to late_release::hold_pipeline for that reason. The same gap is on main in the no-scratch fallback a few lines down; this change makes it the usual path instead of a rare one.
Suggested fix: keep the chain for the recording here too (an entry in RECORDINGS for the allocator, without scratch), or let the Chain's whole pipeline go through late_release::hold_pipeline when the chain is dropped.
There was a problem hiding this comment.
Fixed in e58ea25. Read in the delta from c6c9ca9 (one file): the promoted dispatch and the no-scratch fallback now push a Recording { scratch: None, first: whole, chain, .. } for the allocator, so the whole pipeline and its chain stay until allocator_reset, also after the title's final Release.
Measured on a merge of e58ea25 onto main 16c2fd0 (RTX 3080, debug): cargo test -p xcl --lib dispatch_chain::tests -- --test-threads=4: 18 passed, 0 failed. With the new push taken out of the promoted path, direct_dispatch_promotes_to_ready_whole_without_queuing_cold_whole fails at its "keeps whole PSO alive until allocator reset" check.
What is left, as on main: with allocator == 0 nothing is kept. The whole suite and the smoke run were not repeated for this follow-up.
Follow-up by Claude Code (Claude Fable 5.2), posted without a human check of each point. An automated PR review workflow is running at the request of the user.
| list.Dispatch(x, y, z); | ||
| return Ok(()); | ||
| }; | ||
| if chain.whole.ready().is_none() && !chain.whole_code.is_empty() { let _ = queue_whole(&chain); } |
There was a problem hiding this comment.
Addition to Foniass's point 1, read (not measured).
When a whole build ends in E_OUTOFMEMORY, WholeBuild keeps no result and WholeSentGuard clears whole_sent. ready() is then still None, so with this line every later direct dispatch of the program queues a new job: until WHOLE_RETRY has passed each one returns at once, after it the next one runs the whole compile again, and that repeats every 10 s for as long as the title dispatches the program. On main only indirect dispatches did that.
Scenario: a machine short of commit and a title that dispatches a few large split programs every frame: the one worker keeps taking the same giant compiles in turn, each waiting for its headroom and failing again, and the builds that skipped draws wait on (your point 1) sit behind them.
If the direct path keeps queueing whole builds, a cap on retries for builds no dispatch waits on (or no retry at all for them) would bound it.
There was a problem hiding this comment.
Fixed in e58ea25: the direct path no longer queues a whole build (the line is gone, and the renamed test asserts !chain2.whole_sent), so a direct dispatch is promoted only when the whole form was built for another reason, and the retry after an out-of-memory build is back to what main does for indirect dispatches. Same run as in the other thread: 18 passed, 0 failed.
Follow-up by Claude Code (Claude Fable 5.2), posted without a human check of each point. An automated PR review workflow is running at the request of the user.
Speed up direct split compute chains without changing the DispatchChain disk-cache format or conflicting with indirect promotion: - Direct whole reuse (`dispatch_chain::dispatch`): when `chain.whole` is already compiled, bind it directly, issue a single Dispatch with zero scratch, slabs, or barriers, and retain the promoted PSO on the allocator's recordings until reset. Direct dispatches never queue cold whole compiles so skipped indirect/mesh builds are never delayed. - 128-bit vectorized and LDS-trimmed split scratch (`module/split.rs`): transfer shared-memory spill/reload slices as `v4i32` `rawBufferLoad`/`rawBufferStore` quads (with scalar tail) and trim `xcl_lds` spill/reload to provably accessed `(start, count)` dword intervals, failing closed to the full 8192-dword array on unbounded indices. - Targeted scratch UAV barriers (`pso.rs`, `dispatch_chain.rs`, `runner.rs`): emit `UAV(Some(scratch))` on slab/chain reuse boundaries (`i == 0`) and after pieces whose SFI0/PSV0 prove no non-scratch UAV access, keeping global `UAV(None)` after pieces that bind guest UAVs or resource-heap indexing. AI-assisted: Antigravity (Gemini 4 Neon)
c6c9ca9 to
e58ea25
Compare
Summary
Speed up direct split compute chains without changing the
DispatchChaindisk-cache format or conflicting with indirect promotion (crates/xcl/src/gpu/dxil/module/split.rs,crates/xcl/src/gpu/recomp/{pso.rs,runner.rs},crates/xcl/src/hle/d3d12x/real/dispatch_chain.rs, +370 / -67):dispatch_chain::dispatch): Whenchain.wholeis already compiled/ready, bind it directly and issue a singleDispatchwith zero scratch, slabs, or barriers; direct dispatches never callqueue_whole, so skipped indirect/mesh builds are never delayed behind direct dispatches. Promoted/fallbackwholePSOs and theirchainremain retained inRECORDINGS[allocator](scratch: None) untilallocator_resetso GPU lifetime is preserved.module/split.rs): Transfer shared-memory spill/reload slices asv4i32rawBufferLoad/rawBufferStorequads (with scalar tail) and trimxcl_ldsspill/reload to provably accessed(start, count)dword intervals, failing closed to the full 8192-dword array on unbounded indices.pso.rs,dispatch_chain.rs,runner.rs): EmitUAV(Some(scratch))on slab/chain reuse boundaries (i == 0) and after pieces whose SFI0/PSV0 prove no non-scratch UAV access, keeping globalUAV(None)after pieces that bind guest UAVs or resource-heap indexing.Testing
Tested
621.40, wave32), Intel Core i5-11400F, 32 GB, Windows 11 build 26200, release build.cargo test -p xcl --lib dispatch_chain::tests: 18 passed, 0 failed;cargo test -p xcl --lib split::tests: 29 passed, 0 failed (baselinemain395405e4full workspace: 3012 passed, 0 failed, 56 ignored, 28 SKIPPED).title 29640639, 60 s viascripts/smoke.ps1, clean worktree ate58ea256397e26e53f9d6872eefffa1341fb494fvsmain395405e4c0ed814afde0610a724dc96a3af329de):Regression run
main (
395405e4):PR (
e58ea256):Not tested
title 29640639.AI use
xcl-smoke v1runs are executed directly on local hardware.