Blackwell Silicon Engineering: Accelerating Inkling-2-Mini and Qwen3.8-27B on a Single RTX 5090
Serving frontier looped MoE and hybrid state-space models on a single 32 GiB workstation GPU leaves no room for wasted bytes or under-occupied warps. Here is how seven roofline-guided CUDA 13 iterations cut live VRAM by up to 11.2 GiB while pushing Inkling-2-Mini to 415-783 tok/s and Qwen3.8-27B to 267-867 tok/s.
We profile and iteratively optimize our live Basalt inference engine on an NVIDIA GeForce RTX 5090 (Blackwell sm_120, 32,607 MiB GDDR7, 170 SMs, 1,792 GB/s, CUDA 13.0) across both production models powering Space Chat: Inkling-2-Mini (26.4B / 3.5B-active looped MoE with DSpark speculative drafting) and Qwen3.8-27B (64-layer dense hybrid GDN/GQA with DFlash 2 block drafting). Through targeted kernel fixes, 128-bit warp-per-row q8_planes MMVQ with Programmatic Dependent Launch (PDL), hardware PTX tanh.approx.f32 softcapping, on-load NVFP4 re-quantization of Q8_0 coda experts, and CUDA VMM demand-backed ElasticArray KV caches paired with on-demand prefill arenas, we achieve +41.6% prefill (19,455 tok/s), +17.2% conversational decode (415.2 tok/s), and −4.1 to −11.2 GiB VRAM on Inkling-2-Mini, alongside +7.4%-8.5% decode and −5.7 GiB live production VRAM (29,232 → 23,387 MiB across 8 parallel slots) on Qwen3.8-27B, with zero greedy oracle regressions.
1. Two very different architectures on one 32 GiB card
Our live Space AI workstation node serves two complementary open models on a single RTX 5090:
- Inkling-2-Mini (
Inkling-2-Mini-NVFP4-DQ8.basalt): a 26.4B-parameter / 3.5B-active looped Mixture-of-Experts transformer (6 prelude layers, 12 core layers looped 3×, and 4 coda layers = 48 visits per token, 128 routed experts top-8) paired with a 3-layer DSpark drafter. - Qwen3.8-27B (
Qwen3.8-27B-QUASAR-NVFP4.basalt): a 64-layer dense hybrid Gated DeltaNet (48 GDN layers) + Grouped-Query Attention (16 GQA layers) architecture paired with a 5-layer DFlash 2 block drafter.
Before optimization, our deployed Basalt v0.5.5 runtime left Qwen3.8-27B sitting at 29,232 MiB out of 32,607 MiB in its 8-slot production configuration (leaving barely 3 GiB of headroom for dynamic vision encoding or long contexts), while Inkling-2-Mini suffered from both idle prefill/KV memory bloat and subtle decode kernel bottlenecks across its 48 per-token visits.
2. Finding every microsecond in Inkling-2-Mini
We built Basalt directly from source with a local CUDA 13.0.88 toolchain targeting sm_120 and instrumented every stage of Inkling-2-Mini's 48-visit decode graph with per-stage CUDA event timers. The roofline immediately exposed where time and bandwidth were going:
- Fixing a sliding-window attention regression in upstream HEAD: Upgrading from v0.5.5 to upstream HEAD boosted prefill by +35%, but regressed short-window decode (
t=1jumped from3.99 msto4.64 ms). Profiling pinpointed the cause: changinglaunch_splits()from/ 128to/ 64pushed 1024-key sliding windows pastkClusterSplits = 8, silently disabling the fused single-pass attention kernel across all 40 sliding-window visits. Splitting scalar vs. MMA split counts restoredattn_fused_kernelimmediately. - 128-bit (
int4) warp-per-rowq8_planesMMVQ + Blackwell PDL: For Inkling-2-Mini's dense projections (w.proj,w.out) across speculative widthsncols = 1..8, we replaced the shared-memory reduction path with a zero-smem, zero-__syncthreads()4-rows-per-block warp-per-row kernel (native_q8p_w4) using 128-bit vectorized loads and Blackwell Programmatic Dependent Launch (pdl_launch_dependents()) to overlap next-kernel weight prefetch. - In-place
q8_planesoutput head (200K vocab) + 128-bit DSpark rescore: Repacking the 489 MB Q8_0lm_headin-place to alignedq8_planesat attach time and updating DSpark's exact-logit rescore to 128-bitq8p_dotpushedlm_headfrom393 μsdown to292-311 μs, roughly 1.6 TB/s, saturating ~90% of GDDR7 bandwidth. - Hardware PTX
tanh.approx.f32on SwiGLU softcap: Inkling-2-Mini's softcapped SwiGLU runs 48 times per forward pass and previously called full-precision softwaretanhf()andexpf()with two float divisions per element. Precomputing reciprocals and using Blackwell's single-cycleMUFU.TANH(tanh.approx.f32) plus__expfeliminated the transcendental bottleneck while passing kernel parity cleanly. - On-load NVFP4 re-quantization of coda experts (layers 20..23): On Inkling-2-Mini, layers 0..19 are NVFP4 (547 MiB/layer), while the four non-looped coda layers 20..23 ship as Q8_0 (1,033 MiB/layer), consuming 27.4% of all expert VRAM and running 2.0× slower in decode (
173 μs/layervs.90 μs/layerat 6 tokens) while falling back to MMQ during prefill. Converting layers 20..23 to NVFP4 blocks on load vianvfp4p::from_q8→to_blocksreclaimed 1.95 GiB VRAM, cutt=8verify latency from9.86 msto8.67 ms, enabled FP4 tensor-core prefill across all 24 layers, and kept greedy token sequences intact.
3. Zero-loss VRAM diet: reclaiming 4-11 GiB without touching precision
Memory profiling revealed that both engines were pinning gigabytes of permanently idle VRAM:
- On-demand prefill arenas: Both Inkling-2-Mini (
Prompt::lane().mem, ~800 MiB) and the dense stack (Model::pre_arena, ~1.1 GiB, pluskv8prompt buffers) allocated giant prompt workspaces once and held them indefinitely during decode. Wrapping prompt execution in an RAII acquire/release guard after stream synchronization drops steady-state prefill overhead to 0 MiB. - Prompt-owned drafter tap & exact-sized DSpark weights: Moving the 4096-row DSpark prompt tap into the transient prefill arena shrunk the permanent decode tap from
144 MiBto0.28 MiB. Allocating exact-sized NVFP4 buffers inDsparkWeights::finish()and freeing the oversized Q8_0 load buffers reclaimed another~140 MiBand removed 21 device-to-device copies at startup. - Always-on CUDA VMM
ElasticArrayKV caches: Previously, VMM demand-backed KV caches were only enabled on Inkling-2-Mini when experts spilled to RAM, and were absent from the dense stack altogether. EnablingElasticArrayunconditionally (reserving full virtual address ranges so CUDA graphs stay valid at fixed addresses, backing only 2K-4K cells initially in exact 2 MiB VMM granules, growing in 8K steps on demand, and trimming on conversation reset) slashed multi-slot production VRAM by ~11.2 GiB on Inkling-2-Mini (131K×4) and ~5.7 GiB on Qwen3.8-27B (196K across 8 slots).
4. Pushing Qwen3.8-27B closer to its bandwidth roofline
With ~16.5 GiB of active dense weights per pass, Qwen3.8-27B's single-token decode (10.8 ms) already sits near RTX 5090's practical HBM ceiling. Gains therefore came from trimming non-weight compute and DFlash 2 drafter overhead (1.94 ms/window):
- Fused DFlash 2 FFN epilogue & redundant pack removal:
block_draft_batch()previously wrote intermediate FP32 FFN activations and launched a separate BF16 pack kernel on every drafter layer, plus redundantly re-packed hidden states already packed bywnorm()before the selector GEMM. Routingprod_swiglu()directly intob.hqand reusing the packed buffer eliminated 6 kernel launches and 5 intermediate memory round-trips per window. - Fast-math on GDN, GQA,
window_gemm, andlogprobs: Enabling--use_fast_mathon the dense stack's transcendental-heavy CUDA kernels (48 GDN softplus/decay layers, 16 GQA layers, SwiGLU epilogues, and 1.97M-element draft logprob passes) boosted Qwen3.8-27B decode by +4.8% to +8.5% across all benchmarks while passinggdn_seg_split_parity(bitwise) anddense_ops_parity.
5. Complete verified benchmark table
| Model & Metric | Deployed v0.5.5 | Optimized Final | Delta |
|---|---|---|---|
Inkling-2-Mini · pp16384 prefill | 13,739 tok/s | 19,455 tok/s (peak 19,511) | +41.6% |
Inkling-2-Mini · tg conv (--spec 8) | 354.2 tok/s | 415.2 tok/s (warm 422.9) | +17.2% |
Inkling-2-Mini · tg struct (--spec 8) | 671.1 tok/s | 782.8 tok/s (peak 795.8) | +16.6% |
Inkling-2-Mini · tg prose (--spec 8) | 302.7 tok/s | 330.5 tok/s | +9.2% |
| Inkling-2-Mini · 32K / 1-slot steady VRAM | 20,106 MiB | 15,907 MiB | −4.10 GiB |
| Inkling-2-Mini · 131K / 4-slot live VRAM | ~28,500 MiB | 17,279 MiB | −11.2 GiB |
Qwen3.8-27B · tg conv (--kv int8 --spec 16) | 248.9 tok/s | 267.3 tok/s | +7.4% |
Qwen3.8-27B · tg struct (--kv int8 --spec 16) | 827.9 tok/s | 867.3 tok/s (peak 871.2) | +4.8% |
Qwen3.8-27B · tg prose (--kv int8 --spec 16) | 201.8 tok/s | 219.0 tok/s | +8.5% |
| Qwen3.8-27B · 196K (8×24K) live VRAM | 29,232 MiB | 23,387 MiB | −5.7 GiB |
6. What we tried and reverted (negative results matter)
Every optimization was gated by strict parity checks and apples-to-apples benchmarking. Two promising ideas failed on Blackwell silicon and were reverted immediately:
- Fused
router_logits_w4+ single-blockrouter_select_plan: Regressedt=8verify latency from9.11 msto10.05 ms. Launching only 32 blocks on a 170-SM RTX 5090 left 81% of SMs idle compared to 128 blocks, and serializing 8 tokens through 128 sequential__syncthreads()barriers destroyed token-level parallelism. - 4-gate + 4-up fused SwiGLU-softcap-Q8 kernel: Passed 0-failure bitwise parity, yet regressed
tg structfrom727to572 tok/s(t=8:9.11 → 11.68 ms) because unrollingrow_dot_multi8× exploded register pressure (spilling to local memory and dropping occupancy to 1 CTA/SM) while shrinking the grid 8× to just 36 CTAs.
On a 170-SM GPU, keeping CTA counts high and register files lean consistently beats aggressive inner-loop fusion.
7. Verification & live deployment
All optimizations are verified with unit parity suites (inkling2_dspark_parity: 0 failures, inkling2_kv_int8_parity: 0 mismatches, gdn_seg_split_parity: bitwise PASS, dense_ops_parity: PASS) and greedy speculative oracle checks (--spec 1 vs. --spec 8 on Inkling-2-Mini and --spec 1 vs. --spec 16 on Qwen3.8-27B: 0 picks differ from oracle). Both optimized models are now running live behind Space Chat and the Space AI Network.
Chat directly with our RTX 5090 deployment of Inkling-2-Mini and Qwen3.8-27B in Space Chat, or inspect live node telemetry on the Space AI Network.