Repository navigation
Conversation
|
merge-check AI-written and posted by Foniass without a human check of each point. |
|
One correction to the evidence above: the four runs behind "+50 %" used AI use: Claude Code (Claude Opus 5.5). |
|
Same-build check for the default flip: AI use: Claude Code (Claude Opus 5.5). |
bmjask
left a comment
There was a problem hiding this comment.
Review of 5b8ac52b: 3 finding(s) (1 high, 2 medium), most severe first.
- High
crates/xcl/src/hle/d3d12x/vram.rs:1016: Turning XCL_RESIDENCY_PRIORITY on by default puts XCL's arenas, window pools and target pools at HIGH, while the UMA GPU_UPLOAD segment (uma_driver.rs:336, XCL_UMA_UPLOAD_PRIORITY) still needs=1and stays at NORMAL by default, which.... (inline) - Medium
crates/xcl/src/hle/d3d12x/vram.rs:2192: see below. - Medium
crates/xcl/src/hle/d3d12x/vram.rs:1017: The parse has flipped for values other than0/1: an empty value,falseoroffnow turn the feature on, where before only1did. (inline)
On lines outside the diff:
- Medium
crates/xcl/src/hle/d3d12x/vram.rs:2192: A pool heap that gets HIGH inkeep_poolsstays HIGH (and inpools.high) until it's reclaimed, even after its target pages are released and their tiles reused by sampled textures. With the switch now on by default, HIGH spreads to more and more pools over a session. A long session that creates and frees many transient render targets returns their pages to the pool (cooling/idle), sampled textures take them, and the heaps stay HIGH. Eventually most 64 MiB pools are HIGH, so over budget the idle texture pages are no longer demoted first and the #3156 gain shrinks. Dropping a heap back to NORMAL when its last target page is released would keep the ordering meaningful.
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.
| /// `XCL_RESIDENCY_PRIORITY=1` (read once, off by default): XCL's own heaps get the residency | ||
| /// `XCL_RESIDENCY_PRIORITY` (read once, on unless it is `0`): XCL's own heaps get the residency | ||
| /// priority of their role (`role_priority`) when they are made; nothing is called per frame. | ||
| fn residency_priority_enabled(v: Option<&str>) -> bool { |
There was a problem hiding this comment.
High: Turning XCL_RESIDENCY_PRIORITY on by default puts XCL's arenas, window pools and target pools at HIGH, while the UMA GPU_UPLOAD segment (uma_driver.rs:336, XCL_UMA_UPLOAD_PRIORITY) still needs =1 and stays at NORMAL by default, which inverts the order the design assumes. On a default run over the video memory budget, the GPU_UPLOAD segment every console program reads its buffers from becomes the lowest-priority XCL heap, so Windows demotes it to system memory before the HIGH render-target and window pools, and every shader read of title buffers goes over PCIe. The test comment at ~4170 ("nothing gets MAXIMUM (the UMA upload segment's...)") assumes that segment ranks above these heaps. Defaulting XCL_UMA_UPLOAD_PRIORITY on in the same change would keep the order.
| /// `XCL_RESIDENCY_PRIORITY` (read once, on unless it is `0`): XCL's own heaps get the residency | ||
| /// priority of their role (`role_priority`) when they are made; nothing is called per frame. | ||
| fn residency_priority_enabled(v: Option<&str>) -> bool { | ||
| v.map_or(true, |v| v.trim() != "0") |
There was a problem hiding this comment.
Medium: The parse has flipped for values other than 0/1: an empty value, false or off now turn the feature on, where before only 1 did. A user or script that set XCL_RESIDENCY_PRIORITY= or =false to keep it off (which worked before this PR) now silently gets HIGH priorities. residency_priority_is_on_by_default only tests None, "1", "0" and " 0 ". Treating empty/false/off as off, or logging when an unrecognised value is read, would avoid the surprise.
|
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any. |
5b8ac52 to
6f5eb63
Compare
|
Thanks. Rebased onto current 1. High: GPU_UPLOAD segment below the HIGH heaps. Fixed. The GPU_UPLOAD segments only exist with 2. Medium: pools stay HIGH after their target pages are freed. Not changed in this PR. This is how #3156 worked when it merged (a pool loses HIGH only in 3. Medium: the parse flipped for values other than 0 and 1. Fixed. The parse is now explicit ( Tests: One side effect to know: Head is now AI use: Claude Code (Claude Opus 5.5). |
bmjask
left a comment
There was a problem hiding this comment.
Review of 6f5eb630: 2 finding(s) (2 medium), most severe first.
- Medium
crates/xcl/src/hle/d3d12x/uma_driver.rs:337: XCL_UMA_UPLOAD_PRIORITY follows XCL_RESIDENCY_PRIORITY when it's unset, so flipping the latter on by default also gives every mixed window's GPU_UPLOAD segment D3D12_RESIDENCY_PRIORITY_MAXIMUM by default. (inline) - Medium
crates/xcl/src/hle/d3d12x/uma_driver.rs:341: The new parsing changes the meaning of existing settings without saying so. (inline)
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.
| fn upload_priority_wanted() -> bool { | ||
| static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new(); | ||
| *ON.get_or_init(|| std::env::var("XCL_UMA_UPLOAD_PRIORITY").is_ok_and(|v| v.trim() == "1")) | ||
| *ON.get_or_init(|| upload_priority_enabled(std::env::var("XCL_UMA_UPLOAD_PRIORITY").ok().as_deref(), super::vram::residency_priority_wanted)) |
There was a problem hiding this comment.
Medium: XCL_UMA_UPLOAD_PRIORITY follows XCL_RESIDENCY_PRIORITY when it's unset, so flipping the latter on by default also gives every mixed window's GPU_UPLOAD segment D3D12_RESIDENCY_PRIORITY_MAXIMUM by default. That change isn't in the PR description, and the #3156 evidence covers only XCL_RESIDENCY_PRIORITY. With XCL_UMA_DRIVER=mixed:1536:1792 and the upload switch unset, the segment was NORMAL before and is now pinned above the HIGH render-target arenas and tile pools, so when over budget Windows demotes the render targets first. Keeping the upload switch's own default (off unless set to 1) would limit the PR to what was measured.
| } | ||
|
|
||
| /// `upload_priority_wanted` from the switch's value and whether XCL's heaps get their priorities. | ||
| fn upload_priority_enabled(v: Option<&str>, residency_on: impl FnOnce() -> bool) -> bool { |
There was a problem hiding this comment.
Medium: The new parsing changes the meaning of existing settings without saying so. An unknown XCL_UMA_UPLOAD_PRIORITY value (e.g. 2, or a typo like disable) was off before, since only 1 meant on, but now silently falls back to the residency switch, which is on, with no warning (the test upload_priority_enabled(Some("2"), || true) locks this in). And for XCL_RESIDENCY_PRIORITY an empty value counts as off (vram.rs:1347), although the description says 'on unless the value is 0' and other switches (gpu_awake.rs parse_mode) treat empty as unset. A launcher passing XCL_RESIDENCY_PRIORITY= to mean default turns the feature off with nothing logged. Treating empty as unset, and warning and keeping the old meaning on unknown values, would avoid both.
6f5eb63 to
8ea8619
Compare
|
Thanks. Both points are addressed in
Tested on an RTX 4080 (debug build) with
The whole suite was not rerun for this push. Pushed as AI use: Claude Code (Claude Opus 5.5). |
bmjask
left a comment
There was a problem hiding this comment.
Review of 8ea8619c: 1 finding(s) (1 medium), most severe first.
Re-review at 8ea8619c. XCL_UMA_UPLOAD_PRIORITY no longer follows XCL_RESIDENCY_PRIORITY, which addresses the unannounced MAXIMUM default from the 6f5eb630 review, but decoupling them causes the issue below.
- Medium
crates/xcl/src/hle/d3d12x/uma_driver.rs:336: see below.
On lines outside the diff:
- Medium
crates/xcl/src/hle/d3d12x/uma_driver.rs:336: With XCL_RESIDENCY_PRIORITY on by default and XCL_UMA_UPLOAD_PRIORITY still off by default, the XCL_UMA_DRIVER=mixed GPU_UPLOAD segments, which every console program reads its buffers from, now rank below the new HIGH heaps. With XCL_UMA_DRIVER=mixed, neither variable set, and the process over its video memory budget, all heaps used to be NORMAL. Now the arenas, window pools and target pools are HIGH while the GPU_UPLOAD segments stay NORMAL, so Windows demotes the console's UMA buffers first and every GPU read of title buffers goes over PCIe. That's the opposite of what therole_prioritytest comment says ('the UMA upload segment's, which every console program reads from'), and the README says it wasn't measured. Raising the upload segments at least to HIGH whenever residency priority is on, unless explicitly turned off, would keep them from being demoted first.
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.
8ea8619 to
e94f2df
Compare
bmjask
left a comment
There was a problem hiding this comment.
Review of e94f2dfe: 2 finding(s) (2 medium), most severe first.
Re-review at e94f2dfe. The GPU_UPLOAD segments now default to HIGH, which addresses the demotion order from the 8ea8619c review. Two new items below.
- Medium
crates/xcl/src/hle/d3d12x/uma_driver.rs:362: Not certain about this one, because it depends on whether the driver allocates VA inside SetResidencyPriority: SetResidencyPriority now runs by default for every GPU_UPLOAD segment inside the critical window between VirtualFree of the pl.... (inline) - Medium
crates/xcl/src/hle/d3d12x/uma_driver.rs:339: Any set value of XCL_UMA_UPLOAD_PRIORITY other than "1" (0,on,true,yes, empty) puts the GPU_UPLOAD segments at NORMAL, below XCL's now default-on HIGH heaps. (inline)
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.
| device.CreateHeap(&desc, &mut heap).map_err(|e| format!("CreateHeap{}: {e}", if watch { " (write-watched)" } else { "" }))?; | ||
| let heap = heap.ok_or("CreateHeap")?; | ||
| if upload && upload_priority_wanted() { | ||
| if let Some(prio) = upload.then(upload_priority_wanted).flatten() { |
There was a problem hiding this comment.
Medium: Not certain about this one, because it depends on whether the driver allocates VA inside SetResidencyPriority: SetResidencyPriority now runs by default for every GPU_UPLOAD segment inside the critical window between VirtualFree of the placeholder and CreatePlacedResource/Map, and it also runs on segments that are then thrown away because Map lands at the wrong address. On every default mixed-window remake, after the placeholder at want is released, a driver call (the ID3D12Device1 cast plus SetResidencyPriority) runs before Map. If any driver-internal VA allocation in it takes the freed range, Map returns another address, so the segment is refused and becomes CUSTOM, or the remake fails and stops the process (the test module notes that anything landing in the window meanwhile stops the process). Before this PR it ran only with an opt-in variable. Setting the priority after the p == want check would avoid both the race and the wasted call.
| fn upload_priority(upload_env: Option<&str>, residency_on: bool) -> Option<D3D12_RESIDENCY_PRIORITY> { | ||
| match upload_env { | ||
| Some(v) if v.trim() == "1" => Some(D3D12_RESIDENCY_PRIORITY_MAXIMUM), | ||
| Some(_) => None, |
There was a problem hiding this comment.
Medium: Any set value of XCL_UMA_UPLOAD_PRIORITY other than "1" (0, on, true, yes, empty) puts the GPU_UPLOAD segments at NORMAL, below XCL's now default-on HIGH heaps. That brings back the ordering this change removes and contradicts the README's 'any other value of it keeps them at the default' (the default is HIGH). With XCL_UMA_DRIVER=mixed and XCL_UMA_UPLOAD_PRIORITY=on/true (expecting more priority) or =0 (expecting the default without MAXIMUM), upload_priority returns None, so the segments every console program reads stay NORMAL while the arenas, window pools and target pools are HIGH, and over budget Windows demotes the title's buffers first. Nothing is logged, and the test asserting upload_priority(Some("on"), true) == None locks this in. Parsing it with switch_value like XCL_RESIDENCY_PRIORITY, and keeping HIGH for anything but an explicit off, would match the README.
Over its video memory budget a process has heaps demoted to system memory, and Windows has no hint which matter. XCL_RESIDENCY_PRIORITY (xcl-dev#3156) gives render-target arenas, window tile pools and texture page pools holding targets HIGH, so idle texture pages are demoted first. It was off unless XCL_RESIDENCY_PRIORITY=1. Measured on an RTX 4080 16 GB (Windows) in four world runs on xcl-dev#3156: 3.37 / 3.49 presents/s with it against 2.22 / 2.39 without (+50 %). lucsoft's A/B on an AMD RX 7800 XT under Linux/RADV shows no change. Windows + AMD is not measured yet. It is now on unless XCL_RESIDENCY_PRIORITY is 0, off, false, no or empty (empty was off before too); any other unknown value keeps it on and is logged. The parse (switch_value, residency_priority_enabled) has a unit test. The GPU_UPLOAD segments of XCL_UMA_DRIVER=mixed:..., the title's buffers every console program reads, get HIGH along with the heaps while XCL_RESIDENCY_PRIORITY is on, so they are not demoted before them (bmjask's review). XCL_UMA_UPLOAD_PRIORITY is read as the same kind of switch: on (1, on, true, yes) gives them MAXIMUM as before, off (0, off, false, no, empty) leaves them at NORMAL as on main, and another value keeps the default and is logged (upload_priority, tested). Their priority is now set once all segments are mapped in their places, not between the release of a segment's placeholder and its Map, and not for a segment that is given up. Part of xcl-dev#505 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
merge-check In short: Turns XCL_RESIDENCY_PRIORITY on by default with an explicit parse (0/off/false/no/empty off, unknown values kept on and logged). At this head the GPU_UPLOAD segments of an XCL_UMA_DRIVER=mixed window also get HIGH by default while it is on (MAXIMUM with XCL_UMA_UPLOAD_PRIORITY=1). The code is correct for what it does. What held it at Foniass's last check is still open: no on/off run on an 8-12 GB card and no Windows + AMD run for a default-on change. Medium
Nit
Checked and fine
How this was tested
Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point. |
e94f2df to
30ec035
Compare
|
Thanks for the re-review. Both points are addressed in the PR's commit (amended locally to 1. Medium: 2. Medium: any set
The README entry and the commit message say this. Tests (Windows, debug, RTX 4080):
The whole suite was not rerun for this amend. The runtime code changed, so a merge check of Each round has found new points so far. Would the remaining ones block the merge, or can they be follow-ups once this round is in? Pushed as AI use: Claude Code (Claude Opus 5.5). |
|
@Foniass thanks. The red AI use: Claude Code (Claude Opus 5.5). |
XCL_RESIDENCY_PRIORITY(#3156) gives XCL's own heaps (render-target arenas, window tile pools, texture page pools holding targets)D3D12_RESIDENCY_PRIORITY_HIGH, so that over the video memory budget Windows demotes idle texture pages first. It was off unlessXCL_RESIDENCY_PRIORITY=1. This turns it on by default;XCL_RESIDENCY_PRIORITY=0turns it off. Part of #505.Evidence: on an RTX 4080 16 GB (Windows), four world runs on #3156 gave 3.37 / 3.49 presents/s with it against 2.22 / 2.39 without (+50 %). lucsoft's A/B on an AMD RX 7800 XT under Linux/RADV (comment on #3156) shows no change. Missing: a Windows + AMD run. If you have one, please run the title in the world with and without
XCL_RESIDENCY_PRIORITY=0and post the presents/s here or on #3156.What is in it
crates/xcl/src/hle/d3d12x/vram.rs: an explicit parseswitch_value: unset is on; empty,0,off,falseandno(any case) are off;1,on,trueandyesare on; any other value stays on and is logged. Tests cover each class.XCL_UMA_UPLOAD_PRIORITYkeeps main's own parse and default (withXCL_UMA_DRIVER=mixed, the GPU_UPLOAD segment ranks below the HIGH heaps unless it is set to1; the README says so).README.md: one bullet for the heap priority and the switch.Tested
cargo build --workspace && cargo test --workspace -- --test-threads=4on head30ec035c(after bmjask's third review): 3006 passed, 0 failed, 52 ignored, 25SKIPPEDlines.SKIPPEDon this adapter: the wave64 variants of thegpu::recomp::lower/lower_dxiltests anddispatch_chain_native_wave64_builds_whole(no wave64);heap_window_out_of_memory_falls_back_to_the_switch_formandhle::d3d12x::bind::tests::two_pass_binds_set_the_shared_view_heap(no heap windows);shaders::tests::pso_measurement_compiles_an_exact_synthetic_record(driver cache cannot be disabled).Regression run
main
817eb1fc9:this PR's head:
Not tested
AI use
🤖 Generated with Claude Code