Expand description
Device-per-circuit registry — obtain a wgpu::Device for a SPECIFIC adapter/circuit
(e.g. the integrated GPU), not just the single process-wide primary (STELLAR H3 foundation).
Native only; mirrors try_shared_gpu — never panics on a missing/failed device.
Device-per-circuit registry — obtain a wgpu::Device for a SPECIFIC adapter/circuit
(STELLAR §A H3 foundation for heterogeneous GPU routing).
[super::shared_gpu] / [super::try_shared_gpu] give you the single process-wide primary
device (a PowerPreference::HighPerformance pick — the discrete GPU on a discrete+integrated
box). This module lets code obtain a device for a specific enumerated circuit — e.g. the
integrated GPU — so audio/vision work can run off the LLM’s silicon.
Role policy: keep the primary circuit free for the LLM; audio/vision use the auxiliary
circuit. [try_auxiliary_gpu] gives callers the fallback chain auxiliary → primary → None
(the caller then degrades to CPU) so they always get a device or None, never a panic.
Mirrors [super::try_shared_gpu]’s discipline: no unwrap() outside tests, and it NEVER panics
on a missing or failed device — every failure path returns None. Native only.
Structs§
- Circuit
Adapter - One enumerated compute circuit: the live
wgpu::Adapter, its capability snapshot, and a stable identity (vendor / device / backend) matchingdevice_benchmark/host_topology.
Functions§
- auxiliary_
circuit_ index - Index of the best auxiliary circuit — the best NON-primary circuit, so the primary stays
free for the LLM. Prefers a (non-primary)
DeviceType::IntegratedGpu; otherwise the next-best non-primary circuit (the list is already ranked discrete → integrated → …). ReturnsNonewhen only one circuit exists. - enumerate_
circuits - Enumerate every adapter once (cached), deduped to one entry per physical circuit (vendor, device) keeping the preferred backend, and sorted discrete → integrated → other → cpu for a deterministic, index-stable list. Returns an empty slice on a headless / GPU-less box.
- primary_
circuit_ index - Index of the primary circuit — the discrete / HighPerformance adapter that
super::shared_gpuuses. If the process-wide shared device is already initialized, matches its exact identity (that is definitionally the primary). Otherwise picks the first discrete GPU (whatHighPerformanceselects), else the top-ranked adapter.Noneonly when no circuit exists. Never forces the shared device to initialize. - try_
auxiliary_ gpu - A device for the auxiliary circuit if one exists, else the primary shared device, else
None. Fallback chain: auxiliary → primary → None (the caller then degrades to CPU). Never panics — every failure resolves toNone. - try_
device_ for_ adapter - Lazily build (and cache) a
SharedGpuContextfor the enumerated circuit atindex.