Repository navigation
D3D12.X: execute two-pass mesh shaders on DispatchMesh and ExecuteIndirect (supersedes #724) - #2092
PracticalStudios wants to merge 9 commits into
Conversation
|
Verified a small pool-reuse bug on The attached fix uses the remaining budget for both checks. The same sequence then takes 2 MiB. The test also confirms the cached 16 MiB resource remains reusable by identity for an empty recording, and that recording rejects an additional 256-byte request at its cap. Tested: native Windows 10 Home 19045, RTX 3090 driver 591.74, Ryzen 7 7800X3D, Rust/Cargo 1.98.1 MSVC, debug. Actual D3D12 resource allocations through Not tested: no GPU commands submitted, shader output, visible geometry, retail smoke, AMD, or full suite. These are allocated scratch capacities, not measured peak VRAM/process commit or performance. Run this reproducer alone in a fresh process ( cargo test --locked -p xcl --lib -- hle::d3d12x::bind::tests::gpu_two_pass_pooled_scratch_respects_remaining_budget --exact --test-threads=1 --nocaptureSmall runtime fix--- a/crates/xcl/src/hle/d3d12x/bind.rs
+++ b/crates/xcl/src/hle/d3d12x/bind.rs
@@ -555,13 +555,14 @@
return Ok(r);
}
let size = bytes.max(SCRATCH_BLOCK);
- if with(this, |s| s.scratch_taken) + size > SCRATCH_CAP {
+ let remaining = SCRATCH_CAP.saturating_sub(with(this, |s| s.scratch_taken));
+ if size > remaining {
return Err(format!("its rewritten arguments are past {} MiB this recording", SCRATCH_CAP >> 20));
}
let dev_key = dev.as_raw() as usize;
let picked = {
let mut free = FREE_RES.lock().unwrap();
- free.iter().position(|(_, cap, d)| *d == dev_key && *cap >= size && *cap <= SCRATCH_CAP).map(|i| free.swap_remove(i))
+ free.iter().position(|(_, cap, d)| *d == dev_key && *cap >= size && *cap <= remaining).map(|i| free.swap_remove(i))
};
let block = match picked {
Some(e) => e,Isolated native reproducer (applies to the original head)diff --git a/crates/xcl/src/hle/d3d12x/bind.rs b/crates/xcl/src/hle/d3d12x/bind.rs
index 8c4c819..ca21d74 100644
--- a/crates/xcl/src/hle/d3d12x/bind.rs
+++ b/crates/xcl/src/hle/d3d12x/bind.rs
@@ -2338,4 +2338,58 @@ void ms(uint3 g : SV_GroupID) { o.Store((v * 16u + g.x) * 4u, rec.Load(g.x * 4u)
forget(this);
}
}
+
+ /// A reusable block must fit the recording's remaining budget, not just its request.
+ #[test]
+ fn gpu_two_pass_pooled_scratch_respects_remaining_budget() {
+ use windows::Win32::Graphics::{Direct3D::D3D_FEATURE_LEVEL_12_0, Dxgi::*};
+ unsafe {
+ let factory: IDXGIFactory4 = CreateDXGIFactory1().unwrap();
+ let wanted = std::env::var("XCL_ADAPTER").unwrap_or_default();
+ let mut chosen = None;
+ for i in 0.. {
+ let Ok(adapter) = factory.EnumAdapters1(i) else { break };
+ let desc = adapter.GetDesc1().unwrap();
+ let end = desc.Description.iter().position(|&c| c == 0).unwrap_or(desc.Description.len());
+ let name = String::from_utf16_lossy(&desc.Description[..end]);
+ if !wanted.is_empty() && !name.contains(&wanted) { continue; }
+ let mut dev: Option<ID3D12Device> = None;
+ if D3D12CreateDevice(&adapter, D3D_FEATURE_LEVEL_12_0, &mut dev).is_ok() {
+ chosen = Some((name, dev.unwrap()));
+ break;
+ }
+ }
+ let Some((name, dev)) = chosen else {
+ crate::gpu::recomp::runner::skip_test("no selected D3D12 adapter");
+ return;
+ };
+ println!("POOLED_SCRATCH_ADAPTER={name}");
+ let key = dev.as_raw() as usize;
+ // These are state keys only; scratch_args does not call through a list pointer.
+ let (consumer, producer, empty) = (0x7500_1011usize as *mut c_void, 0x7500_1012usize as *mut c_void, 0x7500_1013usize as *mut c_void);
+ let allocator = 0x7500_1014usize;
+ let first = scratch_args(consumer, &dev, SCRATCH_BLOCK).unwrap();
+ assert_eq!(with(consumer, |s| s.scratch_taken), SCRATCH_BLOCK);
+ reset(producer, allocator, 0);
+ let large = scratch_args(producer, &dev, SCRATCH_CAP).unwrap();
+ assert_eq!(large.0.GetDesc().Width, SCRATCH_CAP);
+ reset(producer, 0, 0);
+ release_allocator_res(allocator);
+ let second = scratch_args(consumer, &dev, SCRATCH_BLOCK).unwrap();
+ let taken = with(consumer, |s| s.scratch_taken);
+ println!("POOLED_SCRATCH taken={taken} second_bytes={} cap={SCRATCH_CAP}", second.0.GetDesc().Width);
+ // If it was too large for consumer, the cached block remains reusable by an empty recording.
+ let reused = if taken <= SCRATCH_CAP {
+ let r = scratch_args(empty, &dev, SCRATCH_CAP).unwrap();
+ assert_eq!(r.0.as_raw(), large.0.as_raw());
+ assert_eq!(with(empty, |s| s.scratch_taken), SCRATCH_CAP);
+ assert!(scratch_args(empty, &dev, 256).is_err());
+ Some(r)
+ } else { None };
+ drop((first, second, large, reused));
+ for list in [consumer, producer, empty] { forget(list); }
+ FREE_RES.lock().unwrap().retain(|(_, _, d)| *d != key);
+ assert!(taken <= SCRATCH_CAP, "pooled block exceeds recording budget: {taken} > {SCRATCH_CAP}");
+ }
+ }
}AI assistance: Codex (GPT-6), investigation, fix/reproducer preparation, native Windows test execution and report. No competing PR. |
Found and fixed by @WebIdentity1 in xcl-dev#2092.
|
@WebIdentity1 thanks — confirmed here too (RTX 3090: 17 825 792 B taken without the fix, 2 097 152 B with it). Your fix and test are in AI use: Claude Code (Claude Opus 5.5) wrote this reply. |
|
Update (in-title result): with #1803 and the heap addresses passed to the two-pass compute pass, A correction that concerns the (1, 1) records listed here as not fixed: Short version, from decoding the root-layout table of every stage in the retail title's shader pack (offline, no run behind it yet):
So nothing to change in the base register; what this path needs is what #1803 does for compute and graphics. AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the decoder) did this and drafted the comment. |
|
Test report from a desktop RTX 5070 (Blackwell, 11 943 MiB, driver 32.0.16.2114), Ryzen 5 5600X / 31.9 GB, Windows 11 26300.9974, rustc 1.100.0, release build of head Suite: clean
Title run: the new path is not exercised by my route
Not a clean A/B against
AI use
|
|
A regression run under Wine on Linux on the retail title: no device removal, no crash, frames level with Tested
Regression run main (first run): this PR: The second Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
# Conflicts: # crates/xcl/src/hle/d3d12x/bind.rs # crates/xcl/src/hle/d3d12x/console_list.rs # crates/xcl/src/hle/d3d12x/device_x.rs # crates/xcl/src/hle/d3d12x/real.rs
|
In-title result for the two-pass path, on the tree of my #724 comments (this PR's Details, setup and limits are in #697 (comment). What matters for this PR:
One run plus one partial run, RTX 3090; the copies that made the GPU view readable are a local experiment. AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the ports and the runs) did this and drafted the comment. |
|
Synthetic mesh readback on RTX 5070 Ti Laptop. I tested
These fixtures cover synthetic inputs. Retail GPU-view aliases, visible world geometry and heap-window mode were outside this run. Testing and the test-only extension assisted by OpenAI Codex (GPT-6). Heap-window follow-up. On the same build base and machine with |
|
RTX 5080 16 GB, A third NVIDIA card, on the current heads and on a newer base than the runs above. Setup. RTX 5080 16 GB (driver 610.47, 32-lane waves), i7-7700K, 16 GB RAM, Windows 10 22H2, release. The retail title of #505 (my own copy), Tree (local): #2057 at Conflicts, for whoever merges the same
Measured
Not tested
AI use: Claude Code with Claude Fable 5.2 merged the tree, ran the title and wrote this. |
|
Offer: one commit for the compute pass's heap addresses once #1803 is in (or if you want to take #1803's With #2092 ( The commit below is on top of a local merge of your head with #1803's head. Both sides of each conflict were kept: Feel free to squash it into your branch once #1803 lands, or tell me and I will open it as a stacked PR instead. Tested on an RTX 3090 24 GB (driver 616.56), Ryzen 9 5950X, Windows 11 22631, debug build. On the merged tree, AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 writing the code and tests). Patch (
|
|
Title runs on AMD RDNA4 with the geometry stack: the mesh draws run and nothing is refused in the AS slot; one of three runs ended in a GPU hang whose cause is not known yet. Tree:
The slot: in the newer list layout AI use: Claude Code (Claude Opus 5.5) ran this and wrote the comment on the maintainer's behalf. |
Every other method of the newer command list sits two slots after the older one, so #129 is the older #127, not #126. A retail title's own calls through its list agree with the slots before it: #126 takes a value and a pointer (RSSetShadingRate), #127 one resource (RSSetShadingRateImage), #128 one pointer. Nothing handles either slot yet; #2092's DispatchMesh is at #127.
|
Counted in the retail title's world on a 16 GB card: the two-pass record and scratch buffers hold up to 4.8 GB of video memory at once, and 1 318 of them (22.8 GB) are made in about two minutes of world. That is about as much as this card is over its budget in that run (19.8 GB of local video memory against 15.2 GB). It may bear on the hang in @ivall's run 3 above ("may have filled video memory"). Setup
One run of 300 s (world set up at 116 s; no device loss in this one):
How I read it (from the code, not measured further): a list that draws a two-pass pipeline through Not measured: whether a smaller buffer for the indirect path, a larger free pool or buffers shared by the lists of a queue would be the right change - yours to decide; I can run a patch on this card if that helps. AMD; other titles. AI use: Claude Code with Claude Fable 5.2 wrote the counter, ran the run on the machine named and wrote this. |
Each command's records start at record 0, so its mesh pass draws them before the next command's compute pass; commands past a count buffer's count get no groups.
With XCL_HEAP_WINDOWS=1 the pair reads the memory windows from the shared heap, as bind_abi's programs do; a list that set none got no heap.
Found and fixed by @WebIdentity1 in xcl-dev#2092.
47c7cc1 to
e856fa7
Compare
…ecuteIndirect) Supersedes xcl-dev#724; its commits are kept with their authors. Conflicts: - bind.rs State keeps the tree's heap_bound and xcl-dev#1803's heaps next to the record buffers and scratch; reset clears the heaps and holds the record buffers for the old allocator; forget takes the state out of the sharded map (bind::STATES) and holds its buffers. HashMap is imported again for the PR's maps. - console_list.rs Layout keeps xcl-dev#1803's heaps and the PR's inline_ms; with_heaps and user_data_ms both stay. - device_x.rs keeps xcl-dev#1887's log of a refused signature and the PR's companion Dispatch signature; the CreateCommandSignature doc is back above its function (the merge had put it above indirect_arg_bytes). - real.rs console slots keep the tree's #131 / xcl-dev#132 FlushCacheRange and the PR's DispatchMesh at xcl-dev#127. - list_x.rs: the PR's bound_heaps test helper removes the list from its own part of the sharded recording map. DispatchMesh slot: xcl-dev#1984 mapped the newer layout's xcl-dev#129 to the older xcl-dev#126, this PR to xcl-dev#127, where it hooks DispatchMesh. Kept xcl-dev#127: it is the shift of two slots the other methods have, and xcl-dev#1984's own reading of the newer layout (xcl-dev#126 / xcl-dev#127 the shading-rate methods, the older xcl-dev#124 / xcl-dev#125) puts its xcl-dev#128 at the older xcl-dev#126. xcl-dev#1984's test is rewritten for (129, 127) and checks that the older slot runs bind::dispatch_mesh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The two-pass bind (xcl-dev#2092) came from a base before the committed window could be a copy in video memory (Uma::shadowed): it took window 0 and the others from uma_window_vas, under its lock at every stage, and bound a null root descriptor when shadowed memory had no buffer in window 0, which bind_abi refuses. Both now take it from first_window (the lock-free uma_window_va and the same refusal), and the two-pass stages bind the other windows from uma_window_va like bind_abi. Test: binds_refuse_shadowed_memory_without_window_0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ocator inherit_for_split (a deferred mid-list split: the next list records into another allocator) gives that list a fresh arena and holds its previous recording's unified memory for the previous allocator, as reset does. The two-pass record buffer and argument scratch that xcl-dev#2092 added to the list state were only handled in reset and forget, so a split list kept its previous recording's record buffer, which the GPU may still read while the new recording's compute pass writes it, and its scratch budget. They now go to the old allocator (hold_res_until_reset) and the scratch counts start again, as in reset. Test: a_split_holds_the_previous_record_buffers_for_their_allocator (buffers of a software device, no GPU work); fails without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nion xcl-dev#2092 notes a DispatchMesh command signature with its companion Dispatch signature by address and never forgets it. A signature the title makes later at a freed one's address (a plain Dispatch or draw signature, or a root-changing one) kept the old entry, and an ExecuteIndirect with it and a two-pass pipeline bound went down the two-pass path with the old companion, stride and offset. Every creation now forgets the address first, as note_signature_dispatches already does for the Dispatch kind; a mesh dispatch signature is noted again after it. Test: a_signature_at_a_freed_mesh_signatures_address_has_no_companion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…v#1803, xcl-dev#1984, xcl-dev#541, xcl-dev#2092 and the heaps' addresses in the two-pass stages)
|
Under Wine the shared argument-scaling pipeline faults on release ( Setup: Linux, Proton Experimental's Wine + vkd3d-proton 3.1, RTX 4070 Ti 12 GB (NVIDIA 620.73.04), i7-14700K. Retail title, Series S profile. Tree: #2057's head with this PR and others merged locally, not this PR's exact head. Where: The change ( thread_local! {
static CACHE: std::cell::RefCell<HashMap<usize, (ID3D12RootSignature, ID3D12PipelineState)>> = std::cell::RefCell::new(HashMap::new());
}
// lookup: CACHE.with(|c| c.borrow().get(&key).cloned()); insert: CACHE.with(|c| c.borrow_mut().insert(key, (rs.clone(), pso.clone())))Not tested: Windows (no AI use: found, fixed and written with Claude Code (Claude Opus 5.5) from runs it made on this machine. |
|
The record buffers that made local video memory grow in the world here were the ones held for PC allocators Setup
Measured (one run each; least squares from the world-load burst +10 s to +70 s, read from the
From the code (not run)
Test for whichever of #1422 and this PR lands second ( diffdiff --git a/crates/xcl/src/hle/d3d12x/alloc_pool.rs b/crates/xcl/src/hle/d3d12x/alloc_pool.rs
index 6f10b7d2..b77eccea 100644
--- a/crates/xcl/src/hle/d3d12x/alloc_pool.rs
+++ b/crates/xcl/src/hle/d3d12x/alloc_pool.rs
@@ -480,4 +480,77 @@ mod tests {
}
+ /// A two-pass record buffer of an ended recording is held for the PC allocator the recording
+ /// was on. When that allocator was put aside, the buffer stays while the GPU has not passed
+ /// its submits and goes at the title's first Reset after it has, without waiting for the
+ /// allocator to be used again.
+ #[test]
+ fn a_put_aside_allocators_record_buffers_go_once_the_gpu_has_passed_it() {
+ use std::cell::Cell;
+ use std::mem::{offset_of, size_of};
+
+ #[repr(C)]
+ struct Fake {
+ vtable: *const usize,
+ value: Cell<u64>,
+ releases: Cell<u32>,
+ }
+ unsafe extern "system" fn completed(this: *mut c_void) -> u64 {
+ (*this.cast::<Fake>()).value.get()
+ }
+ unsafe extern "system" fn release(this: *mut c_void) -> u32 {
+ let f = &*this.cast::<Fake>();
+ f.releases.set(f.releases.get() + 1);
+ 0
+ }
+ extern "system" fn unexpected_call() { std::process::abort(); }
+
+ const SLOT: usize = size_of::<usize>();
+ let mut fence_vtable = [unexpected_call as usize; size_of::<ID3D12Fence_Vtbl>() / SLOT];
+ fence_vtable[offset_of!(ID3D12Fence_Vtbl, GetCompletedValue) / SLOT] = completed as usize;
+ fence_vtable[offset_of!(ID3D12Fence_Vtbl, base__.base__.base__.base__.Release) / SLOT] = release as usize;
+ let mut res_vtable = [unexpected_call as usize; size_of::<ID3D12Resource_Vtbl>() / SLOT];
+ res_vtable[offset_of!(ID3D12Resource_Vtbl, base__.base__.base__.base__.Release) / SLOT] = release as usize;
+ let mut fence = Fake { vtable: fence_vtable.as_ptr(), value: Cell::new(0), releases: Cell::new(0) };
+ let mut buffer = Fake { vtable: res_vtable.as_ptr(), value: Cell::new(0), releases: Cell::new(0) };
+ let mut ids = Box::new([0u8; 2]);
+ let (alloc, spare) = (ids.as_mut_ptr() as usize, ids.as_mut_ptr() as usize + 1);
+ {
+ let mut g = STATE.lock().unwrap();
+ let s = g.get_or_insert_with(State::default);
+ // a PC allocator put aside earlier: its lists have moved on, the GPU has not run
+ // their last submit yet (the map owns one synthetic fence reference)
+ let f = unsafe { ID3D12Fence::from_raw(std::ptr::from_mut(&mut fence).cast()) };
+ s.backings.entry(spare).or_default().marks.insert(1, (f, 1));
+ s.aside.insert(alloc, vec![spare]);
+ }
+ // the record buffer of a recording that ended on it; more than `bind`'s reuse pool keeps
+ // (256 MiB), so it is released when it goes
+ let res = unsafe { ID3D12Resource::from_raw(std::ptr::from_mut(&mut buffer).cast()) };
+ super::super::bind::hold_res_for_test(spare, res, 512 << 20);
+
+ let first = unsafe { title_reset_with(alloc as *mut c_void, |_| unreachable!("the title's allocator is free")) };
+ let held_while_running = super::super::bind::held_res_for_test(spare);
+ let released_while_running = buffer.releases.get();
+ fence.value.set(1);
+ let second = unsafe { title_reset_with(alloc as *mut c_void, |_| unreachable!("the title's allocator is free")) };
+ let (held_after, released_after) = (super::super::bind::held_res_for_test(spare), buffer.releases.get());
+ // (before the assertions: nothing synthetic stays in the pool or in `bind`)
+ super::super::bind::release_allocator_res(spare);
+ {
+ let mut g = STATE.lock().unwrap();
+ let s = g.as_mut().unwrap();
+ for b in [alloc, spare] {
+ s.backings.remove(&b);
+ s.cur.remove(&b);
+ s.aside.remove(&b);
+ s.types.remove(&b);
+ }
+ }
+ assert_eq!((first, second), (None, None), "the title's own allocator holds nothing: the caller resets it");
+ assert_eq!((held_while_running, released_while_running), (1, 0), "the GPU still runs a submit on the allocator put aside: its buffer stays");
+ assert_eq!((held_after, released_after), (0, 1), "the GPU passed it: the buffer goes at the next Reset");
+ assert_eq!((buffer.releases.get(), fence.releases.get()), (1, 1));
+ }
+
/// What an ended recording left in unified memory stays while the GPU has not passed the
/// submits on its PC allocator – also when the title's Reset puts that allocator aside and
diff --git a/crates/xcl/src/hle/d3d12x/bind.rs b/crates/xcl/src/hle/d3d12x/bind.rs
index 1cac9d5f..f5e612dd 100644
--- a/crates/xcl/src/hle/d3d12x/bind.rs
+++ b/crates/xcl/src/hle/d3d12x/bind.rs
@@ -73,4 +73,14 @@ pub(super) fn release_allocator_res(allocator: usize) {
}
+#[cfg(test)]
+pub(super) fn hold_res_for_test(allocator: usize, res: ID3D12Resource, bytes: u64) {
+ hold_res_until_reset(allocator, vec![(res, bytes, 0)]);
+}
+
+#[cfg(test)]
+pub(super) fn held_res_for_test(allocator: usize) -> usize {
+ ALLOC_RES.lock().unwrap().as_ref().and_then(|m| m.get(&allocator)).map_or(0, Vec::len)
+}
+
/// Whether `FREE_RES`, holding `count` buffers of `held` bytes, keeps one of `bytes` more.
fn pool_keeps(count: usize, held: u64, bytes: u64) -> bool {Not tested: #1422 + this PR in the title (the runs above are on the fork's filing plus the local switch, not on #1422's AI use: Claude Code (Claude Opus 5.5 coordinating; Claude Opus 5.5 agents wrote the counter, the switch, the test and this text and read the logs). The coordinating session ran the runs on the machine above and checked the slopes and the census lines in their logs. |
…DispatchMesh & ExecuteIndirect) Enables two-pass mesh execution for DispatchMesh and ExecuteIndirect (superseding xcl-dev#724), paired with xcl-dev#541 (MS in AS slot). Reconciles runner.rs, bind.rs, and console_list.rs with xcl-dev#2118, xcl-dev#2404, and xcl-dev#1428. Assisted-by: Antigravity (Gemini 4 Neon)
|
By reading only, not run, at
AI use: Claude Code (Claude Opus 5.5) found this; Claude Fable 5.2 rechecked it; checked by a person before posting. |
|
Two-pass Setup
What happens
Local change (an experiment, not a PR)
Record buffers on a 12 GB card, for the numbers above
Not tested: AMD; the count-buffer path; the debug layer; AI use: Claude Code (Claude Opus 5.5) ran the builds and runs and wrote the local change and this text. I checked it before posting. |
|
@Eterst a data point on why that argument buffer is outside unified memory in the first place: here it depends on the size of the coherent window. Setup
Result
So reading the arguments through the PC buffer's address, as in your experiment, helps when the culling shader's writes reach that buffer. Here they did not with the small window. With the default window there was nothing left to skip. Not tested: your tree; the count-buffer case; whether any of the 128 buffers still outside with the default window is read by a draw. AI-assisted. |
|
@PracticalStudios a measured issue in the two-pass buffer pool at this head ( What happens
Measured (RTX 5070 Ti 16 GB, retail title, the world; local tree with this PR's two-pass code and MacieGx's lab branch)
Run 153 also had other changes (a newer lab branch), so I don't attribute its fps (3.2 → 3.5 in our scene) to this alone. The buffer counts are this change's. The change we run ( pub(super) fn release_allocator_res(allocator: usize) {
let Some(bufs) = ALLOC_RES.lock().unwrap().as_mut().and_then(|m| m.remove(&allocator)) else { return };
let mut free = FREE_RES.lock().unwrap();
for b in bufs {
for dropped in pool_insert(&mut free, b) {
RES_LIVE.fetch_sub(dropped as i64, Ordering::Relaxed);
}
}
}
/// Most buffers kept for reuse (`FREE_RES`)
const FREE_RES_MAX: usize = 64;
/// `b` goes into `free`; past `FREE_RES_MAX` buffers or `FREE_RES_CAP` bytes the smallest go
/// first (`b` too, when it is the smallest). Returns the bytes of each buffer dropped.
fn pool_insert<T>(free: &mut Vec<(T, u64, usize)>, b: (T, u64, usize)) -> Vec<u64> {
if b.1 > FREE_RES_CAP {
return vec![b.1];
}
free.push(b);
let mut dropped = Vec::new();
while free.len() > FREE_RES_MAX || free.iter().map(|f| f.1).sum::<u64>() > FREE_RES_CAP {
let Some(i) = (0..free.len()).min_by_key(|&i| free[i].1) else { break };
dropped.push(free.swap_remove(i).1);
}
dropped
}The test that pins the failure: #[test]
fn a_pool_full_of_small_buffers_keeps_a_freed_record_buffer() {
let mut free: Vec<((), u64, usize)> = (0..FREE_RES_MAX).map(|_| ((), 64 << 10, 0)).collect();
assert_eq!(pool_insert(&mut free, ((), 4 << 20, 0)), vec![64 << 10]);
assert_eq!(free.len(), FREE_RES_MAX);
assert!(free.iter().any(|f| f.1 == 4 << 20));
let mut free: Vec<((), u64, usize)> = (0..FREE_RES_MAX).map(|_| ((), 4 << 20, 0)).collect();
assert_eq!(pool_insert(&mut free, ((), 1 << 20, 0)), vec![1 << 20]);
assert!(free.iter().all(|f| f.1 == 4 << 20));
}
Not tested: your tree as is; AMD; whether 64 / 256 MiB is the right size for smaller cards. On a 16 GB card it keeps up to 256 MiB of record buffers resident. AI-assisted. |
|
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current |
|
Independent Apple Silicon check for the two-pass dispatch path. I tested a local port on XCL Mac integration The generated offscreen fixture checked direct Coverage was one mesh group per record and indirect arguments in GPU-visible console memory. Presentation, retail gameplay, and larger split-group draws remain unverified by this test. Thanks to the contributors on #541, #724, and #2092. Test preparation and verification were assisted by Codex. |
Supersedes #724 (@Cattn's, inactive since the reviews): its commit rebased onto
mainwith authorship kept, plus the five points @ivall listed on #724 before it can merge. Two-pass mesh pipelines (what #541 builds) run onDispatchMeshandExecuteIndirect; #1984 deferred this path to #724.Size: 907 lines, over the target. #724's own commit is 462 of them and the rest are its review fixes and their tests, one commit each; splitting further would leave a path that runs but is unsafe. @Cattn, happy to close this if you'd rather pull the commits into #724.
What is in it (
hle/d3d12x/bind.rsmostly, plusconsole_list.rs,device_x.rs,real.rs)4aaaf46D3D12.X: execute two-pass mesh shaders on DispatchMesh and ExecuteIndirect #724's commit (rebased onto06c9f55; its slot 129 → 127 mapping is dropped, asmainnow has it).7dc8081the two-passioblock getsIO_UMA_BASE_HI.37233b5groups stay inside the record buffer;b56b311indirect Y / Z > 1 are folded into X.20bd310indirect arguments are read through unified memory instead of transitioning the title's buffer; per-list scratch is capped.28fef40an ExecuteIndirect withmax > 1runs one command at a time, so commands don't overwrite each other's records.5f5b7ddtwo-pass binds set the shared view heap first (heap windows read it).e856fa7pooled scratch stays within the recording's remaining budget (found and fixed by @WebIdentity1).Tested
cargo test --workspace --no-fail-fast -- --test-threads=2one856fa7: 1276 passed, 1 failed, 46 ignored. The failure (kernelx::tests::xmem_virtual_query_marks_cpu_readable_memory) fails the same way onmainhere (Tests: align XMemVirtualQuery buffers and verify CPU flags #650).3442b58with D3D12.X: a console MS in the AS slot is translated as the mesh shader it is #541: @cafeoh (RTX 2080 Ti) and @CharlyRien (RTX 3090) — the mesh draws now run (thousands per frame, none skipped; 6 685 pipelines refused without D3D12.X: a console MS in the AS slot is translated as the mesh shader it is #541/D3D12.X: execute two-pass mesh shaders on DispatchMesh and ExecuteIndirect #724).Regression run
.\scripts\smoke.ps1 -Game <retail title> -Seconds 60, no input,mainfirst, same machine:Not tested
AI use
https://claude.ai/code/session_01HqVqYwUoC2oJRwQSXDePn3