fix(gpu): stop gpu_tests hanging under the parallel test runner
Every test created its own wgpu instance and device (with adapter-maximum limits) concurrently, which could wedge the driver and hang the suite indefinitely. Tests now hold a process-wide lock while they own a device, and GpuAccelerator readback waits are bounded at 30s so a stuck driver surfaces as GpuError::BufferMap instead of blocking forever. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
926dc457e0
commit
706189c3ef
@@ -6,6 +6,9 @@ use crate::shaders;
|
||||
use bytemuck::Pod;
|
||||
use wgpu::util::DeviceExt;
|
||||
|
||||
/// Upper bound on a single GPU→CPU readback wait.
|
||||
const READBACK_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(30);
|
||||
|
||||
/// GPU-accelerated vector search engine.
|
||||
///
|
||||
/// Upload vectors once, then run many searches against them.
|
||||
@@ -1033,10 +1036,12 @@ impl GpuAccelerator {
|
||||
slice.map_async(wgpu::MapMode::Read, move |result| {
|
||||
let _ = tx.send(result);
|
||||
});
|
||||
// Bounded wait: a wedged driver must surface as an error, not hang
|
||||
// the caller forever.
|
||||
self.device
|
||||
.poll(wgpu::PollType::Wait {
|
||||
submission_index: None,
|
||||
timeout: None,
|
||||
timeout: Some(READBACK_TIMEOUT),
|
||||
})
|
||||
.map_err(|e| GpuError::BufferMap(format!("device poll failed: {e}")))?;
|
||||
rx.recv()
|
||||
|
||||
Reference in New Issue
Block a user