Skip to content

Commit 20aa790

Browse files
committed
Reject software renderers in GPU probe (only accept DiscreteGpu/IntegratedGpu)
1 parent 5bbd57b commit 20aa790

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

crates/pecos-gpu-sims/src/gpu_probe.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,32 @@ pub fn request_default_gpu_device(
6161
device_type: info.device_type,
6262
};
6363

64+
// Reject software renderers and unknown device types -- they technically
65+
// "work" but OOM on real workloads (common on CI runners without real GPUs)
66+
match info.device_type {
67+
wgpu::DeviceType::DiscreteGpu | wgpu::DeviceType::IntegratedGpu => {}
68+
other => {
69+
return Err(GpuStartupError::DeviceCreation {
70+
info,
71+
error: format!("Device type {other:?} is not a hardware GPU"),
72+
});
73+
}
74+
}
75+
76+
// Check buffer limits -- real GPUs support at least 128MB storage buffers.
77+
// Software renderers or broken drivers may report very low limits.
78+
let limits = adapter.limits();
79+
let min_buffer_mb = 128;
80+
if limits.max_storage_buffer_binding_size < min_buffer_mb * 1024 * 1024 {
81+
return Err(GpuStartupError::DeviceCreation {
82+
info,
83+
error: format!(
84+
"GPU storage buffer limit too small ({} MB, need at least {min_buffer_mb} MB)",
85+
limits.max_storage_buffer_binding_size / 1024 / 1024
86+
),
87+
});
88+
}
89+
6490
let (device, queue) = pollster::block_on(adapter.request_device(&wgpu::DeviceDescriptor {
6591
label: Some(label),
6692
required_features: wgpu::Features::empty(),

0 commit comments

Comments
 (0)