vyre_driver_wgpu/runtime.rs
1//! Layer 0 GPU runtime: device, buffers, shader compilation, and dispatch.
2
3/// Adapter-caps probe (C-B10).
4///
5/// Projects a `wgpu::Adapter` into the substrate-neutral
6/// [`vyre_foundation::optimizer::AdapterCaps`] passes read to adapt.
7pub mod adapter_caps_probe;
8/// Tiered caching for device buffers and shader pipelines.
9pub mod cache;
10/// GPU device abstraction and initialization.
11pub mod device;
12/// Indirect dispatch path (C-B4).
13///
14/// Submits `ComputePass::dispatch_workgroups_indirect` on a
15/// GPU-resident `[u32; 3]` workgroup-count buffer.
16pub mod indirect;
17/// Pre-recorded persistent dispatch command buffers.
18pub mod prerecorded;
19/// Async readback ring (C-B5).
20///
21/// N-deep staging ring; dispatch i writes to `ring[i % N]`; copies
22/// submit immediately, readbacks map asynchronously. Overlaps
23/// dispatch i+1 with readback i's copy.
24pub mod readback_ring;
25/// Runtime backend auto-picker (C-B11).
26///
27/// Walks `inventory::iter::<BackendRegistration>`, filters by
28/// Program dialect support, picks by precedence. `VYRE_BACKEND=<id>`
29/// forces a specific backend.
30pub mod router;
31/// Runtime wire-format serialization for multi-part programs.
32pub mod serializer;
33/// Shader pipeline compilation and caching.
34pub mod shader;
35/// LRU cache access tracker for buffer eviction policies.
36pub use cache::lru::AccessTracker;
37/// Cache tier policies and access statistics.
38pub use cache::{AccessStats, CacheError, LruPolicy};
39/// Initialize a cached GPU device wrapper.
40pub use device::{cached_adapter_info, cached_device, init_device};
41/// Compile a compute pipeline from WGSL source.
42pub use shader::compile_compute_pipeline::{
43 compile_compute_pipeline, compile_compute_pipeline_with_layout,
44};
45
46/// Build a bind group entry binding `buffer` at `binding` index.
47#[must_use]
48#[inline]
49pub fn bg_entry(binding: u32, buffer: &wgpu::Buffer) -> wgpu::BindGroupEntry<'_> {
50 wgpu::BindGroupEntry {
51 binding,
52 resource: buffer.as_entire_binding(),
53 }
54}