← [ ABORT TO HUD ]
SEQ. 1
SEQ. 2

Building a 7,800+ tok/s LLM Engine in Rust + CUDA

🔥 From-Scratch LLM Engine Architecture (The Void LLM Architecture)20 min150 BASE XP⌨ HANDS-ON LAB

The Void LLM Architecture

Void LLM is an independent transformer training and inference engine built from scratch in pure Rust with custom CUDA C++ kernels. Void proves that decoupling LLM runtimes from massive Python dependency stacks (PyTorch, Triton, LibTorch) unlocks 7,800+ tokens/sec throughput on consumer and enterprise GPUs.

Zero-Copy Tensor Loading via memmap2

Rather than reading gigabytes of weights into host RAM and serializing them into tensors, Void uses memory-mapped I/O (memmap2). The OS pages weights directly from the NVMe drive into the CUDA host-pinned staging buffer:

use memmap2::MmapOptions;
use std::fs::File;

pub struct SafetensorsLoader {
    mmap: memmap2::Mmap,
}

impl SafetensorsLoader {
    pub fn open(path: &str) -> std::io::Result {
        let file = File::open(path)?;
        let mmap = unsafe { MmapOptions::new().map(&file)? };
        Ok(Self { mmap })
    }

    pub fn get_tensor_slice(&self, offset: usize, len: usize) -> Result<&[f32], &'static str> {
        let byte_slice = &self.mmap[offset..offset + len * 4];
        let ptr = byte_slice.as_ptr();
        // Strict Invariant: f32 pointer dereference requires 4-byte alignment
        if ptr as usize % std::mem::align_of::() != 0 {
            return Err("Tensor data is not 4-byte aligned for f32 slice");
        }
        unsafe {
            Ok(std::slice::from_raw_parts(ptr as *const f32, len))
        }
    }
}
⌨ HANDS-ON LABInspect Safetensors Header & Mmap Tensor Weights
⭐ +180 XP

Parse 8-byte Safetensors length prefix, inspect tensor offsets, and map weights into zero-copy f32 slices.

1Check Safetensors binary parser and alignment validation.
2Benchmark Void LLM token generation throughput across batch size 1.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 2 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 1
What eliminates cold-start latency when loading 70B parameter models using memmap2 in Rust?
The kernel maps file pages into virtual memory instantaneously without reading the entire file from disk upfront
The GPU executes weights directly from the NVMe controller via Wi-Fi
The weights are compressed into a single 32-bit floating point number
Rust eliminates the weights completely using constant folding