Repository navigation
Conversation
|
Review (head 19fc7dd, diff read, not a merge-check):
Fine: AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
Thanks for the thorough review — addressed all four points in 1aa29c4:
AI use: Antigravity (Gemini 4 Neon) assisted with implementing the fixes, running the tests and matched smokes, and drafting this reply. |
|
Follow-up review (head 1aa29c4, since 19fc7dd, diff read, not a merge-check):
New:
Fine: L0 bytes stay out of the local cap ( AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
1aa29c4 to
344962b
Compare
|
Thanks for catching the shrink-before-spill bug — fixed and squashed into a single clean commit (
AI use: Antigravity (Gemini 4 Neon) assisted with fixing the shrink-before-spill path, updating the unit test, squashing, and drafting this reply. |
|
Follow-up review (head 344962b, since 1aa29c4, diff read, not a merge-check; checks red):
New:
Fine: the record path no longer shrinks before spilling; AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
When local-VRAM two-pass UAV buffers reach XCL_TWO_PASS_MB (or the dynamic DXGI headroom floor), spill full-size overflow record and argument-scratch buffers to D3D12_MEMORY_POOL_L0 (up to XCL_TWO_PASS_L0_MB, default 512 MiB; 0 disables) tracked separately in TWO_PASS_L0_ALIVE and FREE_L0_RES (trimmed on idle from put_free_bufs, release_allocator_res, and take_free). When L0 spillover is disabled, full, or unsupported by the adapter, fall back to the original local FENCE_WAIT_LIMIT wait + shrink/refusal path. Complementary to xcl-dev#3165 (draft).
344962b to
4179a5a
Compare
|
Follow-up review (head 4179a5a, since 344962b, diff read, not a merge-check; checks red):
New: none. Since AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point. |
|
@Foniass Let your bot take a breath bro. I haven't even had a chance to post the smoke results yet. |
|
Fixed the relative local/L0 caps in All substantive review points are now addressed and tested ( AI use: Antigravity (Gemini 4 Neon) applied the relative-cap test fix, ran the head smoke, and drafted this reply. |
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM, never share L0-backed pages (isolated via ExtraKey = (va, tile_index, local_only)), and keep_pools skips L0 heaps. Non-OOM adapter refusals of custom L0 heaps are cached per heap class so subsequent allocations go straight to DEFAULT. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), and xcl-dev#3039 (unconditional streamed texture sysmem).
|
merge-check claim |
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM, never share L0-backed pages (isolated via ExtraKey = (va, tile_index, local_only)), and keep_pools skips L0 heaps. Non-OOM adapter refusals of custom L0 heaps are cached per heap class so subsequent allocations go straight to DEFAULT. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), and xcl-dev#3039 (unconditional streamed texture sysmem).
|
merge-check |
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM and keep_pools skips L0 heaps. When a non-evictable target binds a console page currently backed by an L0 heap (DENY_RT_DS_TEXTURES), bind_range promotes the page in-place to a local VRAM tile, cools the old L0 tile, and remaps any live mapped aliases in Pages::targets onto the promoted local tile so aliased reads never observe stale data. Non-OOM adapter refusals of custom L0 heaps are cached per heap class. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), xcl-dev#3039 / xcl-dev#1702 (unconditional sysmem opt-ins), and xcl-dev#3587 (amd-dev).
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM and keep_pools skips L0 heaps. When a non-evictable target binds a console page currently backed by an L0 heap (DENY_RT_DS_TEXTURES), bind_range promotes the page in-place to a local VRAM tile, cools the old L0 tile, and remaps any live mapped aliases in Pages::targets onto the promoted local tile so aliased reads never observe stale data. Non-OOM adapter refusals of custom L0 heaps are cached per heap class. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), xcl-dev#3039 / xcl-dev#1702 (unconditional sysmem opt-ins), and xcl-dev#3587 (amd-dev).
|
merge-check claim |
|
merge-check |
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM and keep_pools skips L0 heaps. When a non-evictable target binds a console page currently backed by an L0 heap (DENY_RT_DS_TEXTURES), bind_range allocates a local VRAM tile, copies the 64 KiB tile bytes from L0 to local on Pages::queue (via lazily-created 0-VRAM reserved scratch textures), promotes the page in-place, cools the old L0 tile, remaps any live mapped aliases in Pages::targets, and marks any pending HeldUnmap referencing that page stale so cancelling it in remap_if_unmapped re-maps onto the promoted local tiles. Non-OOM adapter refusals of custom L0 heaps are cached per heap class. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), xcl-dev#3039 / xcl-dev#1702 (unconditional sysmem opt-ins), and xcl-dev#3587 (amd-dev).
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM and keep_pools skips L0 heaps. When a non-evictable target binds a console page currently backed by an L0 heap (DENY_RT_DS_TEXTURES), bind_range allocates a local VRAM tile, copies the 64 KiB tile bytes from L0 to local on Pages::queue (via lazily-created 0-VRAM reserved scratch textures), promotes the page in-place, cools the old L0 tile, remaps any live mapped aliases in Pages::targets, and marks any pending HeldUnmap referencing that page stale so cancelling it in remap_if_unmapped re-maps onto the promoted local tiles. Non-OOM adapter refusals of custom L0 heaps are cached per heap class. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), xcl-dev#3039 / xcl-dev#1702 (unconditional sysmem opt-ins), and xcl-dev#3587 (amd-dev).
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM and keep_pools skips L0 heaps. When a non-evictable target binds a console page currently backed by an L0 heap (DENY_RT_DS_TEXTURES), bind_range allocates a local VRAM tile, copies the 64 KiB tile bytes from L0 to local on Pages::queue (via lazily-created 0-VRAM reserved scratch textures), promotes the page in-place, cools the old L0 tile, remaps any live mapped aliases in Pages::targets, and marks any pending HeldUnmap referencing that page stale so cancelling it in remap_if_unmapped re-maps onto the promoted local tiles. Non-OOM adapter refusals of custom L0 heaps are cached per heap class. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), xcl-dev#3039 / xcl-dev#1702 (unconditional sysmem opt-ins), and xcl-dev#3587 (amd-dev).
…re pools to L0 Add opt-in XCL_L0_VRAM_MARGIN_MB (default 0 = disabled) to dynamically spill new sparse tile pools (sparse.rs) and sampled-only texture tile pools (vram.rs) to D3D12_MEMORY_POOL_L0 (system memory) once DXGI local VRAM usage is within the configured headroom margin of budget. Render targets, depth buffers, and UAV textures (!evictable) always stay in local DEFAULT VRAM and keep_pools skips L0 heaps. When a non-evictable target binds a console page currently backed by an L0 heap (DENY_RT_DS_TEXTURES), bind_range allocates a local VRAM tile, copies the 64 KiB tile bytes from L0 to local on Pages::queue (via lazily-created 0-VRAM reserved scratch textures), promotes the page in-place, cools the old L0 tile, remaps any live mapped aliases in Pages::targets, and marks any pending HeldUnmap referencing that page stale so cancelling it in remap_if_unmapped re-maps onto the promoted local tiles. Non-OOM adapter refusals of custom L0 heaps are cached per heap class. Distinct from xcl-dev#3614 (two-pass UAV buffers in bind.rs, untouched here), xcl-dev#3112 (stale draft on amd-dev), xcl-dev#2987 (static sparse cap), xcl-dev#3039 / xcl-dev#1702 (unconditional sysmem opt-ins), and xcl-dev#3587 (amd-dev).
bmjask
left a comment
There was a problem hiding this comment.
Review of 4179a5a5: 2 finding(s) (2 medium), most severe first.
- Medium
crates/xcl/src/hle/d3d12x/bind.rs:311: L0_UNSUPPORTED is one process-wide flag, set for life on any error other than E_OUTOFMEMORY (device removed 0x887A0005, E_INVALIDARG, a null resource), with no log line, while E_OUTOFMEMORY is retried on every miss with no backoff. (inline) - Medium
crates/xcl/src/hle/d3d12x/bind.rs:3114: Not certain about this one: nothing checks whether the adapter is UMA (D3D12_FEATURE_ARCHITECTURE). (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.
| TWO_PASS_L0_ALIVE.fetch_sub(min, Ordering::Relaxed); | ||
| // Remember non-OOM adapter refusals so subsequent misses go straight to local wait. | ||
| if !e.contains("0x8007000E") && !e.contains("0x8007000e") { | ||
| L0_UNSUPPORTED.store(true, Ordering::Relaxed); |
There was a problem hiding this comment.
Medium: L0_UNSUPPORTED is one process-wide flag, set for life on any error other than E_OUTOFMEMORY (device removed 0x887A0005, E_INVALIDARG, a null resource), with no log line, while E_OUTOFMEMORY is retried on every miss with no backoff. A device-removed or other transient error, or a refusal on one device (e.g. a WARP test device), turns spillover off silently and permanently for every device, including one recreated after a TDR. Meanwhile, with system memory exhausted, every two-pass draw that misses local calls CreateCommittedResource for a full-size L0 buffer, which fails each time before falling through to the local wait. Keeping the flag per device, logging it, and backing off on E_OUTOFMEMORY would avoid both.
| budget_cap: u64, | ||
| l0_cap: u64, | ||
| ) -> Result<Option<TwoPassBuf>, String> { | ||
| let try_l0 = l0_cap > 0 && !L0_UNSUPPORTED.load(Ordering::Relaxed); |
There was a problem hiding this comment.
Medium: Not certain about this one: nothing checks whether the adapter is UMA (D3D12_FEATURE_ARCHITECTURE). On UMA adapters MEMORY_POOL_L0 is the same physical memory as DEFAULT, so the spill just sidesteps the cap, and two_pass_cap's non_tp (~368) subtracts only TP_ALIVE, so L0 bytes count as non-two-pass usage and shrink the dynamic cap. On an iGPU/APU (or vkd3d-proton UMA), once the local cap is hit, up to another 512 MiB of two-pass buffers lands in the same memory. DXGI used grows, budget_two_pass_cap returns a smaller cap, and that causes more misses, more L0 spill and more refusals, a feedback loop past what XCL_TWO_PASS_MB was meant to bound. Disabling the spill on UMA adapters (and subtracting L0 bytes in non_tp) would avoid it.
|
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any. |
When local-VRAM two-pass UAV buffers reach
XCL_TWO_PASS_MB(or the dynamic DXGI headroom floor), two-pass draws spin-wait up toFENCE_WAIT_LIMITand then shrink or skip draws once the local cap is saturated. On 12 GiB non-UMA cards during heavy mesh-shader world loads, this caused heavy draw skipping and multi-millisecond fence-wait stalls.This PR adds a bounded
D3D12_MEMORY_POOL_L0(system-memory) spillover pool for full-size overflow two-pass record and argument-scratch UAV buffers, tracked separately from the local VRAM cap (TWO_PASS_L0_ALIVEandFREE_L0_RES), while preserving the original localFENCE_WAIT_LIMITwait and shrink/refusal fallback whenever L0 spillover is disabled, full, or unsupported by the adapter.Complementary to #3165 (draft).
What is in it
crates/xcl/src/hle/d3d12x/bind.rs:XCL_TWO_PASS_L0_MB(default512MiB;0disables spillover) andTWO_PASS_L0_ALIVE/FREE_L0_REStracking (TwoPassBuf::is_l0).uav_buffer_in_poolcreatesD3D12_HEAP_TYPE_CUSTOM+D3D12_MEMORY_POOL_L0+D3D12_CPU_PAGE_PROPERTY_NOT_AVAILABLEbuffers for L0 spillover and caches non-OOM adapter refusals (L0_UNSUPPORTED).acquire_res_buf_or_l0andscratch_args: try full-size local (0 ms, no shrink), spill full-size to L0 on local-cap miss, and fall back to the original localFENCE_WAIT_LIMITwait + shrink/refusal path if L0 is full or unsupported.trim_idle_l0_free: trims idleFREE_L0_RESentries older thanFREE_RES_IDLEfromrelease_allocator_resandtake_freeas well asput_free_bufs.two_pass_l0_spillover_tracks_and_reuses_separately_from_localandtwo_pass_l0_fallback_spills_on_local_cap_and_refuses_when_l0_full(caps computed relative toTWO_PASS[TP_ALIVE]/TWO_PASS_L0_ALIVE).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 hle::d3d12x::bind::tests::two_pass_l0 -- --nocapture --test-threads=1on4179a5a5: 2 passed, 0 failed, 0 skipped.cargo test -p xcl --lib hle::d3d12x::bind::tests -- --test-threads=4: 117 passed, 0 failed.Regression run
Matched 60 s smoke runs with identical settings (
XCL_DIRECT_DXIL=1, defaultXCL_PSO_PRELOAD,smoke.ps1defaultXCL_PREPARE=0):main(f07e426d):this PR (
4179a5a5):Not tested
vkd3d-proton), and full workspace test suite locally (covered by CI).AI use