pub struct OutputRing {
pub slot_bytes: usize,
pub alloc_dims: (u32, u32),
pub metrics: RingMetrics,
/* private fields */
}Expand description
Fixed-size ring of pre-allocated device buffers for inference output.
Fields§
§slot_bytes: usizeSize of each slot in bytes (3 × out_w × out_h × sizeof(f32)).
alloc_dims: (u32, u32)Input dimensions (width, height) used to allocate the current slots.
metrics: RingMetricsAtomic counters tracking reuse, contention, and first-use events.
Implementations§
Source§impl OutputRing
impl OutputRing
Sourcepub fn new(
ctx: &GpuContext,
in_w: u32,
in_h: u32,
scale: u32,
count: usize,
min_slots: usize,
) -> Result<Self>
pub fn new( ctx: &GpuContext, in_w: u32, in_h: u32, scale: u32, count: usize, min_slots: usize, ) -> Result<Self>
Allocate count output buffers.
min_slots is the enforced minimum (downstream_capacity + 2).
Returns error if count < min_slots.
Sourcepub fn acquire(&mut self) -> Result<Arc<CudaSlice<u8>>>
pub fn acquire(&mut self) -> Result<Arc<CudaSlice<u8>>>
Acquire the next ring slot for writing.
§Serialization invariant
Asserts Arc::strong_count == 1 before returning. If downstream
still holds a reference, returns error and increments contention counter.
Sourcepub fn needs_realloc(&self, in_w: u32, in_h: u32) -> bool
pub fn needs_realloc(&self, in_w: u32, in_h: u32) -> bool
Return true if the current slot dimensions differ from (in_w, in_h).
Sourcepub fn reallocate(
&mut self,
ctx: &GpuContext,
in_w: u32,
in_h: u32,
scale: u32,
) -> Result<()>
pub fn reallocate( &mut self, ctx: &GpuContext, in_w: u32, in_h: u32, scale: u32, ) -> Result<()>
Reallocate all slots. All must have strong_count == 1.
Auto Trait Implementations§
impl !Freeze for OutputRing
impl RefUnwindSafe for OutputRing
impl Send for OutputRing
impl Sync for OutputRing
impl Unpin for OutputRing
impl UnsafeUnpin for OutputRing
impl UnwindSafe for OutputRing
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more