{"id":693,"date":"2026-11-17T21:20:38","date_gmt":"2026-11-17T13:20:38","guid":{"rendered":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/2026\/11\/17\/qwen35-prefill-cudagraph\/"},"modified":"2026-11-17T23:07:52","modified_gmt":"2026-11-17T15:07:52","slug":"qwen35-prefill-cudagraph","status":"publish","type":"post","link":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/2026\/11\/17\/qwen35-prefill-cudagraph\/","title":{"rendered":"\u5b9e\u8bad\u8fc7\u7a0b\u4e2d\u5bf9Prefill\u5165\u56fe\u6709\u4e86\u7406\u89e3"},"content":{"rendered":"<p>\u6607\u817e\u4e0a\u6d77\u7ebf\u4e0b\u5b9e\u8badLAB3\uff1a<\/p>\n<p>\u6607\u817eA2\u5355\u5361\u73af\u5883Qwen3.5-0.8B@vLLM-Ascend\u591a\u6a21\u6001\u63a8\u7406\u6027\u80fd\u8c03\u4f18<\/p>\n<p>\u5b9e\u9a8c\u8981\u6c42\uff1a<\/p>\n<p>\u9488\u5bf9\u6607\u817e A2 \u5355\u5361\u73af\u5883\uff0c\u5728\u5355\u5e76\u53d1\u30011080P\uff081920\u00d71080\uff09\u9ad8\u6e05\u56fe\u50cf\u8f93\u5165\u7684\u5178\u578b\u7aef\u4fa7\u89c6\u89c9\u7406\u89e3\u573a\u666f\u4e2d\uff0c<\/p>\n<p>\u57fa\u4e8e vLLM \u63a8\u7406\u6846\u67b6\uff0c\u56f4\u7ed5\u7b97\u5b50\u5b9e\u73b0\u3001\u8ba1\u7b97\u56fe\u7ed3\u6784\u3001\u5185\u5b58\u8c03\u5ea6\u53ca\u591a\u6a21\u6001\u9884\u5904\u7406\u94fe\u8def\u5c55\u5f00\u7cfb\u7edf\u6027\u6027\u80fd\u8c03\u4f18\uff0c<\/p>\n<p>\u4f18\u5316\u9996\u5b57\u54cd\u5e94\u5ef6\u8fdf\uff08TTFT\uff09\u548c\u9010 Token \u751f\u6210\u901f\u5ea6\uff08TPOT\uff09\u6307\u6807\u3002<\/p>\n<p>\u5355\u8bf7\u6c42\u8f93\u51651080P\u56fe\u7247\uff0c\u8f93\u51fatokens\u657064\uff0c\u8fbe\u5230\uff1a<\/p>\n<p>1.E2E \u603b\u8017\u65f6\u8981\u6c42&lt;0.6s<\/p>\n<p>2.TTFT\u8981\u6c42&lt;250ms<\/p>\n<p>3.TPOT&lt; 10ms<\/p>\n<p>\u5b9e\u9a8c\u73af\u5883\uff1a<\/p>\n<p>HiDevLab\u5bb9\u5668\uff1a\u6607\u817eA2\uff0cCANN_9.0.0 Release, OpenEuler24.03\uff0c1NPU 32G\u5185\u5b58 32\u6838CPU 300G\u5b58\u50a8<\/p>\n<p>============<\/p>\n<p>\u672c\u5e16\u53ea\u8981\u5206\u4eab\u5728\u5b9e\u73b0Prefill\u5165\u56fe\u4f18\u5316\u8fc7\u7a0b\u4e2d\uff0c\u81ea\u5df1\u7684\u5b66\u4e60\u5fc3\u5f97\u548c\u9a8c\u8bc1\u8fc7\u7a0b\u3002<\/p>\n<p>vllm0.23\u7684cudagraph_mode\u652f\u6301\u4e09\u79cd\u6a21\u5f0f\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic1.png\" alt=\"\u4e09\u79cd\u5165\u56fe\u6a21\u5f0f\u5bf9\u6bd4\" width=\"454\" height=\"94\" loading=\"lazy\"><\/figure>\n<p>NONE\uff1a\u6bcf\u751f\u6210\u4e00\u4e2a token\uff0chost\uff08CPU\uff09\u8981\u628a\u51e0\u767e\u4e2a\u7b97\u5b50\u9010\u4e2a\u4e0b\u53d1\u5230 NPU\uff0chost \u8c03\u5ea6\u5f00\u9500\u8fdc\u5927\u4e8e NPU \u8ba1\u7b97\u672c\u8eab\u3002<\/p>\n<p>\u5b9e\u9a8c\u5b9e\u6d4b\uff1aTPOT 72ms\uff08\u5bf9\u6bd4\u5165\u56fe\u540e\u7684TPOT 8~11ms\u53ef\u5f97\u51fa\u7ed3\u8bba\uff1aPrefill\u5165\u56fe\u548cDecode\u5165\u56fe\u90fd\u662f\u672c\u6b21\u4f18\u5316\u7684\u6838\u5fc3\uff09<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic2.png\" alt=\"eager \u9010\u7b97\u5b50\u4e0b\u53d1 vs \u5165\u56fe\" width=\"610\" height=\"279\" loading=\"lazy\"><\/figure>\n<p>FDO\uff1adecode \u6bcf token \u8d70\u7684\u8ba1\u7b97\u5f62\u72b6\u5b8c\u5168\u56fa\u5b9a\uff08batch\u3001token \u6570\u90fd\u4e00\u6837\uff09\uff0c\u662f\u56fe\u6355\u83b7\u7684\u5b8c\u7f8e\u573a\u666f\uff0creplay \u6d88\u6389\u5168\u90e8 host \u4e0b\u53d1\u5f00\u9500 \u2192 TPOT 72\u219211ms\u3002\u4f46 prefill \u5f62\u72b6\u968f\u8f93\u5165 token \u6570\u53d8\u5316\uff08\u5b9e\u9a8c\u8981\u6c42 2055 tokens\uff09\uff0c\u4f20\u7edf\u6574\u56fe\u6355\u83b7\u5bf9\u4e0d\u4e0a\uff0c\u6240\u4ee5 prefill \u4fdd\u6301 eager\uff1b<\/p>\n<p>FAP\uff1a\u628a\u6a21\u578b\u5728\u6ce8\u610f\u529b\u7b97\u5b50\u5904\u5207\u5f00\uff0c\u524d\u540e\u975e\u6ce8\u610f\u529b\u90e8\u5206\u5206\u522b\u6355\u83b7\u6210\u56fe\uff08piecewise=\u5206\u6bb5\uff09\uff0cattention \u73b0\u7b97\u3002\u597d\u5904\u662f prefill \u4e5f\u80fd\u5403\u5230\u56fe\u6536\u76ca\uff0c\u4f46\u8981\u6c42\u524d\u63d0\u662f cudagraph_capture_sizes \u91cc\u8981\u6709\u8986\u76d6 prefill token \u6570\u7684\u6863\u4f4d\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic3.png\" alt=\"\u4ec5\u66f4\u6539 cudagraph_mode \u7684\u8c03\u4f18\u7ed3\u679c\" width=\"526\" height=\"421\" loading=\"lazy\"><\/figure>\n<p>\u7531\u5b9e\u9a8c\u7ed3\u679c\u53ef\u77e5\uff0c\u4ec5\u4ec5\u66f4\u6539cudagraph_mode\u65e0\u6cd5\u4ece\u6839\u672c\u4e0a\u63d0\u5347\u6027\u80fd\uff0c\u4f46Decode\u5165\u56fe\u53ef\u4ee5\u63d0\u534710%\u7684\u6027\u80fd\uff0c\u5c06TTFT\u538b\u7f29\u5230330ms\u4e0a\u4e0b\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\u8fdb\u4e00\u6b65\u56fa\u5316Prefill\u5165\u56fe\uff1a<\/p>\n<p>\u6839\u636e\u5bfc\u5e08\u624b\u518c\u63d0\u793a\uff0c\u7ec4 A\uff1a\u56fa\u5316\u914d\u7f6e<\/p>\n<p>VLLM_ENABLE_V1_MULTIPROCESSING=0 PROF_DIR=\/workspace\/prof_A \\<\/p>\n<p>CC_JSON='{&#8220;cudagraph_mode&#8221;: &#8220;FULL_AND_PIECEWISE&#8221;, &#8220;cudagraph_capture_sizes&#8221;:[1,2,3,4,8,16,24,32,64,128,144,152,168,184,200,256,1024,2048,2279,2280,3072]}&#8217; \\<\/p>\n<p>\u63a5\u4e0b\u6765\u662f\u7b14\u8005\u7406\u89e3\u5bfc\u5e08\u624b\u518c\u4e2d\u8fd9\u4e9b\u6570\u5b57\u7684\u542b\u4e49\uff1a<\/p>\n<p>\u25cf<\/p>\n<p>\u673a\u5236\u7ea6\u675f\uff08\u591a\u6216\u8005\u5c11\u90fd\u4e0d\u5408\u9002\uff09<\/p>\n<p>\u6bcf\u4e2a\u6863\u4f4d = \u6355\u83b7\u4e00\u5f20\u72ec\u7acb\u7684\u56fe\uff0c\u6bcf\u5f20\u56fe\u5360\u4e00\u4efd\u72ec\u7acb\u663e\u5b58\uff08\u6fc0\u6d3b buffer \u6309\u8be5\u6863\u4f4d\u5927\u5c0f\u9884\u7559\uff09\u3002\u6863\u4f4d\u8d8a\u591a\u663e\u5b58\u5403\u5f97\u8d8a\u591a\uff0c\u6240\u4ee5\u5217\u8868\u957f\u5ea6\u5929\u7136\u53d7\u9650\uff0820 \u4e2a\u5de6\u53f3\u5df2\u662f\u5408\u7406\u4e0a\u9650\uff09\u3002\u540c\u65f6\u56e0\u4e3a\u8fd0\u884c\u65f6\u662f\u201c\u5411\u4e0a\u53d6\u6574 pad \u5230\u6700\u8fd1\u6863\u201d\uff0c\u6863\u4f4d\u592a\u7a00 = pad \u5197\u4f59\u5927\uff0c\u592a\u5bc6 = \u663e\u5b58\u7206\u70b8\u2014\u2014\u5217\u8868\u672c\u8d28\u4e0a\u662f\u5728\u8fd9\u4e24\u8005\u95f4\u627e\u5e73\u8861\u3002<\/p>\n<p>\u25cf<\/p>\n<p>\u7ed3\u6784\u5206\u5c42<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic4.png\" alt=\"20 \u4e2a\u6863\u4f4d\u7684\u542b\u4e49\" width=\"533\" height=\"166\" loading=\"lazy\"><\/figure>\n<p>\u25cf<\/p>\n<p>\u573a\u666f\u6821\u51c6<\/p>\n<p>128~256 \u6bcf 8~16 \u9012\u589e\u7684\u5bc6\u96c6\u6bb5\uff0c\u552f\u72ec2279\/2280 \u8fd9\u4e24\u4e2a\u7cbe\u786e\u503c\uff0c\u4e0d\u662f\u516c\u5f0f\u7b97\u51fa\u6765\u7684\uff0c\u5927\u6982\u7387\u662f\u6309\u7167\u5bfc\u5e08\u5b9e\u6d4b\u8d1f\u8f7d\u7684 num_tokens \u5206\u5e03\u6821\u51c6\u7684\uff1a<\/p>\n<p>decode \u591a\u5e76\u53d1\u6df7\u8dd1\u65f6\uff0c\u6bcf\u6b65 num_tokens = batch \u5927\u5c0f\uff08\u6216 batch+chunked prefill \u6b8b\u6bb5\uff09\uff0c\u4f1a\u51fa\u73b0\u5404\u79cd\u975e 2 \u5e42\u7684\u503c\uff08\u6bd4\u5982 17 \u4e2a\u5e76\u53d1\u5c31\u662f 17\uff0cpad \u5230 32 \u5197\u4f59 47%\uff09\uff1b\u5bc6\u96c6\u6bb5\u5c31\u662f\u4e3a\u4e86\u8ba9\u5e38\u89c1 batch \u503c\u90fd\u80fd\u8d34\u8fd1\u843d\u6863\uff1b\u672c\u6b21\u5b9e\u9a8c\u7684prompt\u5b9e\u6d4b\u957f\u5ea6\u662f2055\uff0c\u6700\u7ec8\u843d\u57282279\u6863\u4f4d\u3002<\/p>\n<p>\u6240\u4ee5\u5176\u5b9e20\u4e2a\u6863\u4f4d\u4e2d\uff0c2279\u30012280\u30013072\u662f\u53ef\u4ee5\u81ea\u5b9a\u4e49\u7684\uff0c\u5728\u5176\u4ed6\u573a\u666f\u4e2d\u53ef\u4ee5\u901a\u8fc7serve \u65e5\u5fd7\u6216 bench \u4e2d\u7684num_tokens\u5206\u5e03\u8fdb\u884c\u8c03\u6574\u3002<\/p>\n<p>\u5728\u672c\u5b9e\u9a8c\u4e2d\uff0c&#8221;cudagraph_capture_sizes&#8221;:[1,2,3,4,8,16,24,32,64,128,144,152,168,184,200,256,1024,2048,2056,2279,2280]}&#8217; \u662f\u6700\u4f18\u89e3\u3002<\/p>\n<p>\u5b9e\u6d4b\u9a8c\u8bc1\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic5.png\" alt=\"Prefill \u56fa\u5316\u914d\u7f6e\u7ed3\u679c\" width=\"375\" height=\"96\" loading=\"lazy\"><\/figure>\n<p>\u4f46\u4ece\u5b9e\u9a8c\u6570\u636e\u6765\u770b\uff0cTTFT\u964d\u4f4e\u4e86\u63a5\u8fd140%\uff0c\u5df2\u7ecf\u538b\u7ebf\u8fbe\u6807\u5bfc\u5e08\u8981\u6c42\u7684\u6570\u5b57\uff0c\u4f46E2E\u867d\u7136\u540c\u6837\u964d\u4f4e\u4e8640%\uff0c\u4f46\u4f9d\u65e7\u6ca1\u6709\u8fbe\u6807\u3002<\/p>\n<p>\u5f53\u7b14\u8005\u7684\u80fd\u529b\u65e0\u6cd5\u8fdb\u4e00\u6b65\u4f18\u5316\u7684\u65f6\u5019\uff0cModelAgent\u5f00\u59cb\u4ecb\u5165\u3002<\/p>\n<p>\u56e0\u4e3a\u7ec4 B\uff1a\u56fa\u5316 + 2304 \u9884\u7b97<\/p>\n<p>\u9996\u5148\u6765\u770b\u4e00\u4e0bvllm0.23\u4e3b\u4ed3\u7684\u9ed8\u8ba4\u5b9a\u4e49MNBT\u503c\uff1a<\/p>\n<p>grep -rn &#8220;DEFAULT_MAX_NUM_BATCHED_TOKENS&#8221; \/vllm-workspace\/vllm\/vllm\/ &#8211;include=&#8221;*.py&#8221;<\/p>\n<p>\/vllm-workspace\/vllm\/vllm\/config\/scheduler.py:42:    DEFAULT_MAX_NUM_BATCHED_TOKENS: ClassVar[int] = 2048<\/p>\n<p>\u7531\u6b64\u53ef\u89c1\uff0c\u672c\u6b21\u5b9e\u9a8c\u4e2d\u56e0\u4e3a1080p\u56fe\u50cf\u7684prompt\u8f93\u5165\u662f2055tokens\u8d85\u8fc72048\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u88ab\u5207\u6210 2048 + 7 \u4e24\u6bb5\uff0c\u8dd1\u4e24\u6b21 prefill \u8fed\u4ee3\u3002<\/p>\n<p>\u7b2c\u4e8c\u6bb5\u53ea\u6709 7 \u4e2a token \u5374\u8981\u4ed8\u4e00\u6574\u5957\u56fa\u5b9a\u5f00\u9500\uff08\u8c03\u5ea6\u3001block table \u63d0\u4ea4\u3001KV \u5199\u5165\u3001\u56fe\u8c03\u5ea6\uff09\u3002<\/p>\n<p>\u4e3a\u4e86\u786e\u4fddMNBT\u503c\u7684\u8bbe\u5b9a\u80fd\u6ee1\u8db32055tokens\u4e00\u6b21\u7b97\u5b8c\uff0cMNBT\u5c31\u9700\u8981\u4ece\u9ed8\u8ba4\u76842048\u4fee\u6539\u6210&gt;=2055\u3002<\/p>\n<p>\u4e3a\u4e86\u786e\u5b9a\u8fd9\u4e2a2048+x\u7684\u8fd9\u4e2ax\uff0cModelAgent\u5f00\u59cb\u6839\u636e\u7ecf\u9a8c\u8fdb\u884c\u6b65\u957f\u9009\u53d6\u548c\u6d4b\u8bd5\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic6.png\" alt=\"MNBT \u5404\u503c\u5bf9\u7167\" width=\"373\" height=\"157\" loading=\"lazy\"><\/figure>\n<p>\u5b9e\u6d4b\u9a8c\u8bc1\uff1a<\/p>\n<p>VLLM_ENABLE_V1_MULTIPROCESSING=0 PROF_DIR=\/workspace\/prof_B \\<\/p>\n<p>MNBT=2304 \\<\/p>\n<p>CC_JSON='{&#8220;cudagraph_mode&#8221;: &#8220;FULL_AND_PIECEWISE&#8221;, &#8220;cudagraph_capture_sizes&#8221;:[1,2,3,4,8,16,24,32,64,128,144,152,168,184,200,256,1024,2048,2279,2280,3072]}&#8217; \\<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic7.png\" alt=\"Prefill \u56fa\u5316 + MNBT2304 \u6307\u6807\" width=\"443\" height=\"108\" loading=\"lazy\"><\/figure>\n<p>\u53ef\u4ee5\u770b\u5230TTFT\u51cf\u5c11110ms\u540e\uff0c\u6307\u6807\u5df2\u7ecf\u8fdc\u4f4e\u4e8e\u5bfc\u5e08\u8981\u6c42\u7684250ms\uff0c<\/p>\n<p>\u56e0\u4e3aE2E \u2248 TTFT + (\u8f93\u51fa tokens &#8211; 1) \u00d7 TPOT = TTFT + 63 \u00d7 TPOT\uff0c\u5728\u66f4\u6539MNBT\u540e\uff0cE2E\u57fa\u672c\u7a33\u5b9a\u5728143+63&#215;8.5\u2248 680ms\uff0c<\/p>\n<p>\u6839\u636e\u5bfc\u5e08\u7684\u8981\u6c42\uff0cE2E\u8fd8\u670980ms\u5de6\u53f3\u7684\u4f18\u5316\u7a7a\u95f4\u3002<\/p>\n<p>\u603b\u7ed3\u6765\u770b\uff0c\u5165\u56fe\u786e\u4fdd\u4e00\u6b21\u8bfb\u5b8c\uff0cMNBT\u786e\u4fdd\u4e00\u6b21\u5904\u7406\u5b8c\uff0c\u4e24\u8005\u5171\u540c\u4f5c\u7528\u6709\u6548\u63d0\u5347\u4e86TTFT\u548cE2E\u6027\u80fd\u6307\u6807\u3002<\/p>\n<p>\u7b14\u8005\u4e3a\u4e86\u6df1\u523b\u7406\u89e3\uff0c\u9488\u5bf9\u672c\u6b21\u4f18\u5316\u8fdb\u884c\u4e865\u8f6e\u9a8c\u8bc1\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic8.png\" alt=\"\u4e94\u8f6e\u573a\u666f\u914d\u7f6e\u5bf9\u7167\" width=\"388\" height=\"150\" loading=\"lazy\"><\/figure>\n<p>\u65e0\u8bba\u6d4b\u8bd5\u63a7\u5236\u53d8\u91cf\uff0c\u4ec5\u66f4\u6539\u5fc5\u8981\u7684\u9009\u9879\uff1a<\/p>\n<p>\u2460 NONE<\/p>\n<p>compilation_config={&#8220;cudagraph_mode&#8221;: &#8220;NONE&#8221;}<\/p>\n<p>\u2461 FDO<\/p>\n<p>compilation_config={&#8220;cudagraph_mode&#8221;: &#8220;FULL_DECODE_ONLY&#8221;}<\/p>\n<p>\u2462 FAP<\/p>\n<p>compilation_config={&#8220;cudagraph_mode&#8221;: &#8220;FULL_AND_PIECEWISE&#8221;}<\/p>\n<p>\u2463 FAP+sizes<\/p>\n<p>compilation_config={&#8220;cudagraph_mode&#8221;: &#8220;FULL_AND_PIECEWISE&#8221;,<\/p>\n<p>&#8220;cudagraph_capture_sizes&#8221;:[1,2,3,4,8,16,24,32,64,128,144,152,168,184,200,256,1024,2048,2279,2280]}<\/p>\n<p>\u2464 = \u2463 + MNBT2304<\/p>\n<p>compilation_config={&#8220;cudagraph_mode&#8221;: &#8220;FULL_AND_PIECEWISE&#8221;,<\/p>\n<p>&#8220;cudagraph_capture_sizes&#8221;:[1,2,3,4,8,16,24,32,64,128,144,152,168,184,200,256,1024,2048,2279,2280]},<\/p>\n<p>max_num_batched_tokens=2304<\/p>\n<p>\u6bcf\u4e00\u7ec4\u5747\u5747\u9884\u70ed1\u8f6e\uff0c\u6d4b\u8bd54\u8f6e\u53d6\u5e73\u5747\u503c\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic9.png\" alt=\"\u573a\u666f\u2460 NONE \u56db\u8f6e\u6d4b\u8bd5\" width=\"230\" height=\"144\" loading=\"lazy\"><\/figure>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic10.png\" alt=\"\u573a\u666f\u2461 FDO \u56db\u8f6e\u6d4b\u8bd5\" width=\"217\" height=\"134\" loading=\"lazy\"><\/figure>\n<p>\u5355\u4e00\u4ece\u6570\u636e\u4e0a\u770b\uff0c\u7b26\u5408decode \u5165\u56fe\u3001prefill eager\u9884\u671f\uff0c\u800c\u4e14 TTFT 313.1 \u76f8\u5bf9 \u2460\u573a\u666f\u7684371.6 \u8fd8\u4f4e\u4e86 58ms\uff0c\u8fd9\u8bf4\u660e bench \u6709\u5e76\u53d1\uff0cdecode \u52a0\u901f\u6392\u7a7a\u6392\u961f\u4e5f\u538b\u4f4e\u4e86 TTFT\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic11.png\" alt=\"\u573a\u666f\u2462 FAP \u56db\u8f6e\u6d4b\u8bd5\" width=\"214\" height=\"131\" loading=\"lazy\"><\/figure>\n<p>\u4e0d\u96be\u5f97\u51fa\uff0cFAP\u6bd4FDO\u5728\u6027\u80fd\u4e0a\u662f\u9000\u5316\u7684\uff1b\u9700\u8981\u8fdb\u4e00\u6b65\u5206\u6790\u4e24\u79cd\u573a\u666f\u4e0b\u65e2\u7136Decode\u5747\u5165\u56fe\uff0c\u4f46\u4e3a\u4ec0\u4e48\u4f1a\u6709\u63a5\u8fd12ms\u7684\u6027\u80fd\u56de\u9000\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic12.png\" alt=\"\u573a\u666f\u2463 FAP+sizes \u56db\u8f6e\u6d4b\u8bd5\" width=\"214\" height=\"129\" loading=\"lazy\"><\/figure>\n<p>\u4ece\u6570\u636e\u4e0a\u770b\uff0cTTFT\u6536\u76ca\u660e\u663e\uff0c\u4f46TPOT\u7684\u6536\u76ca\u4e0d\u9ad8\uff0c\u4f3c\u4e4e\u4e0eFDO\u573a\u666f\u7684\u201cdecode \u52a0\u901f\u6392\u7a7a\u6392\u961f\u4e5f\u538b\u4f4e\u4e86 TTFT\u201d\u6709\u51fa\u5165\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic13.png\" alt=\"\u573a\u666f\u2464 +MNBT2304 \u56db\u8f6e\u6d4b\u8bd5\" width=\"226\" height=\"138\" loading=\"lazy\"><\/figure>\n<p>\u603b\u7ed3\u5168\u90e85\u7ec4\u5b9e\u9a8c\u6570\u636e\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic14.png\" alt=\"\u4e94\u7ec4\u5b9e\u9a8c\u6570\u636e\u6c47\u603b\" width=\"290\" height=\"150\" loading=\"lazy\"><\/figure>\n<p>\u6839\u636e\u5b9e\u9a8c\u6570\u636e\u521d\u6b65\u5224\u65ad\u539f\u56e0\u5982\u4e0b\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic15.png\" alt=\"\u6536\u76ca\u6bb5\u5206\u6790\" width=\"532\" height=\"125\" loading=\"lazy\"><\/figure>\n<p>=====================<\/p>\n<p>\u6293\u5305\u5206\u6790\u9a8c\u8bc1\u731c\u6d4b\uff1a<\/p>\n<p>\u6ce8\uff1a\u6293\u5305\u73af\u5883tokens\u957f\u5ea6\u4ece2055\u53d8\u62102060\uff0cTOKENS\u4e5f\u4ece64\u7f29\u77ed\u52308\uff0c\u4f46\u4e0d\u5f71\u54cd\u603b\u4f53\u7ed3\u8bba\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic16.png\" alt=\"trace \u6587\u4ef6\u9010\u6863\u4e0b\u964d\" width=\"640\" height=\"302\" loading=\"lazy\"><\/figure>\n<p>\u6587\u4ef6\u5927\u5c0f22M \u2192 14M \u2192 14M \u2192 12M \u2192 8.6M\uff0c\u9010\u6863\u4e0b\u964d\uff0c\u8fd9\u4e5f\u53cd\u6620\u4eceT1\u5230T5\u7684\u4f18\u5316\u65b9\u6848\uff0c\u5c06host \u4fa7\u4e8b\u4ef6\u5bc6\u5ea6\u4ece eager \u964d\u5230 graph replay \u3002<\/p>\n<p>\u4eceDecode\u6027\u80fd\u4e0a\u6765\u770b\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic17.png\" alt=\"\u4e94\u8f6e Decode \u6027\u80fd\u5bf9\u7167\" width=\"400\" height=\"147\" loading=\"lazy\"><\/figure>\n<p>\u4e4b\u524d\u4e94\u8f6e\u7ed3\u679c\u6d4b\u8bd5\u5982\u4e0b\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic18.png\" alt=\"\u2460\u2461\u573a\u666f E2E \u5bf9\u7167\" width=\"287\" height=\"78\" loading=\"lazy\"><\/figure>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic19.png\" alt=\"\u2462\u2463\u2464\u573a\u666f E2E \u5bf9\u7167\" width=\"290\" height=\"66\" loading=\"lazy\"><\/figure>\n<p>E2E \u2248 TTFT + 63 \u00d7 TPOT\uff08\u8f93\u51fa 64 token\uff0c\u9996 token \u5df2\u5728 TTFT \u5185\uff09<\/p>\n<p>\u5ffd\u7565\u6389\u573a\u666f\u2460 \u7684Decode\u4e0d\u5165\u56fe\uff0cE2E\u6027\u80fd\u7684\u4f18\u5316\u66f4\u591a\u662fTTFT\u7684\u4f18\u5316\uff1b\u5176\u4ed64\u7ec463xTPOT\u9664\u4e86\u2461 \u7ec4\u53e6\u7c7b\u4e00\u70b9\u5916\uff0c\u2462 \u2463 \u2464\u57fa\u672c\u4fdd\u6301\u5728650ms\u4e0a\u4e0b\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic20.png\" alt=\"TTFT + decode \u90e8\u5206\u4e0e bench E2E\" width=\"428\" height=\"129\" loading=\"lazy\"><\/figure>\n<p>\u2461\u7ec4\u4e4b\u6240\u4ee5\u53e6\u7c7b\u7684\u5feb\uff0c\u662f\u56e0\u4e3a\u2461\u7ec4\u662fFULL\u6574\u56fe\uff0c\u2462 \u2463\u7ec4\u662fpiecewise\u5207\u6bb5\u56fe\uff0c\u591a\u4ed8\u51fa\u4e862ms\u5de6\u53f3\u7684\u7aef\u95f4\u8c03\u5ea6\uff1b\u2463 \u2464\u7ec4\u7684Decode\u56fe\u76f8\u540c\uff0c\u6bb5\u95f4\u8c03\u5ea6\u4ed8\u51fa\u4e5f\u4e00\u6837\uff0c\u56e0\u6b64\u5f98\u5f8a\u572810ms\u9644\u8fd1\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic21.png\" alt=\"E2E \u5168\u94fe\u8def\u62c6\u89e3\u67f1\u72b6\u56fe\" width=\"640\" height=\"426\" loading=\"lazy\"><\/figure>\n<p>\u56de\u8fc7\u5934\u6765\u518d\u770b\u731c\u6d4b\uff0c\u8fd8\u6709prefill\u9636\u6bb5\u7684\u6027\u80fd\u63d0\u5347\u6ca1\u6709\u5b8c\u5168\u9a8c\u8bc1\uff08\u7b2c\u4e00\u6b21\u5b9e\u9a8c\u7684\u811a\u672c\u65e0\u6cd5\u5bf9Prefill\u5165\u56fe\u8fdb\u884c\u6709\u6548\u7684\u9a8c\u8bc1\uff09<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic22.png\" alt=\"T1\u2192T5 \u6536\u76ca\u6bb5\u5206\u6790\" width=\"531\" height=\"125\" loading=\"lazy\"><\/figure>\n<p>\u811a\u672c\u8bb0\u5f55\u4e09\u4e2a\u64cd\u4f5c\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic23.png\" alt=\"\u811a\u672c\u8bb0\u5f55\u7684\u4e09\u4e2a\u64cd\u4f5c\" width=\"494\" height=\"63\" loading=\"lazy\"><\/figure>\n<p>\u5b9e\u9645\u6293\u5305\u7684\u8bb0\u5f55\u60c5\u51b5\u5982\u4e0b\uff1a<\/p>\n<p>################ t1 ################<\/p>\n<p>CHECK capture=0  exec=0  launch=12130<\/p>\n<p>################ t2 ################<\/p>\n<p>CHECK capture=1  exec=14  launch=7011<\/p>\n<p>################ t3 ################<\/p>\n<p>CHECK capture=26  exec=14  launch=7927<\/p>\n<p>################ t4 ################<\/p>\n<p>CHECK capture=451  exec=114  launch=20431<\/p>\n<p>################ t5 ################<\/p>\n<p>CHECK capture=501  exec=64  launch=21030<\/p>\n<p>\u5bf9\u6293\u5305\u6570\u636e\u8fdb\u884c\u5206\u6790\u8bb0\u5f55\uff1a<\/p>\n<p>1\u56fe\u6355\u83b7capture\u548c\u91cd\u653ereplay\u7b26\u5408\u53c2\u6570\u5b9a\u4e49<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic24.png\" alt=\"\u4e94\u8f6e\u6293\u5305\u7edf\u8ba1\" width=\"388\" height=\"140\" loading=\"lazy\"><\/figure>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic25.png\" alt=\"TTFT + 63\u00d7TPOT \u5b8c\u6574\u5bf9\u7167\" width=\"531\" height=\"147\" loading=\"lazy\"><\/figure>\n<p>\u2460 \u2461 \u6863\u4f4d\u672c\u8eab\u4e0d\u5bf9Prefill\u5165\u56fe\uff0c\u56e0\u6b64\u5747\u67092100+\u6570\u91cf\u7ea7\u7684CPU\u5230NPU\u4e0b\u53d1\uff0c\u6240\u4ee5prefill\u8017\u65f6\u5f88\u591a\uff0cTTFT\u5747\u5728300ms\u4ee5\u4e0a\uff1b<\/p>\n<p>\u2463 \u2464 \u6863\u4f4dPrefill\u5165\u56fe\uff0c\u56e0\u6b64CPU\u5230NPU\u7684prefill\u4e0b\u53d1\u964d\u4f4e\u4e86\u7ea698%\uff0cPrefill\u8017\u65f6\u964d\u4f4e\u5230\u4e8665-70ns\u6570\u91cf\u7ea7\uff0c\u6700\u76f4\u89c2\u7684\u4f53\u73b0\u5c31\u662fTTFT\u4e0b\u964d\u4e86110ms\u4ee5\u4e0a\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic26.png\" alt=\"\u5c0f\u56fe\u6d4b\u8bd5 TTFT \u4f18\u5316\u5206\u6790\" width=\"640\" height=\"320\" loading=\"lazy\"><\/figure>\n<p>\u5982\u679c\u5355\u770b\u2461\u548c\u2462\uff0c\u5728\u672c\u5b9e\u9a8c\u6837\u672c\u4e2d\u53ef\u80fd\u4f1a\u5f97\u51faFAP\u5bf9FDO\u662f\u8d1f\u4f18\u5316\u7684\u7ed3\u8bba\uff0c\u5728\u521d\u770b\u5230\u5b9e\u9a8c\u6570\u636e\u4ee5\u53ca\u6293\u5305\u6570\u636e\u7684\u65f6\u5019\uff0c\u7b14\u8005\u4e5f\u662f\u8fd9\u6837\u60f3\u7684\uff0c\u4f46\u5728\u5206\u6790\u4e86\u6d4b\u8bd5\u6837\u672c\u540e\uff0c\u7b14\u8005\u731c\u6d4b\u539f\u56e0\u662f2055\/2060tokens\u8d85\u51fa\u4e86\u9ed8\u8ba4\u76842048\u9650\u5236\uff0c\u7cfb\u7edf\u8ba4\u4e3a\u6ca1\u6709\u6863\u4f4d\u53ef\u4ee5\u5339\u914d\uff0c\u76f4\u63a5\u9000\u56de\u5230eager\u6a21\u5f0f\u3002\u56e0\u4e3a\u2463\u6863\u4f4d\u76f8\u5bf9\u4e8e\u2462\u53ea\u5b9a\u4e49\u4e86cudagraph_capture_sizes\uff0c\u4f46\u2463\u7684\u786e\u901a\u8fc7Prefill\u5165\u56fe\u5927\u5e45\u5ea6\u63d0\u5347\u4e86\u6027\u80fd\u3002<\/p>\n<p>\u7b14\u8005\u4e0a\u4f20\u4e86\u4e00\u5f20\u5c0f\u56fe\u8fdb\u884c\u6d4b\u8bd5\u9a8c\u8bc1\uff1a<\/p>\n<p>\u6d4b\u8bd5\u7ed3\u679c\u6709\u70b9\u51fa\u4e4e\u7b14\u8005\u610f\u6599\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic27.png\" alt=\"\u5c0f\u56fe\u6d4b\u8bd5 capture\/exec\/launch \u7edf\u8ba1\" width=\"402\" height=\"80\" loading=\"lazy\"><\/figure>\n<p>\u56e0\u4e3a\u6d4b\u8bd5\u811a\u672c\u8bbe\u5b9amax_tokens=8\uff0c \u9996 token \u51fa\u5728 prefill\uff0c\u540e\u9762 7 \u6b65\u662f decode\u3002<\/p>\n<p>2 \u4e2a\u8bf7\u6c42 \u00d7 7 \u6b65 = 14 \u6b21 replay\uff0c\u5168\u90e8\u5bf9\u5e94 decode\uff0c\u6ca1\u6709\u4e00\u6b21prefill\u6355\u83b7\u56fe\u7684replay\u3002<\/p>\n<p>\u5982\u679c\u2462\u573a\u666f\u7684piecewise \u56fe\u88ab prefill \u4f7f\u7528\uff0c\u5c31\u5fc5\u7136\u4ea7\u751f replay\uff1b\u73b0\u5728 replay \u6570\u91cf\u6b63\u597d\u7b49\u4e8e decode \u6b65\u6570\uff0c\u6ca1\u6709\u4f59\u91cf\uff0c\u53ea\u80fd\u8bc1\u660e\u9ed8\u8ba4FAP\u901a\u5e38\u4e0d\u4f1a\u5b9e\u73b0Prefill\u5165\u56fe\u3002<\/p>\n<p>\u901a\u8fc7\u65e5\u5fd7\u786e\u8ba4\uff1a<\/p>\n<p>&#8216;cudagraph_capture_sizes&#8217;: [1]<\/p>\n<p>&#8216;max_cudagraph_capture_size&#8217;: 1<\/p>\n<p>Capturing CUDA graphs (mixed prefill-decode, PIECEWISE): 1\/1<\/p>\n<p>Capturing CUDA graphs (decode, FULL): 1\/1<\/p>\n<p>\u5206\u6bb5\u56fe\u7684\u62c6\u5206\u7531 splitting_ops \u91cc\u7684 vllm::unified_attention_with_output \u5b8c\u6210\uff0c\u6bcf\u5c42\u5207\u4e00\u5200\uff0cQwen3.5-0.8B \u6709 24 \u5c42\uff0c\u6240\u4ee5 1 \u4e2a\u6863\u4f4d\u4f1a\u88ab\u5207\u6210 25 \u6bb5\uff0c\u518d\u52a0\u4e0a 1 \u5f20 FULL decode \u56fe\uff0c\u5408\u8ba1 26 \u5f20\u3002<\/p>\n<p>\u7b14\u8005\u8bbe\u7f6eSIZES = [1, 2, 3, 4, 8, 16, 24, 32, 64, 128,144, 152, 168, 184, 200, 256, 1024, 2048, 2279, 2280]\uff0c\u5408\u8ba120\u4e2a\u6863\u4f4d\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic28.png\" alt=\"mnbt \u4e0e\u6709\u6548\u6863\u4f4d\u6570\u5bf9\u7167\" width=\"386\" height=\"83\" loading=\"lazy\"><\/figure>\n<p>\u5728\u2463 \u2464\u4e24\u4e2a\u573a\u666f\u4e2d\uff0c\u56e0\u4e3a\u7b14\u8005\u8bbe\u7f6e\u4e86size\uff0c\u56e0\u6b64\u4f1a\u6839\u636esize\u5b9a\u4e49\u7684\u6863\u4f4d\u8fdb\u884c\u5207\u6bb5\uff0c\u5b9e\u73b0prefill\u5165\u56fe\uff0c\u4f46\u662f\u5728\u2462\u7684\u573a\u666f\u4e2d\uff0c\u56e0\u4e3a\u6ca1\u6709\u5b9a\u4e49size\uff0c\u6240\u4ee5 max_cudagraph_capture_size is set to min(max_num_seqs*2, &#8230;)<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic29.png\" alt=\"\u4e00\u6b21 forward \u7684 token \u6784\u6210\u539f\u7406\" width=\"640\" height=\"392\" loading=\"lazy\"><\/figure>\n<p># compilation.py:695<\/p>\n<p>If not specified, max_cudagraph_capture_size is set to min(max_num_seqs*2, &#8230;)<\/p>\n<p>\u540c\u65f6\u867d\u7136\u2463 \u2464\u4e24\u4e2a\u573a\u666f\u90fd\u5b9e\u73b0\u4e86Prefill\u5165\u56fe\uff0c\u4f46\u5207\u5206\u7684\u60c5\u51b5\u8fd8\u662f\u6709\u5dee\u5f02\u7684\u3002<\/p>\n<p>\u4ee52060\u90a3\u8f6e\u5b9e\u9a8c\u4e3a\u4f8b\uff0c\u2464\u573a\u666f\u4e2d\uff0c\u56e0\u4e3a2060&lt;2079&lt;mnbt\uff0c\u56e0\u6b64Prefill\u4e00\u6b21\u5165\u56fe\uff1b\u2463\u573a\u666f\u4e2d\uff0c2060\u88ab\u5207\u5206\u62102048+12\uff0c\u5176\u4e2d2048\u5339\u914d\u5230\u6863\u4f4d\uff0c\u5165\u56fe\uff0c12\u5411\u4e0a\u53d6\u6574\u523016\u6863\u4f4d\uff0c\u5165\u56fe\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic30.png\" alt=\"\u670d\u52a1\u65e5\u5fd7\u786e\u8ba4\u9ed8\u8ba4\u6863\u4f4d\" width=\"640\" height=\"256\" loading=\"lazy\"><\/figure>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic31.png\" alt=\"\u2463\u573a\u666f 2048+12 \u5207\u5206\u5165\u56fe\u65e5\u5fd7\uff08\u7eed\uff09\" width=\"640\" height=\"301\" loading=\"lazy\"><\/figure>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic32.png\" alt=\"\u2463\u573a\u666f\u5207\u5206\u4e0e\u5165\u56fe\u5b8c\u6574\u65e5\u5fd7\" width=\"640\" height=\"285\" loading=\"lazy\"><\/figure>\n<p>\u6b64\u5916\uff0c\u65e2\u7136\u2463 \u2464\u4e24\u4e2a\u573a\u666f\u90fd\u5b9e\u73b0\u4e86Prefill\u5165\u56fe\uff0c\u4e3a\u4f55TTFT\u8fd8\u4f1a\u76f8\u5dee100ms\u4ee5\u4e0a\uff1f<\/p>\n<p>\u901a\u8fc7\u65e5\u5fd7\u5206\u6790\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic33.png\" alt=\"\u65e5\u5fd7\u5206\u6790\uff1a\u6bb5\u95f4\u7a7a\u9699\u4e0e\u6267\u884c\u8017\u65f6\" width=\"267\" height=\"67\" loading=\"lazy\"><\/figure>\n<p>\u867d\u7136\u2463\u548c\u2464\u90fd\u5b9e\u73b0\u4e86Prefill\u5165\u56fe\uff0c\u4f46\u662f\u591a\u52071\u5757\u4f1a\u591a\u51fa\u768425\u6bb5\uff0c\u6bb5\u4e0e\u6bb5\u4e4b\u95f4\u5927\u6982\u67095ms\u5de6\u53f3\u7684\u7a7a\u9699\uff0cNPU\u5904\u7406\u6267\u884c\u5927\u69820.5ms\u5de6\u53f3\uff0c\u6240\u4ee5\u6bcf\u4e00\u6bb5\u65f6\u95f4\u67094.5ms\u5de6\u53f3\u7684\u7a7a\u9699\u662f\u7a7a\u7b49\uff0c25*4.5=112.5ms\uff0c\u540c\u65f6\u5757\u4e0e\u5feb\u4e4b\u95f4\u5927\u6982\u8fd8\u670920ms\u5de6\u53f3\u7684\u95f4\u9694\uff0c\u5728Decode\u8017\u65f6\u51e0\u4e4e\u76f8\u540c\u7684\u60c5\u51b5\u4e0b\uff0c\u2463\u6bd4\u2464\u5e73\u767d\u591a\u51fa\u4e86132.5ms\u5de6\u53f3\u7684\u6d88\u8017\uff0c\u7b26\u5408338.3-181.8=156.5ms<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic34.png\" alt=\"\u591a\u5207 1 \u5757\u7684\u989d\u5916\u8017\u65f6\u6838\u5bf9\" width=\"397\" height=\"182\" loading=\"lazy\"><\/figure>\n<p>\u8fd9\u91cc\u7b14\u8005\u518d\u6b21\u51fa\u73b0\u4e86\u4e00\u4e2a\u7591\u95ee\uff0c\u5982\u679c\u2462\u573a\u666f\u6ca1\u6709max_num_seqs 1 \uff0c\u9ed8\u8ba4\u7684FAP\u80fd\u5426\u6709\u673a\u4f1a\u5b9e\u73b0\u5165\u56fe\uff1f<\/p>\n<p>\u7b14\u8005\u7528\u5bfc\u5165\u7684sample.jpg\u518d\u6b21\u8fdb\u884c\u4e86\u9a8c\u8bc1\u3002<\/p>\n<p>\u6309\u7167\u4e4b\u524dpython\u6587\u4ef6\u7684\u5b9a\u4e49<\/p>\n<p># compilation.py:695<\/p>\n<p>If not specified, max_cudagraph_capture_size is set to min(max_num_seqs*2, &#8230;)<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic35.png\" alt=\"max_num_seqs \u4e0e capture size \u5173\u7cfb\" width=\"393\" height=\"142\" loading=\"lazy\"><\/figure>\n<p>\u4e3a\u4e86\u5feb\u901f\u9a8c\u8bc1\uff0c\u7b14\u8005\u5148\u5bf9512\u914d\u7f6e\u8fdb\u884c\u4e86\u9a8c\u8bc1\uff0c\u7ed3\u679c\u548c\u9884\u6599\u7684\u8fd8\u662f\u51fa\u73b0\u4e86\u504f\u5dee\uff1a<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic36.png\" alt=\"512 \u914d\u7f6e\u9a8c\u8bc1\u7ed3\u679c\" width=\"317\" height=\"62\" loading=\"lazy\"><\/figure>\n<p>\u8fd9\u8bf4\u660ecapmax\u5e76\u4e0d\u662fmax_num_seqs*2\uff0c\u80af\u5b9a\u6709vllm-ascend\u914d\u7f6e\u6587\u4ef6\u8986\u76d6\u4e86vllm\u7684\u914d\u7f6e\uff1a<\/p>\n<p>vllm_ascend\/platform.py:207  getdefault_max_cudagraph_capture_size()<\/p>\n<p>vllm_ascend\/platform.py:259  default_max_cg_capture_size = cls._get_default_max_cudagraph_capture_size(vllm_config)<\/p>\n<p>vllm_ascend\/platform.py:261  compilation_config.max_cudagraph_capture_size = default_max_cg_capture_size<\/p>\n<p>sed -n &#8216;200,270p&#8217; \/vllm-workspace\/vllm-ascend\/vllm_ascend\/platform.py<\/p>\n<p>return min(max_num_seqs * decode_query_len, 512)<\/p>\n<p>\u7531\u6b64\u53ef\u77e5\uff1a<\/p>\n<p>\u5982\u679c\u4f7f\u7528\u9ed8\u8ba4\u7684FAP\uff0c\u5e76\u4e14\u8981\u652f\u6301\u5982\u6d4b\u8bd5sample.jpg\u7c7b\u4f3c\u7684\u56fe\u8fdb\u884c\u4ea4\u4e92\uff0cmax_num_seqs\u7684\u8bbe\u7f6e\u5c31\u9700\u8981\u8bbe\u7f6e\u5230\u5f88\u5927\uff0c\u800cmax_num_seqs\u8d8a\u5927\uff0c\u9884\u7559\u7684\u663e\u5b58\u8d8a\u591a\uff0c\u542f\u52a8\u65f6\u95f4\u5c31\u8d8a\u6162\u3002<\/p>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic37.png\" alt=\"max_num_seqs \u8d8a\u5927\u542f\u52a8\u8d8a\u6162\" width=\"365\" height=\"89\" loading=\"lazy\"><\/figure>\n<figure class=\"cp-figure\"><img decoding=\"async\" src=\"https:\/\/nelliemylove.cn\/nelliemylove\/wp-content\/themes\/cyberpunk-blog\/assets\/images\/posts\/qwen35-prefill-cudagraph\/pic38.png\" alt=\"\u5e76\u53d1\u4e0e\u6863\u4f4d\u547d\u4e2d\u60c5\u51b5\" width=\"513\" height=\"72\" loading=\"lazy\"><\/figure>\n<p>\u56e0\u6b64\uff0c\u901a\u8fc7\u5b9e\u9a8c\u73af\u5883\uff08vllm-ascend0.23\uff09Prefill\u5165\u56fe\u4f18\u5316TTFT\u548cE2E\u7684\u8981\u70b9\u5728\u4e8e\uff1a<\/p>\n<p>1. \u5b9a\u4e49cudegraphy mode\u662fFAP\u6216\u8005\u4f7f\u7528\u9ed8\u8ba4\u5b9a\u4e49\uff1b<\/p>\n<p>2. \u6307\u5b9asize\uff0c\u5e76\u4e14\u6700\u5927\u6863\u4f4d\u6db5\u76d6prompts\u957f\u5ea6\u7684\u4e3b\u8981\u5206\u5e03\u533a\u95f4\uff1b<\/p>\n<p>3. \u6307\u5b9asize\u7684\u6570\u91cf\u901a\u5e38\u4e0d\u8981\u8d85\u8fc720\u4e2a\uff1b<\/p>\n<p>4. mnbt\u5fc5\u987b\u8981\u8d85\u8fc7\u6700\u5927\u6863\u4f4d\u3002<\/p>\n<p>\u672c\u6587\u7531 \u5976\u8389\u5c0f\u8ddf\u73ed \u539f\u521b\uff0c\u9996\u53d1\u4e8e\u534e\u4e3a\u6607\u817e\u793e\u533a\uff0c\u54e6\u5bf9\u4e86\uff0c\u6211\u5c31\u662f\u5976\u8389\u5c0f\u8ddf\u73ed~~~~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6607\u817e A2 \u5355\u5361 Qwen3.5-0.8B@vLLM-Ascend \u8c03\u4f18\u590d\u76d8\uff1aFAP + 20 \u6863 capture_sizes \u56fa\u5316 Prefill \u5165\u56fe\uff0cMNBT 2304 \u4e00\u6b21\u7b97\u5b8c\uff0cTTFT 383.7\u2192143.2ms\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,65,26],"tags":[],"class_list":["post-693","post","type-post","status-publish","format-standard","hentry","category-ai","category-huawei-ascend","category-tech-share"],"_links":{"self":[{"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/posts\/693","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/comments?post=693"}],"version-history":[{"count":12,"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/posts\/693\/revisions"}],"predecessor-version":[{"id":706,"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/posts\/693\/revisions\/706"}],"wp:attachment":[{"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/media?parent=693"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/categories?post=693"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nelliemylove.cn\/nelliemylove\/index.php\/wp-json\/wp\/v2\/tags?post=693"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}