← All research notes
NOTE 07 · SYSTEMS & GPU KERNELS 7 min read

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.

ABSTRACT

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.

+41.6%
Inkling-2 Prefill
415 / 783
Inkling conv / struct t/s
−11.2 GiB
Inkling 131K×4 VRAM
−5.7 GiB
Qwen 27B Live VRAM
INKLING-2-MINI (LOOPED MOE · SPEC 8) Prefill pp16384 19,455 t/s (+41.6%) Decode conv / struct 415 / 783 (+17%) 32K Steady Decode VRAM 15.5 GiB (-4.1 GiB) 131K×4 Live Serve VRAM 16.9 GiB (-11.2 GiB) QWEN3.8-27B (GDN+GQA · SPEC 16) Decode conv (tok/s) 267.3 (+7.4%) Decode struct (tok/s) 867.3 (+4.8%) Decode prose (tok/s) 219.0 (+8.5%) 196K (8×24K) Live VRAM 22.8 GiB (-5.7 GiB)
Figure 1. Verified RTX 5090 (600 W, CUDA 13.0) improvements comparing deployed Basalt v0.5.5 (gray) against our optimized Blackwell build (colored).

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:

  1. 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=1 jumped from 3.99 ms to 4.64 ms). Profiling pinpointed the cause: changing launch_splits() from / 128 to / 64 pushed 1024-key sliding windows past kClusterSplits = 8, silently disabling the fused single-pass attention kernel across all 40 sliding-window visits. Splitting scalar vs. MMA split counts restored attn_fused_kernel immediately.
  2. 128-bit (int4) warp-per-row q8_planes MMVQ + Blackwell PDL: For Inkling-2-Mini's dense projections (w.proj, w.out) across speculative widths ncols = 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.
  3. In-place q8_planes output head (200K vocab) + 128-bit DSpark rescore: Repacking the 489 MB Q8_0 lm_head in-place to aligned q8_planes at attach time and updating DSpark's exact-logit rescore to 128-bit q8p_dot pushed lm_head from 393 μs down to 292-311 μs, roughly 1.6 TB/s, saturating ~90% of GDDR7 bandwidth.
  4. Hardware PTX tanh.approx.f32 on SwiGLU softcap: Inkling-2-Mini's softcapped SwiGLU runs 48 times per forward pass and previously called full-precision software tanhf() and expf() with two float divisions per element. Precomputing reciprocals and using Blackwell's single-cycle MUFU.TANH (tanh.approx.f32) plus __expf eliminated the transcendental bottleneck while passing kernel parity cleanly.
  5. 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/layer vs. 90 μs/layer at 6 tokens) while falling back to MMQ during prefill. Converting layers 20..23 to NVFP4 blocks on load via nvfp4p::from_q8 → to_blocks reclaimed 1.95 GiB VRAM, cut t=8 verify latency from 9.86 ms to 8.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, plus kv8 prompt 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 MiB to 0.28 MiB. Allocating exact-sized NVFP4 buffers in DsparkWeights::finish() and freeing the oversized Q8_0 load buffers reclaimed another ~140 MiB and removed 21 device-to-device copies at startup.
  • Always-on CUDA VMM ElasticArray KV 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. Enabling ElasticArray unconditionally (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 by wnorm() before the selector GEMM. Routing prod_swiglu() directly into b.hq and reusing the packed buffer eliminated 6 kernel launches and 5 intermediate memory round-trips per window.
  • Fast-math on GDN, GQA, window_gemm, and logprobs: Enabling --use_fast_math on 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 passing gdn_seg_split_parity (bitwise) and dense_ops_parity.

5. Complete verified benchmark table

Model & MetricDeployed v0.5.5Optimized FinalDelta
Inkling-2-Mini · pp16384 prefill13,739 tok/s19,455 tok/s (peak 19,511)+41.6%
Inkling-2-Mini · tg conv (--spec 8)354.2 tok/s415.2 tok/s (warm 422.9)+17.2%
Inkling-2-Mini · tg struct (--spec 8)671.1 tok/s782.8 tok/s (peak 795.8)+16.6%
Inkling-2-Mini · tg prose (--spec 8)302.7 tok/s330.5 tok/s+9.2%
Inkling-2-Mini · 32K / 1-slot steady VRAM20,106 MiB15,907 MiB−4.10 GiB
Inkling-2-Mini · 131K / 4-slot live VRAM~28,500 MiB17,279 MiB−11.2 GiB
Qwen3.8-27B · tg conv (--kv int8 --spec 16)248.9 tok/s267.3 tok/s+7.4%
Qwen3.8-27B · tg struct (--kv int8 --spec 16)827.9 tok/s867.3 tok/s (peak 871.2)+4.8%
Qwen3.8-27B · tg prose (--kv int8 --spec 16)201.8 tok/s219.0 tok/s+8.5%
Qwen3.8-27B · 196K (8×24K) live VRAM29,232 MiB23,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-block router_select_plan: Regressed t=8 verify latency from 9.11 ms to 10.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 struct from 727 to 572 tok/s (t=8: 9.11 → 11.68 ms) because unrolling row_dot_multi 8× 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.

Try the optimized models live

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.