Skip to main content

Module multi_gpu

Module multi_gpu 

Source
Expand description

Mockable multi-GPU work partitioning. Multi-GPU adapter probing, backend acquisition, and work partitioning.

The pure partitioner stays separately testable, but production callers can now derive device loads from live wgpu adapters and acquire one backend per selected adapter instead of stopping at scheduling math.

§Two allocation modes

  1. Batch + cost-aware (partition_work_stealing): caller knows every work item + its cost up front; LPT greedy assigns the heaviest item to the least-loaded device.
  2. Stream + content-addressed (shard_by_blake3 + StreamShardAllocator): caller yields (key, cost) pairs one at a time from a walker. The initial device is blake3(key)[0] % n_gpus for deterministic affinity - files with the same path always land on the same GPU across runs, which enables cache-warm re-scans. Overflow (queue on the target GPU is already loaded above threshold) spills to the least-loaded neighbor to keep tail latency bounded.

Structs§

BorrowedGpuWorkItem
Borrowed multi-GPU work packet for hot scan paths.
DeviceLoad
Current device load snapshot.
GpuWorkItem
One executable multi-GPU work packet.
GpuWorkOutput
Output from one dispatched GpuWorkItem.
LiveGpu
A live GPU selected for multi-device scheduling.
MultiGpuExecutor
Real multi-GPU executor backed by one crate::WgpuBackend per adapter.
Partition
Work assigned to one device.
StreamShardAllocator
Streaming shard allocator.
WeightedWorkItem
One pending unit of GPU work.

Functions§

live_gpu_loads
Enumerate live wgpu GPU adapters as zero-load scheduling targets.
partition_work_stealing
Partition work by repeatedly assigning the largest remaining item to the least-loaded device.
shard_by_blake3
Deterministic content-addressed device pick.