Repository navigation
Conversation
|
For anyone wanting to test the full Inkling 2 dual-GPU stack together ( |
|
Closing as superseded by commit Saw that the compact Q8 dense trunk architecture submitted here on Nov 23 was integrated into v0.2.21 a few hours later via Because it was committed directly by the maintainer, the PR remained open without review, and once again the v0.2.21 release notes omitted contributor credits entirely. As detailed in #6811, having to reverse-engineer maintainer commits after each release to determine what was cherry-picked without credit or left unmerged makes ongoing upstream contributions unsustainable. We are closing our open superseded PRs here and consolidating all our active engine development, asymmetric multi-GPU optimizations, and low-bit MoE kernels on PolyStrata (https://github.com/simplexai-labs/PolyStrata). |
2255ab3 to
c234774
Compare
Problem and result
In
strata-inkling(v0.2.20), dense trunk tensors (Section 1:token_embd.weight,output.weight, attention projectionsattn_q,attn_k,attn_v,attn_r,attn_gate,attn_output) are loaded viacopy_mat_bf16inink_gguf_loader.h. When loading GGUF models where dense weights are stored in quantized formats (such as Q8_0, Q5_K, Q6_K, Q4_K),copy_mat_bf16inflates dense tensors by 2x into 16-bit BF16.On
Inkling-2-Mini-UD-IQ3_XXS.gguf(11.7 GB), this causes:--draft offis specified,ink_main.cppleavesdspark_pathunset, triggering phantom auto-discovery of companion drafters (e.g.dspark-*.gguf), wasting 640 MB of VRAM.ink_kernels.cuh,k_ink_gemv_multi_q8row_m1calculated quantized weight offsets usingWp + (size_t)Np * 4. WhenN_override < ti.rows()(e.g.output.weightwith unpadded vocab size 200,058 vs 201,024),200058 * 4 = 800232was not 16-byte aligned (800232 % 16 = 8), triggeringCUDA error 716 (misaligned address).With this PR:
copy_mat_auto: native BF16 tensors remain untouched, while quantized dense tensors are converted to row-scaled INT8 (FMT_Q8ROW) via a multi-threaded dequant/quant pass at load time.ink_kernels.cuh,InkMultiProjprecomputes an aligned quantized weights pointerWq[i] = W[i] + (size_t)ti.rows() * 4, guaranteeing 16-byte alignment and completely eliminating CUDA error 716 on unembed projections.k_ink_screen_eval_q8rowand aliasesunembed_screen.q8directly intod_trunkwithout allocating a duplicate 461 MB screening buffer.--draft offto setdspark_path = "none", preventing phantom drafter allocations.Inkling-2-Mini-UD-Q4_K_XL.gguf, all 3,072 experts remain 100% VRAM resident (1,536 GPU0 + 1,536 GPU1 / 0 host) with decode jumping to 81.8 tok/s (+69% to +82% faster than upstream v0.2.20).Related discussion
Complements PR #6811 (zero-P2P tail-skip) and PR #6815 (zero-copy mapped staging and CUDA graph capture).
Approach
engine/src/inkling2/ink_gguf_loader.h:copy_mat_q8rowwith parallel CPU worker threads dequantizing GGUF rows to F32 and quantizing to INT8 with row scaledst_sc.copy_mat_autoto selectcopy_mat_bf16if source tensor type is already BF16 (type 30) orcopy_mat_q8rowotherwise.token_embd.weight,output.weight,attn_q.weight,attn_k.weight,attn_v.weight,attn_r.weight,attn_gate.weight, andattn_output.weighttocopy_mat_auto.noneoroffin explicit dspark path to bypass auto-discovery.engine/src/inkling2/ink_main.cpp:--draft off, explicitly setcfg.bopts.dspark_path = "none".engine/src/inkling2/ink_safetensors_loader.h:mtp.safetensorswhen explicit path is"none"or"off".engine/src/inkling2/cuda/ink_kernels.cuh:struct InkMultiProjwithconst int8_t* Wq[5]to decouple output row countNpfrom the scale array row strideti.rows().ink_resolve_multi_projresolvingWqp.k_ink_gemv_multi_q8row_m1,k_ink_gemv_multi_q8row_preq, andk_ink_gemv_multi_q8rowto useWqp + (size_t)lrow * K, ensuring 16-byte alignment.N_strideink_ink_q8row_to_bf16.k_ink_screen_eval_q8rowand add zero-copy ownership tracking (owns_q8,owns_sc) toUnembedScreenIndex.engine/src/inkling2/cuda/ink_runner.cuh:init()andinit_dual_gpu(): whenui.fmt == FMT_Q8ROW, aliasunembed_screen.q8andunembed_screen.scdirectly intod_trunk + ui.off, bypassing duplicate 461 MB allocation.linear_multi()andlinear(): populatemp.Wqusing(size_t)ti.rows() * 4.head_argmax_exact(): dispatchFMT_Q8ROWtok_ink_screen_eval_q8row.Validation
Passed:
cmake --build build --target strata-inkling).sm_120) + GeForce RTX 4060 Ti 16 GB (Adasm_89), Windows 11.strata-inkling.exe --bench --native Inkling-2-Mini-UD-IQ3_XXS.gguf --draft off --gpus 1 --prompt-len 64 --gen 128strata-inkling.exe --bench --native Inkling-2-Mini-UD-Q4_K_XL.gguf --draft off --gpus 2 --prompt-len 64 --gen 128Failed:
Not run:
ink_runner.cuh,ink_kernels.cuh, andink_gguf_loader.h.Limits