pub struct FileBatch { /* private fields */ }Expand description
Persistent device-owned batch buffers.
Implementations§
Source§impl FileBatch
impl FileBatch
Sourcepub fn upload(
device_queue: Arc<(Device, Queue)>,
files: &[BatchFile],
rule_count: u32,
hit_capacity: u32,
) -> Result<Self, PipelineError>
pub fn upload( device_queue: Arc<(Device, Queue)>, files: &[BatchFile], rule_count: u32, hit_capacity: u32, ) -> Result<Self, PipelineError>
Upload a new multi-file batch into persistent GPU buffers.
§Errors
Returns PipelineError::QueueFull when the batch exceeds the
current u32 table limits or the work queue would overflow.
Sourcepub fn refresh(
&mut self,
files: &[BatchFile],
rule_count: u32,
hit_capacity: u32,
) -> Result<(), PipelineError>
pub fn refresh( &mut self, files: &[BatchFile], rule_count: u32, hit_capacity: u32, ) -> Result<(), PipelineError>
Refresh this batch in place, reusing host staging vectors and resident GPU buffers whenever the new batch fits existing allocations.
§Errors
Returns PipelineError::QueueFull before mutating the batch when the
requested file/rule fanout cannot fit the megakernel batch protocol.
Sourcepub fn refresh_with_report(
&mut self,
files: &[BatchFile],
rule_count: u32,
hit_capacity: u32,
) -> Result<FileBatchRefreshReport, PipelineError>
pub fn refresh_with_report( &mut self, files: &[BatchFile], rule_count: u32, hit_capacity: u32, ) -> Result<FileBatchRefreshReport, PipelineError>
Refresh this batch in place and return allocation/transfer telemetry.
§Errors
Returns PipelineError::QueueFull before mutating the batch when the
requested file/rule fanout cannot fit the megakernel batch protocol.
Sourcepub fn reset_queue_state(&self) -> Result<(), PipelineError>
pub fn reset_queue_state(&self) -> Result<(), PipelineError>
Reset the persistent queue indices before another dispatch.
§Errors
Returns PipelineError::Backend when the queue-state upload fails.
Sourcepub fn set_segmentation(
&mut self,
seg_len: u32,
overlap: u32,
) -> Result<(), PipelineError>
pub fn set_segmentation( &mut self, seg_len: u32, overlap: u32, ) -> Result<(), PipelineError>
Re-tile this batch at a new window geometry: rebuild the segments table
(each file split into ceil(len / seg_len) windows, files shorter than
seg_len staying whole), grow/rewrite the resident segments buffer, and
update queue_len = segment_count * rule_count + the queue-state header so
the next dispatch claims the new work space. seg_len = u32::MAX restores
one segment per file (the legacy whole-file scan).
SOUNDNESS CONTRACT: overlap MUST be at least
segmentation::catalog_sync_overlap over the rules that will scan this
batch. With a shorter warm-up a window can reconstruct the wrong DFA state
at emit_start and drop or fabricate matches. The geometry is the
caller’s decision (it owns the rule catalog); this method enforces only the
structural invariant seg_len > 0.
§Errors
Returns PipelineError::QueueFull when seg_len == 0 or the new work
queue overflows the device claim protocol, or PipelineError::Backend
when the buffer upload fails.
Sourcepub fn file_count(&self) -> usize
pub fn file_count(&self) -> usize
Number of files in the batch.
Sourcepub const fn hit_capacity(&self) -> u32
pub const fn hit_capacity(&self) -> u32
Sparse-hit capacity.
Sourcepub fn device_queue(&self) -> Arc<(Device, Queue)>
pub fn device_queue(&self) -> Arc<(Device, Queue)>
Device queue used for every buffer in this batch.
Sourcepub const fn haystack(&self) -> &GpuBufferHandle
pub const fn haystack(&self) -> &GpuBufferHandle
Packed haystack buffer.
Sourcepub const fn offsets(&self) -> &GpuBufferHandle
pub const fn offsets(&self) -> &GpuBufferHandle
Prefix-sum offset table. Length = file_count + 1.
Sourcepub const fn metadata(&self) -> &GpuBufferHandle
pub const fn metadata(&self) -> &GpuBufferHandle
Per-file metadata table.
Sourcepub const fn segments(&self) -> &GpuBufferHandle
pub const fn segments(&self) -> &GpuBufferHandle
Flat segment table (segment_count * SEGMENT_WORDS u32s). The device
claim decode reads row seg_idx = claim / rule_count to derive the
window (file_idx, scan_start, emit_start, emit_end).
Sourcepub const fn queue_state(&self) -> &GpuBufferHandle
pub const fn queue_state(&self) -> &GpuBufferHandle
Queue-state/control words.
Sourcepub const fn hit_ring(&self) -> &GpuBufferHandle
pub const fn hit_ring(&self) -> &GpuBufferHandle
Sparse output ring.
Sourcepub fn host_metadata(&self) -> &[FileMetadata]
pub fn host_metadata(&self) -> &[FileMetadata]
Host-side file metadata.
Sourcepub fn host_offsets(&self) -> &[u32]
pub fn host_offsets(&self) -> &[u32]
Host-side prefix offsets.
Sourcepub fn host_work_items(&self) -> &[WorkTriple]
pub fn host_work_items(&self) -> &[WorkTriple]
Host-side dense work queue.
Dense batches derive work items on-device, so there are no host materialized triples to expose.