From 4d4d9bcee6acfdf9fd83ecab70ba31866bb2eb30 Mon Sep 17 00:00:00 2001 From: local Date: Wed, 25 Nov 2026 12:36:58 -0600 Subject: [PATCH] Host heaps' slots are made under locks of their own; the heaps' records and the buffer views picked by index are made on several threads (VICTORY_VIEW_THREADS) Co-Authored-By: Claude Opus 5.5 --- crates/victory-gpu/src/descriptor.rs | 33 +++- crates/victory-gpu/src/descriptor/host.rs | 174 ++++++++++++++-------- crates/victory-gpu/src/draw.rs | 80 ++++++---- crates/victory-gpu/src/land.rs | 20 ++- crates/victory-gpu/src/land/tests.rs | 6 +- 5 files changed, 206 insertions(+), 107 deletions(-) diff --git a/crates/victory-gpu/src/descriptor.rs b/crates/victory-gpu/src/descriptor.rs index 6585bfa..f5578c8 100644 --- a/crates/victory-gpu/src/descriptor.rs +++ b/crates/victory-gpu/src/descriptor.rs @@ -320,14 +320,22 @@ pub(crate) fn sync_heaps() { let mirrored_count = heap.desc.count.min(host.count()); // The records of some frames ago that no draw read through a table // since: a shader may pick them by index. - for index in host.copied_before(frame) { - if host.copied_tabled(index, frame) { - tabled += 1; - } else { - host.mirror(index, start + u64::from(index) * step, false); - mirrored += 1; + let before = host.copied_before(frame); + let of_tables = std::sync::atomic::AtomicU64::new(0); + crate::land::each_view(before.len().div_ceil(SYNC_AT_A_TIME), &|n| { + for &index in before.chunks(SYNC_AT_A_TIME).nth(n).unwrap_or_default() { + if host.copied_tabled(index, frame) { + of_tables.fetch_add(1, Relaxed); + } else { + host.mirror(index, start + u64::from(index) * step, false); + } } - } + }); + let of_tables = of_tables.into_inner(); + tabled += of_tables; + mirrored += before.len() as u64 - of_tables; + // Those of the changed pages, made together at the end. + let mut make: Vec = Vec::new(); for (range_from, range_end) in written.take(start as usize, end as usize) { let mut page = range_from & !(crate::watch::PAGE - 1); while page < range_end { @@ -378,13 +386,18 @@ pub(crate) fn sync_heaps() { continue; } } - host.mirror(index, start + u64::from(index) * step, false); + make.push(index); mirrored += 1; } } page += crate::watch::PAGE; } } + crate::land::each_view(make.len().div_ceil(SYNC_AT_A_TIME), &|n| { + for &index in make.chunks(SYNC_AT_A_TIME).nth(n).unwrap_or_default() { + host.mirror(index, start + u64::from(index) * step, false); + } + }); if !wait.is_empty() { host.copied_wait(frame, std::mem::take(&mut wait)); } @@ -396,6 +409,10 @@ pub(crate) fn sync_heaps() { } } +/// Records [`sync_heaps`] gives a thread at a time. +#[cfg(windows)] +const SYNC_AT_A_TIME: usize = 256; + /// Since the last frame line, of [`sync_heaps`]: changed pages of placed /// shader-visible heaps looked at, slots on them, slots whose record was /// not the one last seen and was mirrored, the microseconds it took; then diff --git a/crates/victory-gpu/src/descriptor/host.rs b/crates/victory-gpu/src/descriptor/host.rs index 2e1c06a..43fe712 100644 --- a/crates/victory-gpu/src/descriptor/host.rs +++ b/crates/victory-gpu/src/descriptor/host.rs @@ -13,6 +13,45 @@ use windows::Win32::Graphics::Dxgi::Common::*; use super::{VIEW_TAG, View, view_at}; use crate::host::host; +/// The record each slot of a heap was last made from, and a lock for every +/// few hundredth of the slots: whoever makes a slot holds its lock, and no +/// other. +/// +/// One lock for the heap was what everything of a frame waited for once the +/// lists were translated by threads of ours: half of what those did, two +/// thirds of the heaps' records and half of the pass over the buffer views +/// (profile thin-2). +struct Made { + keys: Vec, + locks: [Mutex<()>; Self::LOCKS], +} + +impl Made { + const LOCKS: usize = 512; + + fn new(count: usize) -> Self { + let mut keys = Vec::new(); + keys.resize_with(count, Default::default); + Made { keys, locks: [const { Mutex::new(()) }; Self::LOCKS] } + } + + /// The lock slot `index` is made under. Neighbours have different ones. + fn lock(&self, index: u32) -> std::sync::MutexGuard<'_, ()> { + self.locks[index as usize % Self::LOCKS].lock().unwrap_or_else(|e| e.into_inner()) + } + + fn get(&self, index: u32) -> Option { + Some(self.keys.get(index as usize)?.load(std::sync::atomic::Ordering::Acquire)) + } + + /// Under the slot's lock. + fn set(&self, index: u32, key: u64) { + if let Some(k) = self.keys.get(index as usize) { + k.store(key, std::sync::atomic::Ordering::Release); + } + } +} + pub(crate) struct HostHeap { pub(crate) heap: ID3D12DescriptorHeap, cpu: usize, @@ -33,7 +72,7 @@ pub(crate) struct HostHeap { #[cfg(feature = "diagnostics")] written: Vec, /// The record (view index and generation) each slot was last made from. - made: Mutex>, + made: Made, /// The same for a slot whose descriptor is made and stays (else 0): what /// [`HostHeap::mirror`] asks first, without the lock. Changed under it. quick: Vec, @@ -1406,7 +1445,7 @@ impl HostHeap { written: (0..if sampler || !crate::book::on() { 0 } else { size }) .map(|_| std::sync::atomic::AtomicU32::new(0)) .collect(), - made: Mutex::new(vec![0; count as usize]), + made: Made::new(count as usize), quick: (0..count).map(|_| std::sync::atomic::AtomicU64::new(0)).collect(), copied: Mutex::new(Vec::new()), waiting: Mutex::default(), @@ -1802,11 +1841,12 @@ impl HostHeap { // from a view the host could not make (`make` gave nothing, the // slot is null and keeps nothing). The host copy of such a // texture is held by no slot, may have been let go, and would be - // made anew here, with the card full. `made` first, then `kept`, - // as `mirror` takes them. - let made = self.made.lock().unwrap_or_else(|e| e.into_inner()); - made.get(index as usize).is_some_and(|&made| made != 0 && made == key) - && self.kept_in(index).is_some() + // made anew here, with the card full. + if key == 0 || self.made.get(index) != Some(key) { + return false; + } + let _made = self.made.lock(index); + self.made.get(index) == Some(key) && self.kept_in(index).is_some() } /// Levels on demand (`crate::tiles`): makes again the host slots of the @@ -1897,15 +1937,12 @@ impl HostHeap { let placed = self.placed.lock().unwrap_or_else(|e| e.into_inner()); starts.iter().flat_map(|&start| placed.slots_at(start)).collect() }; - let made = self.made.lock().unwrap_or_else(|e| e.into_inner()); let mut remade = 0; for slot in slots { - let Some(&key) = made.get(slot as usize) else { + let _made = self.made.lock(slot); + let Some(key) = self.made.get(slot).filter(|&key| key != 0) else { continue; }; - if key == 0 { - continue; - } let Some(view) = view_at(key as u32, (key >> 32) as u32) else { continue; }; @@ -1935,8 +1972,8 @@ impl HostHeap { let wait = *WAIT.get_or_init(|| { std::env::var("VICTORY_TEXTURE_AWAY_MS").ok().and_then(|v| v.trim().parse().ok()).unwrap_or(AWAY_MS) }); - let mut made = self.made.lock().unwrap_or_else(|e| e.into_inner()); - let Some(key) = made.get(index as usize).copied().filter(|&key| key != 0) else { + let _made = self.made.lock(index); + let Some(key) = self.made.get(index).filter(|&key| key != 0) else { return false; }; let now = crate::host::now_ms(); @@ -1954,7 +1991,7 @@ impl HostHeap { } } } - self.unmake(&mut made, index); + self.unmake(index); STALE[4].fetch_add(1, std::sync::atomic::Ordering::Relaxed); true } @@ -1963,8 +2000,7 @@ impl HostHeap { /// at `handle` views, by an earlier view of it. pub(crate) fn texture_slot_shows_other(&self, index: u32, handle: u64) -> bool { let key = record_key(handle); - let made = self.made.lock().unwrap_or_else(|e| e.into_inner()); - let Some(&shown) = made.get(index as usize) else { + let Some(shown) = self.made.get(index) else { return false; }; if key == 0 || shown == 0 || shown == key { @@ -1992,33 +2028,31 @@ impl HostHeap { let (true, Some(view)) = (key != 0, view) else { return; }; - { - let mut made = self.made.lock().unwrap_or_else(|e| e.into_inner()); - let Some(&shown) = made.get(index as usize) else { + let stale = { + let _made = self.made.lock(index); + let Some(shown) = self.made.get(index) else { return; }; if shown == key { return; } // (As `mirror`.) - for stale in self.note_buffer(index, Some(&view), true) { - if stale != index { - self.unmake(&mut made, stale); - } - } + let stale = self.note_buffer(index, Some(&view), true); let old = view_at(shown as u32, (shown >> 32) as u32); if shown == 0 || !old.is_some_and(|old| same_placed_texture(&old, &view)) { #[cfg(feature = "diagnostics")] note_before(index, shown, "neutral"); self.quick_is(index, 0); - made[index as usize] = 0; + self.made.set(index, 0); let kept = neutral_for(&view, self.at(index)); self.put(index); self.clear_twin(index); LATE[3].fetch_add(u64::from(kept.is_some()), Relaxed); self.keep(index, kept); } - } + stale + }; + self.unmake_stale(index, stale); self.flip(list, index, handle, Some(crate::frame::current())); } @@ -2065,18 +2099,18 @@ impl HostHeap { ready }; let mut flipped = 0; - let mut made = self.made.lock().unwrap_or_else(|e| e.into_inner()); for f in ready { - let Some(shown) = made.get_mut(f.index as usize) else { + let _made = self.made.lock(f.index); + let Some(shown) = self.made.get(f.index) else { continue; }; - if *shown == f.key { + if shown == f.key { continue; } // Written again since, or made null: that write is in the queue. // (A slot shown late is null until now.) let view = view_at(f.key as u32, (f.key >> 32) as u32); - let there = *shown != 0 || f.late.is_some(); + let there = shown != 0 || f.late.is_some(); let (true, true, Some(view)) = (f.key != 0 && record_key(f.handle) == f.key, there, view) else { FLIPPED[1].fetch_add(1, Relaxed); LATE[4].fetch_add(u64::from(f.late.is_some()), Relaxed); @@ -2095,9 +2129,9 @@ impl HostHeap { } if let Some(kept) = make(&view, self.at(f.index)) { #[cfg(feature = "diagnostics")] - note_before(f.index, *shown, if f.late.is_some() { "shown after its upload" } else { "flip" }); + note_before(f.index, shown, if f.late.is_some() { "shown after its upload" } else { "flip" }); self.put(f.index); - *shown = f.key; + self.made.set(f.index, f.key); self.keep(f.index, kept); if let Some(since) = f.late { let frames = crate::frame::current().saturating_sub(since); @@ -2131,12 +2165,13 @@ impl HostHeap { } /// Makes host slot `index` null again, as it is before its view is - /// made: a null view of the kind it held. - fn unmake(&self, made: &mut [u64], index: u32) { + /// made: a null view of the kind it held. Under its lock ([`Made`]). + fn unmake(&self, index: u32) { self.quick_is(index, 0); - let Some(key) = made.get_mut(index as usize).map(std::mem::take) else { + let Some(key) = self.made.get(index) else { return; }; + self.made.set(index, 0); if key == 0 { return; } @@ -2149,6 +2184,21 @@ impl HostHeap { self.keep(index, None); } + /// The slots [`HostHeap::note_buffer`] found stale for slot `index`, with + /// what they were made from then, become null. None of their locks is + /// held here; one made from another record meanwhile is left as it is. + fn unmake_stale(&self, index: u32, stale: Vec<(u32, u64)>) { + for (slot, key) in stale { + if slot == index || key == 0 { + continue; + } + let _made = self.made.lock(slot); + if self.made.get(slot) == Some(key) { + self.unmake(slot); + } + } + } + /// Title slot `index` is a table's ([`HostHeap::tabled`]). `read`: a /// draw read it through the table and brought what it views up to /// date, so the slot leaves the queue of textures picked by index; the @@ -2258,9 +2308,11 @@ impl HostHeap { /// `seen`: the slot was not written now, a draw or a pass made its /// host slot from what it held. /// Returns the title slots whose placed texture view the write made - /// stale ([`Spans`]): out of the queue of textures already, their host - /// slots are the caller's to make null (it holds `made`). - fn note_buffer(&self, index: u32, view: Option<&View>, seen: bool) -> Vec { + /// stale ([`Spans`]), each with the record its host slot is made from: + /// out of the queue of textures already, their host slots are the + /// caller's to make null when it has let go of its own slot's lock + /// ([`HostHeap::unmake_stale`]). + fn note_buffer(&self, index: u32, view: Option<&View>, seen: bool) -> Vec<(u32, u64)> { if self.sampler { return Vec::new(); } @@ -2310,7 +2362,9 @@ impl HostHeap { placed.rule = stale_rule(); let stale = placed.note(index, start, end, !seen); placed.shows(index, first, held); - stale + // (Under the lock of `placed`: a later write of one of + // them comes by here before it makes the slot.) + stale.into_iter().map(|slot| (slot, self.made.get(slot).unwrap_or(0))).collect() } None => { placed.forget(index); @@ -2321,7 +2375,7 @@ impl HostHeap { if !stale.is_empty() { STALE[0].fetch_add(stale.len() as u64, std::sync::atomic::Ordering::Relaxed); let mut textures = self.textures.lock().unwrap_or_else(|e| e.into_inner()); - for &slot in &stale { + for &(slot, _) in &stale { textures.remove(slot); } } @@ -2821,14 +2875,15 @@ impl HostHeap { { return Some(view); } - let mut made = self.made.lock().unwrap_or_else(|e| e.into_inner()); + let held = self.made.lock(index); + let shown = self.made.get(index).unwrap_or(0); let view = (tag == VIEW_TAG).then(|| view_at(i, generation)).flatten(); let Some(view) = view else { // Not a view of ours (never written, or of a resource the // title released): nothing to read. - if made[index as usize] != 0 { + if shown != 0 { self.quick_is(index, 0); - made[index as usize] = 0; + self.made.set(index, 0); self.make_null(index); let _ = self.note_buffer(index, None, false); } else if for_draw { @@ -2837,15 +2892,12 @@ impl HostHeap { } return None; }; - if made[index as usize] != key { + if shown != key { // Views of other textures in the memory this one describes // are stale: their host slots read nothing from here on, and // let go of the host copies they held. - for stale in self.note_buffer(index, Some(&view), for_draw) { - if stale != index { - self.unmake(&mut made, stale); - } - } + // (When this slot's lock is let go: a lock at a time.) + let stale = self.note_buffer(index, Some(&view), for_draw); // A view of a texture object that has no host copy yet waits // for it, as buffer views wait for a draw: the slot is made // when the texture is first used (`super::make_waiting`), or @@ -2864,18 +2916,20 @@ impl HostHeap { // time it got sharper. if later && keep_views() - && view_at(made[index as usize] as u32, (made[index as usize] >> 32) as u32) + && view_at(shown as u32, (shown >> 32) as u32) .is_some_and(|old| same_placed_texture(&old, &view)) { KEPT_VIEWS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + drop(held); + self.unmake_stale(index, stale); return Some(view); } #[cfg(feature = "diagnostics")] if !self.sampler && is_texture_view(&view) { - note_before(index, made[index as usize], if later { "null, waits" } else { "at once" }); + note_before(index, shown, if later { "null, waits" } else { "at once" }); } self.quick_is(index, 0); - made[index as usize] = if later { 0 } else { key }; + self.made.set(index, if later { 0 } else { key }); let kept = if later { None } else { @@ -2889,7 +2943,9 @@ impl HostHeap { } self.twin_made(index, kept.is_some() && twinned(&view)); self.keep(index, kept.flatten()); - self.quick_is(index, made[index as usize]); + self.quick_is(index, if later { 0 } else { key }); + drop(held); + self.unmake_stale(index, stale); } Some(view) } @@ -2905,11 +2961,7 @@ impl HostHeap { /// Whether slot `index` is backed by a made host descriptor (tests). #[cfg(test)] pub(crate) fn made(&self, index: u32) -> bool { - self.made - .lock() - .unwrap_or_else(|e| e.into_inner()) - .get(index as usize) - .is_some_and(|&key| key != 0) + self.made.get(index).is_some_and(|key| key != 0) } /// Whether host slot `index` shows `buffer`; `None` if it shows no @@ -2944,7 +2996,7 @@ impl HostHeap { /// a slot never made or left null. #[cfg(feature = "diagnostics")] pub(crate) fn describe_slot(&self, index: u32) -> Option { - let key = *self.made.lock().unwrap_or_else(|e| e.into_inner()).get(index as usize)?; + let key = self.made.get(index)?; if key == 0 { return Some("null".into()); } @@ -4920,7 +4972,7 @@ mod tests { assert_eq!(slots(50), []); assert_eq!(slots(51), [1]); // A wider texture written at the same address: slot 1 is stale. - assert_eq!(heap.note_buffer(2, Some(&view(at, 128)), false), [1]); + assert_eq!(heap.note_buffer(2, Some(&view(at, 128)), false), [(1, 0)]); assert_eq!(slots(u64::MAX), [2]); } diff --git a/crates/victory-gpu/src/draw.rs b/crates/victory-gpu/src/draw.rs index 9889269..7001abc 100644 --- a/crates/victory-gpu/src/draw.rs +++ b/crates/victory-gpu/src/draw.rs @@ -761,48 +761,66 @@ fn heap_buffer_pass(heap: &crate::descriptor::Heap, host: &crate::descriptor::ho // Whether the device was there before the pass: a view that removes // it is named below. static GONE: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); - let mut alive = !GONE.load(Ordering::Relaxed) && crate::descriptor::host::device_removed().is_none(); + let alive = !GONE.load(Ordering::Relaxed) && crate::descriptor::host::device_removed().is_none(); let mut unordered = Vec::new(); - for (n, &index) in slots.iter().enumerate() { - ranges.set(index, None); + /// The title's heap, for the threads that look. + struct Shared<'a>(&'a crate::descriptor::Heap); + // SAFETY: a heap is free-threaded (its methods are called by any thread of + // the title's), and it lives until all of them have looked. + unsafe impl Sync for Shared<'_> {} + impl Shared<'_> { + fn handle(&self, index: u32) -> Option { + self.0.handle(index) + } + } + let heap = Shared(heap); + // What a slot of the title's shows: its copy and range, and whether it is + // an unordered view. + let look = |index: u32| { // A draw's table's: the draw brings what it reads up to date. if host.copied_tabled(index, frame) { - continue; - } - let Some(handle) = heap.handle(index) else { - continue; - }; - let Some(view) = host.mirror(index, handle, true) else { - continue; - }; - // Every 64 views while the device lives (a cheap query). - if alive - && n % 64 == 63 - && let Some(why) = crate::descriptor::host::device_removed() - { - alive = false; - GONE.store(true, Ordering::Relaxed); - let last: Vec = slots[n - 63..=n] - .iter() - .filter_map(|&i| crate::descriptor::view(heap.handle(i)?).map(|v| format!("{i}: {v:?}"))) - .map(|s| s.chars().take(200).collect()) - .collect(); - tracing::error!(why, slot = index, "the host device went while buffer views of the heap were made; one of: {last:#?}"); - crate::host::log_removal_context(); + return None; } + let view = host.mirror(index, heap.handle(index)?, true)?; // The copy the slot shows (`buffer_copy`), not the one the // view's range alone would find. - let Some((shadow, address, len)) = crate::descriptor::host::buffer_copy(&view) else { - continue; - }; + let (shadow, address, len) = crate::descriptor::host::buffer_copy(&view)?; #[cfg(feature = "diagnostics")] if host.shows(index, &shadow.buffer) == Some(false) { HEAP_VIEWS_ELSEWHERE.fetch_add(1, Ordering::Relaxed); } - if crate::picked::on() && view_kind(&view) == Some(ResourceType::Uav) { - unordered.push((shadow.clone(), address, address + len)); + let written = crate::picked::on() && view_kind(&view) == Some(ResourceType::Uav); + Some(((shadow, address, address + len), written)) + }; + // Some slots at a time, on several threads. + const AT_A_TIME: usize = 256; + let parts: Vec<&[u32]> = slots.chunks(AT_A_TIME).collect(); + let found: Vec>> = parts.iter().map(|_| Default::default()).collect(); + crate::land::each_view(parts.len(), &|n| { + let looked: Vec<_> = parts[n].iter().map(|&index| (index, look(index))).collect(); + // (After each piece while the device lives: a cheap query.) + if alive + && let Some(why) = crate::descriptor::host::device_removed() + && !GONE.swap(true, Ordering::Relaxed) + { + let last: Vec = parts[n] + .iter() + .filter_map(|&i| crate::descriptor::view(heap.handle(i)?).map(|v| format!("{i}: {v:?}"))) + .map(|s| s.chars().take(200).collect()) + .collect(); + tracing::error!(why, "the host device went while buffer views of the heap were made; perhaps one of: {last:#?}"); + crate::host::log_removal_context(); } - ranges.set(index, Some((shadow, address, address + len))); + let _ = found[n].set(looked); + }); + for (index, shows) in found.into_iter().filter_map(std::sync::OnceLock::into_inner).flatten() { + let range = shows.map(|(range, written)| { + if written { + unordered.push(range.clone()); + } + range + }); + ranges.set(index, range); } if crate::picked::on() { crate::picked::shown(unordered, all); diff --git a/crates/victory-gpu/src/land.rs b/crates/victory-gpu/src/land.rs index 0bc5d5f..00b3ff1 100644 --- a/crates/victory-gpu/src/land.rs +++ b/crates/victory-gpu/src/land.rs @@ -227,7 +227,7 @@ impl Pool { self.state.lock().unwrap_or_else(|e| e.into_inner()) } - fn new(threads: usize) -> &'static Pool { + fn new(name: &'static str, threads: usize) -> &'static Pool { let pool: &'static Pool = Box::leak(Box::new(Pool { state: Mutex::new(State { work: None, next: 0, count: 0, running: 0, panicked: false }), more: Condvar::new(), @@ -237,8 +237,8 @@ impl Pool { })); for i in 1..threads { // (A helper that is not there is only missed.) - let _ = std::thread::Builder::new().name(format!("victory-land-{i}")).spawn(move || { - crate::cores::keep_helper_on_fast_cores("victory-land"); + let _ = std::thread::Builder::new().name(format!("{name}-{i}")).spawn(move || { + crate::cores::keep_helper_on_fast_cores(name); pool.help() }); } @@ -321,7 +321,19 @@ fn take(state: &mut State) -> Option<(Work, usize)> { /// [`Pool::each`] on the threads kept for landing. pub(crate) fn each(count: usize, f: &(dyn Fn(usize) + Sync)) { static POOL: OnceLock<&'static Pool> = OnceLock::new(); - POOL.get_or_init(|| Pool::new(threads())).each(count, f); + POOL.get_or_init(|| Pool::new("victory-land", threads())).each(count, f); +} + +/// Calls `f` with every number below `count`, on this thread and on threads +/// kept for making descriptors (`VICTORY_VIEW_THREADS`, 5 with this one; 1: +/// on this one alone). +pub(crate) fn each_view(count: usize, f: &(dyn Fn(usize) + Sync)) { + static POOL: OnceLock<&'static Pool> = OnceLock::new(); + POOL.get_or_init(|| { + let threads = std::env::var("VICTORY_VIEW_THREADS").ok().and_then(|v| v.trim().parse().ok()).unwrap_or(5usize); + Pool::new("victory-views", threads.clamp(1, 16)) + }) + .each(count, f); } /// A piece to land: the copy's number, the title address, its bytes. diff --git a/crates/victory-gpu/src/land/tests.rs b/crates/victory-gpu/src/land/tests.rs index f67d640..7e59e9d 100644 --- a/crates/victory-gpu/src/land/tests.rs +++ b/crates/victory-gpu/src/land/tests.rs @@ -48,7 +48,7 @@ impl Title { #[test] fn the_pool_calls_every_number_once() { for threads in [1usize, 2, 4, 7] { - let pool = Pool::new(threads); + let pool = Pool::new("victory-land", threads); std::thread::scope(|s| { for _ in 0..3 { s.spawn(|| { @@ -69,7 +69,7 @@ fn the_pool_calls_every_number_once() { /// A job that panics is told to the caller, and the pool goes on. #[test] fn a_panicking_job_reaches_the_caller() { - let pool = Pool::new(3); + let pool = Pool::new("victory-land", 3); for bad in 0..8usize { let ran = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { pool.each(8, &|i| assert_ne!(i, bad, "(expected)")); @@ -448,7 +448,7 @@ fn what_landing_costs() { frame("as before, guards opened ahead", dense, 1, before); frame("as before, nothing guarded", dense, 0, before); for threads in [1usize, 2, 3, 4, 5, 6, 8] { - let pool = Pool::new(threads); + let pool = Pool::new("victory-land", threads); for beside in [false, true] { frame(&format!("{threads} threads, beside {beside}"), dense, 2, &|landing| { let cut: Vec<(usize, usize)> = landing.iter().map(|p| (p.0, BLOCK)).collect();