Repository navigation
Conversation
|
Review (head 875576c, diff read, not a merge-check):
Fine: the warm-ahead cap is a clean flag on AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Thanks for the review — addressed all three points in 0b561a2:
|
|
Follow-up review (head 0b561a2, since 875576c, diff read, not a merge-check):
New:
Fine: the warm-ahead cap is still a separate flag and translated pipelines already in AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
…ysical RAM Add XCL_PSO_WARM_AHEAD (default 2 * XCL_PSO_AHEAD) to cap eager translate-ahead work in next_with_warm, and gate ahead_room() on available physical RAM via crate::ram_budget::available() (XCL_PSO_AHEAD_MIN_PHYS_MB, default 2048 MiB; 0 disables) in addition to virtual commit headroom.
0b561a2 to
adeec38
Compare
|
Thanks for the follow-up review — squashed into a single clean commit ( (Sorry for the truncated previous comment — PowerShell mangled inline backticks.) AI use: Antigravity (Gemini 4 Neon) assisted with squashing the commits and drafting this reply. |
|
Follow-up review (head adeec38, since 0b561a2, diff read, not a merge-check; checks red):
New:
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Updated the PR description with a fresh 60 s smoke on head commit All substantive review points are addressed (reused AI use: Antigravity (Gemini 4 Neon) ran the head smoke and drafted this reply. |
|
merge-check
|
|
merge-check claim |
|
merge-check |
bmjask
left a comment
There was a problem hiding this comment.
Review of adeec387: 4 finding(s) (3 high, 1 medium), most severe first.
- High
crates/xcl/src/hle/d3d12x/pso_async.rs:5048:WARMEDonly ever goes up, so once it reacheswarm_ahead_cap()translate-ahead is off for the rest of the process, and pipelines translated after that are never built ahead. (inline) - High
crates/xcl/src/hle/d3d12x/pso_async.rs:4902: Once the warm cap is reached nothing popsBacklog::warmany more, so entries pile up for the life of the process together with their Warm closures, including builds already claimed, released or completed. (inline) - High
crates/xcl/src/hle/d3d12x/pso_async.rs:4990: Not certain about this one, because it depends on typical free RAM on 16 GB hosts, which wasn't tested: the physical-RAM floor is put intoahead_room(), which turns off all build-ahead work, not just speculative DXC translation. (inline) - Medium
crates/xcl/src/hle/d3d12x/pso_async.rs:5065: see below.
On lines outside the diff:
- Medium
crates/xcl/src/hle/d3d12x/pso_async.rs:5065:WARMEDis incremented only after a translation finishes, while the cap is checked earlier under the lock, so concurrent workers can all pass the check. With 2-4 backlog workers andWARMED == cap-1, each takes a Step::Warm (translations take milliseconds to seconds) before any increments, so up tocap + workers - 1translations run. Incrementing when the step is handed out, under the list lock, would make the cap a real bound.
These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
| let next = g.next(ahead_room(), AHEAD_BUILDS.load(Ordering::Relaxed) < ahead_cap()); | ||
| let next = g.next_with_warm( | ||
| ahead_room(), | ||
| WARMED.load(Ordering::Relaxed) < warm_ahead_cap(), |
There was a problem hiding this comment.
High: WARMED only ever goes up, so once it reaches warm_ahead_cap() translate-ahead is off for the rest of the process, and pipelines translated after that are never built ahead. A retail title makes ~51,000 lazy pipelines in its first seconds. The workers translate 8,192 (WARMED also counts translations a bind later claimed, and ones that panicked), and from then on warm_allowed is false for good. The remaining graphics pipelines stay in warm and never reach cold, even while AHEAD_BUILDS is far below ahead_cap(), so their first binds go back to the 7-15 s driver-build stalls (the 156 s no-frame case) that build-ahead exists to prevent. Gating on outstanding work instead (e.g. allow warm only while AHEAD_BUILDS + cold.len() < ahead_cap()) bounds memory without turning it off.
| match warm { | ||
| Some(w) => return Some((build, Step::Warm(w))), | ||
| None => self.cold.push_back(build), | ||
| if warm_allowed { |
There was a problem hiding this comment.
High: Once the warm cap is reached nothing pops Backlog::warm any more, so entries pile up for the life of the process together with their Warm closures, including builds already claimed, released or completed. Before this PR the drain loop also discarded entries that were no longer unclaimed. After the cap, every new lazy graphics pipeline send_ahead pushes stays there: a bound-and-built one keeps its Arc, and an unused one also keeps its closure and captured shader data. g.len() and the BACKLOG stat keep growing and memory goes up, the opposite of the PR's aim. Still draining claimed/finished entries when the cap is reached would stop the growth.
| ahead_room_for( | ||
| ahead_cap() > 0, | ||
| || super::real::big_compile_commit_free(AHEAD_FREE), | ||
| || super::real::big_compile_commit_free(AHEAD_FREE) && phys_ram_room(ahead_min_phys_bytes()), |
There was a problem hiding this comment.
High: Not certain about this one, because it depends on typical free RAM on 16 GB hosts, which wasn't tested: the physical-RAM floor is put into ahead_room(), which turns off all build-ahead work, not just speculative DXC translation. That includes driver builds of pipelines that are already translated (cold) and the new-compute lane. On a 16 GB host running a title, available physical RAM often drops below 2048 MiB, so ahead_room() returns false and next_with_warm returns None at if !ahead. Cheap, already-translated pipelines stay unbuilt and the title stalls at first bind. Applying the RAM gate only to the warm (translate) lane would keep the protection where it matters.
|
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any. |
During heavy pipeline registration bursts, the eager translate-ahead lane (
next_with_warm) could drain and translate thousands of unused shaders ahead of first use, inflating DXIL/driver-cache commit and pushing 32 GB hosts into the SSD pagefile even while virtual commit headroom (AHEAD_FREE) still looked sufficient.This PR adds:
XCL_PSO_WARM_AHEAD, default2 * XCL_PSO_AHEAD) passed throughnext_with_warm.ahead_room()via existingcrate::ram_budget::available(), configurable viaXCL_PSO_AHEAD_MIN_PHYS_MB(default2048MiB;0disables the physical-RAM gate).What is in it
crates/xcl/src/hle/d3d12x/pso_async.rs:warm_ahead_cap()(XCL_PSO_WARM_AHEAD, defaultahead_cap().saturating_mul(2)).ahead_min_phys_bytes()(XCL_PSO_AHEAD_MIN_PHYS_MB, default2048MiB;0disables) +phys_ram_room()usingcrate::ram_budget::available().ahead_room()checks bothbig_compile_commit_free(AHEAD_FREE)andphys_ram_room(ahead_min_phys_bytes()).ahead_room()test skip messages to say"short of commit/RAM".warm_ahead_cap_stops_eager_translations_without_stopping_cold_buildsandahead_min_phys_bytes_parses_default_zero_and_override.Tested
32.0.16.2140), AMD Ryzen 7 7800X3D, 31.1 GB RAM, Windows 11 build 26300,rustc 1.100.0, DXC1.8.2502.11.cargo test -p xcl --lib ahead_min_phys_bytes_parses_default_zero_and_overrideonadeec387: 1 passed, 0 failed.cargo test -p xcl --lib hle::d3d12x::pso_async:: -- --test-threads=4: 194 passed, 0 failed.Regression run
Matched 60 s smoke runs with identical settings (
XCL_DIRECT_DXIL=1, defaultXCL_PSO_PRELOADenabled sosend_ahead/next_with_warm/ahead_room()run,smoke.ps1defaultXCL_PREPARE=0):main(f07e426d):this PR (
adeec387):Not tested
AI use
ram_budget::available(), addingXCL_PSO_AHEAD_MIN_PHYS_MB, writing unit tests, running matched smokes, and drafting this description. Reviewed by me.