← lab

Inkling 2 Mini on AMD and Jetson Orin NX

Running Inkling 2 Mini locally as a server-side MCP and vision appliance, chasing ROCm vs. Vulkan speedups on an RX 6900 XT, and squeezing a 16 GB Jetson Orin NX.

ongoingstarted updated

Why

I wanted to see how far I could push Inkling 2 Mini on my own hardware—both on Chonkster (a desktop with an AMD RX 6900 XT) and on an AI Key (a 16 GB Jetson Orin NX)—and turn llama-server into something genuinely useful on its own: a self-contained appliance that can both answer interactive chats with MCP tools and react to incoming camera/alarm webhooks in the background, without needing a separate orchestrator sitting in front of it.

What I built on top of llama.cpp

Rather than wrapping llama-server in a pile of Python scripts, I forked llama.cpp (ssmcpchat, currently private) and added the missing pieces directly in C++:

  • Media-aware MCP servers: A tool call normally only carries the JSON arguments the model wrote, so an MCP server can’t touch the image the model is looking at, and image/audio results get dropped. Opting an MCP server in with "media": true shares the chat’s media as local files in params._meta["llama.cpp/media"] (stored in a capped temp dir: 128 items / 256 MB). Images and audio returned by tools flow back as inline data: URIs with [media id: ...] handles so the model can pass them to later tool calls or embed them straight in its reply.
  • Built-in server tools: Added view_image (loads a JPEG/PNG/WebP/GIF up to 8 MB, registers it in the media store, and shows it to the vision model) and append_file (append-only logging so autonomous runs can write notes without overwriting history). Also fixed /tools so server-only fields (cwd, runtime, resp_type) don’t leak into MCP tool arguments.
  • Server-side agent runs (--agent-config): Webhook triggers (POST /v1/agent/trigger/<name>/<secret>) and interval triggers run the model autonomously through the server’s own /v1/chat/completions. Before anything even hits the queue, every webhook splits inline base64 images out to evidence/YYYY-MM-DD/ and appends a raw summary line to events/raw/YYYY-MM-DD.log, so events are recorded regardless of what the model does. Runs are queued newest-first, coalesced by key, constrained by per-trigger tool allow-lists and limits (turns, tool calls, images, tokens, seconds), and yield cleanly to interactive chat—a chat using tools holds a lease so no background run cuts in between tool calls.
  • Always-warm system prompts & slot pinning: On startup, the server warms slot 0 with the last chat’s saved prefix (system messages, tool definitions, and reasoning effort) and slot 1 with each webhook trigger’s prefix. Interactive chats are pinned to slot 0 and background runs to the last slot (n_slots - 1), so a heavy multi-image run can’t evict the chat’s KV cache by LRU.
  • Cutting wasted turns on the Orin: Added attach and seed_view (inject the webhook’s thumbnail or a pre-executed view_image call on turn 0 instead of spending a whole model turn asking to view it), finish_after_tools (stop once the goal tool succeeds instead of generating a closing reply), skip_if_all_noted (skip interval runs with zero model calls when every raw event already has a note), and replaced std::regex on base64 lines after a 75 KB thumbnail blew the stack on aarch64.

Chonkster (RX 6900 XT): ROCm boosts vs. Vulkan Flash Attention

With the appliance working, I started chasing inference speed on Chonkster. Because Inkling 2 Mini doesn’t quite fit all its expert layers into the 6900 XT’s 16 GB of VRAM (5 expert layers stay in system RAM), generation speed was stuck around 17 t/s on plain llama.cpp.

I took stew675/llama-cpp-rdna-boosts for a spin (plus the two upstream Inkling 2 Mini commits so it could load the model), and then tested the freshly merged Vulkan Flash Attention compact-bias fix (#32898) on top of mainline llama.cpp:

Setup (Chonkster, RX 6900 XT) Prompt 512 Prompt 2048 Generation Notes
Plain llama.cpp (ROCm) 621 t/s 585 t/s 17.0 t/s 5 expert layers on CPU
ROCm + llama-cpp-rdna-boosts 742 t/s (925 w/ larger batch) 683 t/s 26.6 t/s +56% gen, but OOMs at 16K prompts
Mainline Vulkan + FA PR #32898 48 t/s — 9.6 t/s Flat to 32K & <1 GB attention workspace, but NVFP4 spills 11 GB to CPU

That Vulkan result had a great twist: the Flash Attention fix itself worked as advertised—speed stayed flat all the way out to 32K tokens and attention working memory shrank to under 1 GB. The culprit was the GGUF file itself. Most of Inkling 2 Mini’s expert weights use a 4-bit float format (NVFP4) that RADV Vulkan can’t run on the GPU yet, so 11 GB spilled onto the CPU while the GPU idled. ROCm runs NVFP4 on the GPU, which is why it stayed fast—but without the compact indexed-bias Flash Attention fix, the ROCm boosted build ran out of VRAM at 16K-token prompts.

Porting indexed-bias Flash Attention onto ROCm + fair non-NVFP4 Vulkan test

Mainline llama.cpp landed the full indexed-bias Flash Attention stack—#32740 (GGML compact bias), #33053 (Inkling 2 graph), #33063 (CUDA + HIP Flash Attention with indexed bias), and #32898 (Vulkan). I ported #32740/#33053/#33063 onto stew675/llama-cpp-rdna-boosts in ssmcpchat branch rdna-boosts-fa (disambiguating FLASH_ATTN_EXT src[6..8] V3 derived mask vs src[6..7] indexed bias, verified 41/41 on ROCm0 test-backend-ops -o FLASH_ATTN_EXT -p n_bins), and also benchmarked mainline llama.cpp ROCm (6d8a8886f, with #33060 + #33063) on UD-IQ4_XS (14.64 GiB, -ngl 99 -fa on -ncmoe 5 -ctk q8_0 -ctv q8_0 -t 16):

Setup (UD-IQ4_XS, -ncmoe 5) pp512 pp2048 tg128 d16384 d32768 Notes
rdna-boosts-fa (-ub 256) 783.3 t/s 764.7 t/s 27.3 t/s 673.6 / 26.4 t/s 605.7 / 25.8 t/s Zero OOMs all the way to 32K (previously OOMed at 16K)
rdna-boosts-fa (-ub 512) 1009.0 t/s 966.3 t/s 27.3 t/s OOM — d4096 = 931.0 / 26.7 t/s; OOMs at d16384 in q8_1_cache_get
Mainline ROCm (6d8a8886f, -ub 512) 997.5 t/s 968.9 t/s 24.2 t/s 658.0 / 24.2 t/s 439.9 / 26.1 t/s No OOM at 32K

For a fair 100% GPU non-NVFP4 Vulkan comparison: every quantized file in Mainline_Support except 27.8 GB Q8_0 still had 11–40 NVFP4 tensors, so I repacked Inkling-2-Mini-hyb-D8.gguf with repack_orin.cpp (q4_0 f16, 9.15 GiB, zero NVFP4, -ncmoe 0 100% GPU offload)—the exact same layout the Orin NX runs:

Setup (hyb-D8-q40, -ncmoe 0, -ub 512) pp512 pp2048 tg128 Notes
Mainline ROCm (6d8a8886f) 1415.7 t/s 1294.1 t/s 27.0 t/s -ub 256: 1084.5 / 1044.4 / 26.7 t/s
rdna-boosts-fa ROCm (018918af0) 1130.5 t/s 1077.5 t/s 28.3 t/s -ub 256: 893.8 / 868.8 / 28.3 t/s
Mainline Vulkan (4c7344447, RADV) 101.6 t/s 100.5 t/s 11.8 t/s 100% Vulkan0 offload (matrix cores: none), flat to 32K (d32768 = 95.3 / 11.5 t/s)

Even with zero NVFP4 tensors and 100% GPU offload, RADV on the RX 6900 XT trails ROCm by ~14x on prefill and ~2.4x on generation.

The Jetson Orin NX (“AI Key”)

The Orin NX runs ssmcpchat in 16 GB of unified memory with 2 slots (-np 2), vision (mmproj), CUDA_ARCHITECTURES=87, CUDA graphs, no VMM, and Inkling-2-Mini-hyb-D8-orin-q40.gguf (9.15 GiB, converting NVFP4 -> Q4_0 and BF16 control/gate tensors to F16 via repack_orin.cpp).

Rebasing onto mainline (#33060 fused kernels + #33063 indexed-bias CUDA Flash Attention) surfaced two bottlenecks:

  1. Unpatched mainline regressed decode (13.22 -> 11.90 t/s): #33060’s loop_ctrl fusion only accepted F32 weights and skipped our F16-repacked loop_*_ctrl_* tensors. Templating loop_ctrl in fusion.cu/inkling2.cu on float/half (verified 4/4 on CUDA0 test-backend-ops -o LOOP_CTRL) recovered decode.
  2. Prefill missed Ampere Tensor Core MMA: Mainline #33063 did not yet enable sm_87 Tensor Core MMA prefill with indexed bias. Applying PR #33193 (fattn-mma-f16.cuh + fattn.cu, verified 54/54 on CUDA0 test-backend-ops -o FLASH_ATTN_EXT -p n_bins) plus integer UE4M3 scale decode (__CUDA_ARCH__ < 890) unlocked major prefill speedups across context lengths:
Setup (Orin NX, hyb-D8-q40, -ngl 99 -fa on -ctk q8_0 -ctv q8_0) pp512 pp2048 tg128 d4096 d16384
Baseline opt-orin (d2bbbc9da, -ub 256) 136.0 t/s 127.3 t/s 13.2 t/s 117.8 / 12.1 t/s 97.6 / 10.9 t/s
Unpatched mainline (6d8a888, -ub 256) 137.4 t/s 128.2 t/s 11.9 t/s 118.3 / 11.1 t/s 98.5 / 10.2 t/s
Mainline + #33193 + F16 loop_ctrl + UE4M3 (-ub 256) 140.7 t/s 135.0 t/s 12.8 t/s 130.6 / 11.9 t/s 121.2 / 10.9 t/s
Mainline + #33193 + F16 loop_ctrl + UE4M3 (-ub 512) 170.2 t/s (+25%) 161.8 t/s (+27%) 12.8 t/s 154.3 / 11.9 t/s (+31% pp) 141.3 / 10.9 t/s (+45% pp)

Additional Orin tuning findings:

  • NVFP4 vs. Q4_0 on Ampere: On the same optimized build, Inkling-2-Mini-hyb-D8.gguf (NVFP4 + integer UE4M3) ran 160.3 / 11.0 t/s (-ub 512), confirming repacking NVFP4 -> Q4_0 delivers a +16% decode win (12.8 vs. 11.0 t/s) on sm_87.
  • Unified-memory & KV cache: -lm none (no-mmap) had zero speed penalty (140.7 / 135.1 / 12.8 t/s) while avoiding double-caching weights in 16 GB unified RAM; -ctk q4_0 -ctv q4_0 matched q8_0 KV speed (d16384 = 140.9 / 10.9 t/s) at half the KV memory footprint.
  • DSpark speculative decoding: Mainline #32218 rejected our local dspark-Inkling-2-Mini-Q8_0.gguf (markov_w1.weight shape 256, 201024 padded vocab vs. expected 256, 200058), so testing DSpark waits on a matching non-padded draft GGUF.

All 18 ssmcpchat + Orin server-agent commits and the verified Orin CUDA patch are now rebased onto mainline master in ssmcpchat branch ssmcpchat-master.

Who built it

Claude Opus 5.5 helped build the server-side MCP media store and autonomous agent loop in ssmcpchat, Rack ran the Chonkster benchmarks, and Neon dug into the Orin NX optimization path and helped port the mainline Flash Attention patches onto the RDNA boosts fork.