返回资讯中心
外部精选
软件工程
#开发者实时流

为 AMD R9700 打造 Inkling-2-Mini 的 Vulkan 推理引擎,解码速度达 80 tok/s

来源标题:Exact NVFP4/MXFP8 Vulkan engine for Inkling-2-Mini on AMD R9700 (80 tok/s)

开发者发布了一个零框架的 Vulkan 1.3 推理引擎,在单张 AMD Radeon AI PRO R9700(32GB)上运行 Inkling-2-Mini,实现约 80 tok/s 的解码速度。该引擎支持 NVFP4/MXFP8 量化,仓库中 v2 版为 C++17 + GLSL WMMA 独立构建(推荐),v1 版为 Python/C WGSL 加 FP8 KV 与 CPU ViT 的原实现。项目面向长上下文编码代理场景。

Hacker News 最新gourusriharsha12026/11/29 · 今天9 分钟阅读

以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。

仓库结构:v2/ 包含独立的 C++17 + GLSL WMMA 干净构建(推荐),v1/ 包含原始的 Python/C WGSL + FP8 KV + CPU ViT 实现。 一个从零构建的独立、零框架 Vulkan 1.3 推理引擎,针对 thinkingmachines/Inkling-2-Mini,专为单块 AMD Radeon AI PRO R9700(32 GB,RDNA 4,Linux RADV)设计,服务于长上下文编码 agent。

  1. 请求与引擎流水线

flowchart TD Client["OpenAI Client / Coding Agent"] -->|"HTTP + Bearer API Key (127.0.0.1)"| Server["server.py (Python stdlib)"] Server -->|"chat_template.jinja + tokenizer.py (BPE)"| Stdio["inkling_vk --stdio-server (JSON-lines)"] Stdio --> Prefix{"LCP Prefix Cache Check"} Prefix -->|"Exact match or turn-boundary ckpt"| Reuse["Reuse KV + MTP KV + Restore 3.8 MiB short_conv ckpt"] Prefix -->|"New prompt"| Reset["Reset KV & short_conv state"] Reuse --> Prefill["Batched Prefill (B=256): RDNA4 FP16->FP32 WMMA FA2 + NVFP4 MoE GEMM"] Reset --> Prefill Prefill --> Decode{"Adaptive Speculative Loop"} Decode -->|"avg_acc >= 3.0 (code / 40k)"| MTP["DFlare MTP (3 layers + Markov RNN) -> Draft K=7"] MTP --> Verify["Target Verify B=8 (32-Split Shared-KV @ depth) + short_conv Rollback"] Verify --> Decode Decode -->|"avg_acc < 3.0 (prose)"| B1["Fast B=1 Decode (Fused 8-proj matvec + Split-K)"] B1 --> Decode Decode -->|"EOS or max_tokens"| Parse["Parse thinking / text / tool_calls -> JSON response"] Parse --> Client Loading

  1. Inkling-2-Mini 48 逻辑层循环与混合内存

flowchart LR Emb["Embed + RMSNorm"] --> Pre["Prelude: 4 Physical Layers (il 0..3)"] Pre --> P0["Core Pass 0: 12 Layers (il 4..15)"] P0 -->|"Cross-Pass AttnRes Bank + Controllers"| P1["Core Pass 1: Same 12 Weights (il 16..27)"] P1 -->|"Cross-Pass AttnRes Bank + Controllers"| P2["Core Pass 2: Same 12 Weights (il 28..39)"] P2 --> Epi["Epilogue: 8 Physical Layers (il 40..47, MXFP8 MoE)"] Epi --> Out["Output AttnRes + RMSNorm + Unembed (200,058 vocab)"] P0 -.->|"Capture H at il=4, 28, 46, final"| DFlare["DFlare MTP (636 MB) -> Top-1024 Markov Shortlist"] P2 -.-> DFlare Epi -.-> DFlare Out -.-> DFlare Loading

混合 KV 缓存(128,000 tokens = 8.12 GiB):40 层使用固定的 1,024-token 滑动窗口环形缓冲区;只有 8 层是全局全上下文注意力。 逐步 short_conv 回滚(29.2 MiB):由于 Inkling 在每一层都使用深度为 4 的短卷积,投机验证会保存每步的卷积状态,并通过一次 GPU 拷贝回滚到精确的已接受 token 数。 RDNA 4 上的硬件 WMMA:使用 VK_KHR_cooperative_matrix(16×16×16 FP16→FP32,Wave64),在 FlashAttention-2 中采用 1/16 输入缩放(防止异常值溢出,同时保持 500/500 精确性),并在 NVFP4 MoE GEMM 中将外因子分解到 FP32 尾声。

性能图表

解码速度对比(tok/s,越高越好) xychart-beta title "Decode Speed: v1 vs v2 Exact vs v2 --fp8 (tok/s)" x-axis ["Prose B=1", "Code 1 (MTP)", "Code 2 (MTP)", "40k Depth (MTP)"] y-axis "Tokens / sec" 0 --> 180 bar [91.3, 117.8, 88.6, 61.8] bar [86.8, 133.5, 142.7, 85.1] bar [111.7, 130.9, 167.7, 84.3] Loading

(每组柱状顺序:v1 inkling-vulkan [所示深度为 32k],v2 Exact BF16/FP32,v2 --fp8 Dense。)

xychart-beta title "Cold Long-Context Prefill Speed (tok/s)" x-axis ["v1 @ 4k", "v1 @ 32k", "v1 @ 50k", "v2 @ 25k", "v2 @ 40k"] y-axis "Tokens / sec" 0 --> 1500 bar [388, 291, 253, 1380.8, 1280] Loading

表 1:需求门禁记分板(v2 服务构建) 所有速度数字均为在安静的 R9700 GPU 上预热 1 次后 5 次运行的中位数(bench_final_gates.py、verify_req_a_short.py、verify_req_f.py)。

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →