# llama.cpp — inkling branch (Inkling-2-Mini on dual ROCm) Source tree of the local `inkling` branch at commit `e16722c55` ("model: split looped layers by physical weight-holding layers"). This is the tree used for build 3535. No binaries are included — build your own from this source. The purpose of this branch: run the Inkling-2-Mini looped model with a DSpark draft, on one or two ROCm GPUs, with long context and on-device prompt checkpoints. ## What makes this branch different ### 1. Physical-layer split (the main change, `e16722c55`) The Inkling-2-loop model exposes 48 *logical* layer slots, but only 24 weight-holding physical layers (plus the output layer = 25 real units of weights). The layer split now counts the physical layers, and alias slots 24..47 follow the device of the physical layer they reuse. This is what makes `--split-mode layer --tensor-split` work with dual GPUs on the looped model: - `-ts 0.72,0.28` → ROCm0 gets physical layers 0..17 (18/25 units) plus the loop slots 24..47 that alias them; ROCm1 gets physical layers 18..23 + the output (7/25). - Validated (build 3535, RX 6800 + 6700 XT, 6k-prompt test, `-ctk q8_0 -ctv q5_0`, dspark draft, 132K ctx): prefill **401.7 t/s at `-ub 128`**, **559.5 t/s at `-ub 256`** (3 graph splits). `-ts 0.5,0.5` splits the loop core across both GPUs instead (7 graph splits, ~391.7 t/s prefill / 24.4 t/s decode in the same test) — the 0.72/0.28 split is the faster one. Without this split the layer split counted the 48 logical slots, so the split point landed in the middle of a loop pass and the dual-GPU layout could not be expressed. ### 2. DSpark checkpoint device-buffer fixes (`51cb9044f`, `a89b2587d`) Two local fixes in `llama_io_write_device::finish()` (`src/llama-context.cpp`) for on-device prompt-checkpoint saves (used with `--ctx-checkpoints`): - grow the device checkpoint buffer with a fresh allocation when the new tensor layout does not fit, instead of re-packing in place — re-pack previously hit a hard `GGML_ABORT` in `ggml_tallocr_alloc` at long prompts (e.g. crash at ~22K prompt tokens); - the fit-check now sums **padded** per-tensor sizes (mirroring `ggml_tallocr_alloc` exactly) rather than raw sizes, so the fresh-alloc path is taken exactly when needed. These are still required: upstream chooses re-pack vs fresh-alloc from the raw tensor-size sum alone and lacks the padding-aware check. ### 3. Base: the `eaman` branch The branch sits on top of the local `eaman` branch (`1fdae6cb7`), which itself is upstream `115deee8e` plus the cumulative Eaman patch (ROCm fit/pipeline improvements, speculative features, HIP VEC control, ...). For Inkling runs only the fit-related parts matter (e.g. `--fit-target`, and the ROCm fit headroom that long-context ROCm runs rely on); the rest is carried along. Eaman patch details are documented separately and are out of scope here. ## Build Reference toolchain: GNU 16.2.0, ROCm 10.0, `gfx1030;gfx1031` targets: ```sh cmake -B build -DGGML_HIP=ON -DGGML_VULKAN=ON -DCMAKE_BUILD_TYPE=Release cmake --build build --config Release -j ``` `llama-server`, `libllama.so`, `libggml-hip.so` and `libggml-vulkan.so` land in `build/bin`. Set `LD_LIBRARY_PATH` to that directory (the launchers below point at a prebuilt `bin_vulkan`; repoint them at your `build/bin`). ## Launchers Two reference launchers are included: - **`inkling.sh`** — single GPU (ROCm0), Inkling-2-Mini + DSpark Q8_0 draft, `-c 175000`, `--fit-target 100`, `-ub 448`, DSpark + ngram-mod speculation, slot checkpoint save. - **`inkling.sh_dual`** — dual ROCm: `--device ROCm0,ROCm1 --split-mode layer --tensor-split 0.72,0.28`, `-c 210000`, `-ub 256`, `--checkpoint-min-step 4096 --ctx-checkpoints 16 --cache-ram 5000`, `--pipeline-parallel off`. Notes: - **`--pipeline-parallel` is a mainline flag**; the dual launcher sets it `off` for this model. - **`--fit off` in the dual launcher is deliberate**: the fitter does not measure the DSpark draft. If you re-enable `--fit`, use `--fit-target >= 1500` to leave room for it. - **Context ceiling (measured, dual launcher, `-ctk q8_0 -ctv q5_0` + dspark draft):** 132K → ~1.67 GiB free on ROCm0; 160K → ~1.00 GiB free (practical ceiling); 192K → ~0.22 GiB free (too tight). **Prefill/ubatch tradeoff at 132K:** `-ub 128` ~390 t/s / ~1.78 GiB free; `-ub 256` ~560 t/s / ~1.21 GiB free (default); `-ub 384` ~609 t/s / ~0.64 GiB free; `-ub 512` OOMs at 132K (needs `-c` ~120000 for ~684 t/s). - **Draft pairing:** use the DSpark GGUF with vocab 200058 (`dspark-Inkling-2-Mini-Q8_0.gguf` from the "dflash-unreadable" build) with the IQ4_NL (or Q4_K_XL) main model. The padded 201024-vocab sibling fails to load (`markov_w1 ... expected 256, 200058, got 256, 201024`). - **Model files are not part of this archive**; adjust the `-m` / `-md` paths. Main model: single-GPU launcher uses `Inkling-2-Mini-GSQ-RCO-IQ3_S.gguf` from , dual-GPU launcher uses `Inkling-2-Mini-IQ4_NL.gguf` from . Legacy unsloth inkling2 GGUFs are not loadable by this build. ## Provenance - Branch tip: `e16722c55` on top of `eaman` `1fdae6cb7` (upstream `115deee8e`). - Maintainer: eaman.