Repository navigation
CUDA: GGML_OP_ATTN_RES_MIX + Inkling 2 single-token decode fusions - #409
danbunnell wants to merge 1 commit into
Conversation
Adds a fused GGML_OP_ATTN_RES_MIX op (CPU + CUDA) for Inkling 2 block attention residuals and single-token CUDA graph fusions for Inkling 2 decode: - Dynamic (26-op) and static (8/9-op) K=4 shortconv state update + conv + residual - Loop controller CONCAT+MUL_MAT down-projection, 8-op up-projection + tanh gate blend, and 6-op post-gate fallback - Single-token 9-op dense kq_b relative bias builder (n_rel=16) - General 2-op ADD+SCALE residual tail fusion Complementary to unslothai/llama.cpp unslothai#400 (mmvf), unslothai#401 (clip-rows), and unslothai#402 (SiTU), with zero overlap.
GPU Verification Results (Linux x86_64, RTX 3090 24 GB
|
|
Thanks for this. I tested it on a B200 stacked on our pin set (the published Mini GGUFs do not load on #386 alone), base = pin set, head = pin set plus this PR. Numerics change on every decode step:
The A/A floor is 0, and greedy text diverges on both models. Splitting it with local switches: Other issues:
We have exact versions of several of these in #411 (short conv chain), #412 (tanh mul add/sub) and #414 (depth mix), each with a kill switch, and they give about +30% tg128 on B200 together with the rest of that series. If you want to push this further, a CUDA-backend fusion that keeps the original rounding, rather than a new graph op, would fit with those and not affect the other backends. |
|
Thanks for the detailed review and for pointing out the Metal/Vulkan fallback, |
Summary
Complementary to
#400(mmvf),#401(clip-rows), and#402(SiTU) with zero overlap, this PR reduces per-token kernel launch and memory traffic overhead in Inkling 2 (inkling2/inkling2_loop):GGML_OP_ATTN_RES_MIX(CPU + CUDA,attn-res-mix.{cu,cuh}):RMS_NORM,CONCAT,REPEAT,MUL_MAT,SOFT_MAX, andCONT(TRANSPOSE)nodes while preserving Unsloth'sstack()/block_stackfallback when types/counts don't qualify.inkling2-fuse.{cu,cuh},ggml-cuda.cu,inkling2.cpp):SSM_CONV+ dynamic 4-lag taps (26 ops -> 1 kernel) or static conv + residual + scale [+ outer residual add] (8/9 ops -> 1 kernel), keeping Unsloth'sxtprefill path intact.CONCAT(cur_norm, msg_norm) + MUL_MAT(w_down)(2 ops -> 1 kernel),MUL_MAT(w_gain) + MUL_MAT(w_forget) + tanh gate blend(8 ops -> 1 kernel), plus a 6-op post-gate fallback.kq_bbuilder (9 ops -> 1 kernel forn_rel == 16, single token) and general 2-opADD + SCALE.add_alloc_depsentries inggml_backend_cuda_graph_optimizesogallocrnever aliases fused inputs with outputs.Verification
b12606+scripts/unsloth/pr-set.json@cfc9ea3709ca(#386,#400,#401,#402) with zero conflicts.sm_86); GPU KLD parity and benchmark results will be posted shortly.