pub struct UringMegakernelPump<'a> { /* private fields */ }Expand description
Compose an AsyncUringStream with the megakernel ring-slot writer so the
host can drive the compatibility mapped-read ingest loop with one compact
pump. Native NVMe → BAR1 ingest is owned by
super::driver::NvmeGpuIngestDriver::new_gpudirect.
Implementations§
Source§impl<'a> UringMegakernelPump<'a>
impl<'a> UringMegakernelPump<'a>
Sourcepub fn new(stream: AsyncUringStream<'a>, chunk_bytes: u32) -> Self
pub fn new(stream: AsyncUringStream<'a>, chunk_bytes: u32) -> Self
Construct a pump bound to an existing stream. chunk_bytes
is the fixed read size - every call to submit_file_scan
must request exactly this many bytes.
The pump takes ownership of stream; reclaim it via
into_stream on shutdown.
Sourcepub fn into_stream(self) -> AsyncUringStream<'a>
pub fn into_stream(self) -> AsyncUringStream<'a>
Release the underlying stream for explicit shutdown sequences.
Sourcepub unsafe fn submit_file_scan(
&mut self,
fd: i32,
file_offset: u64,
len: u32,
chunk_idx: u32,
slot_idx: u32,
tenant_id: u32,
opcode: u32,
args: [u32; 3],
) -> Result<(), PipelineError>
pub unsafe fn submit_file_scan( &mut self, fd: i32, file_offset: u64, len: u32, chunk_idx: u32, slot_idx: u32, tenant_id: u32, opcode: u32, args: [u32; 3], ) -> Result<(), PipelineError>
Submit one file-scan read. Destination inside the GPU
buffer is chunk_idx * self.chunk_bytes.
On CQE completion, drain_into_ring
publishes a megakernel ring slot at slot_idx with
tenant_id, opcode, and args. The three args fit in the
fixed 3-word prefix of a megakernel slot; callers with more
payload use the packed-slot opcode (PACKED_SLOT) out-of-
band.
§Errors
PipelineError::QueueFullif the io_uring SQ or the GPU-side destination buffer is out of room.- Arbitrary
PipelineErrorvariants from the underlying syscall wrappers.
§Safety
fd must be an open file descriptor the pump’s io_uring
ring can read from. The caller retains ownership - the pump
does not close it. len must equal self.chunk_bytes;
mismatches are rejected with PipelineError::QueueFull.
Sourcepub fn drain_into_ring(
&mut self,
ring_bytes: &mut [u8],
) -> Result<u32, PipelineError>
pub fn drain_into_ring( &mut self, ring_bytes: &mut [u8], ) -> Result<u32, PipelineError>
Drain completions + publish corresponding ring slots into
ring_bytes.
Returns the number of completions processed (including
those that surfaced errors - those still advance the
inflight counter). The first error is returned via
Err(PipelineError::IoUringSyscall); subsequent completions
keep draining so the ring does not overflow.
§Errors
PipelineError::IoUringSyscallon the first failed CQE.PipelineError::QueueFullifMegakernel::publish_slotrejects the published slot (e.g.,slot_idxstill in-flight on the GPU side - caller must wait for the kernel to drain).
Sourcepub fn observe_epoch(&self, control_bytes: &[u8]) -> u32
pub fn observe_epoch(&self, control_bytes: &[u8]) -> u32
Host-visible epoch field from the megakernel control buffer.
The kernel atomic-adds this on every BATCH_FENCE; callers
observe forward progress by polling the field between
dispatches.