pub struct MegakernelResidentBatchScratch { /* private fields */ }Expand description
Reusable host scratch for batched resident-handle megakernel dispatch.
This scratch owns the transient resource rows submitted to the backend and
the nested host readback buffers returned by batched dispatch. Reusing one
value across repeated batches avoids rebuilding Vec<[Resource; 4]>,
Vec<Vec<Vec<u8>>>, and per-output byte slots in many-small-launch loops.
Implementations§
Source§impl MegakernelResidentBatchScratch
impl MegakernelResidentBatchScratch
Sourcepub fn with_capacity(
batch_count: usize,
output_slots_per_batch: usize,
) -> Result<Self, PipelineError>
pub fn with_capacity( batch_count: usize, output_slots_per_batch: usize, ) -> Result<Self, PipelineError>
Preallocate scratch for a known hot batch shape.
§Errors
Returns PipelineError::Backend when OOM prevents reserving the
requested capacity. Callers must handle the error; the old infallible
wrapper that silently returned empty scratch on failure has been removed.
Sourcepub fn batches(&self) -> &[OutputBuffers] ⓘ
pub fn batches(&self) -> &[OutputBuffers] ⓘ
Retained decoded output batches from the most recent dispatch.
Sourcepub fn batches_mut(&mut self) -> &mut Vec<OutputBuffers> ⓘ
pub fn batches_mut(&mut self) -> &mut Vec<OutputBuffers> ⓘ
Mutable retained output batches for callers that want to drain or decode in place after dispatch.
Sourcepub fn resource_capacity(&self) -> usize
pub fn resource_capacity(&self) -> usize
Current retained resource-row capacity.
Sourcepub fn batch_capacity(&self) -> usize
pub fn batch_capacity(&self) -> usize
Current retained batch-row capacity.