{"id":81487,"date":"2026-07-25T02:36:19","date_gmt":"2026-07-24T18:36:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/81487.html"},"modified":"2026-07-25T02:36:19","modified_gmt":"2026-07-24T18:36:19","slug":"gfx936-dcu%e4%b8%8a%e5%ae%9e%e7%8e%b0int8-pv-mmac%ef%bc%9av-scale%e8%9e%8d%e5%90%88%e3%80%81%e6%a6%82%e7%8e%87%e9%87%8f%e5%8c%96%e4%b8%8efragment%e5%88%86%e7%bb%84","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/81487.html","title":{"rendered":"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4"},"content":{"rendered":"<h2>gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC&#xff1a;V Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4<\/h2>\n<h3>\u524d\u8a00<\/h3>\n<p>\u672c\u6587\u662f\u7cfb\u5217\u7b2c\u4e09\u7bc7\u3002\u7b2c\u4e00\u7bc7\u4ecb\u7ecd\u5b8c\u6574 INT8 KV \u65b9\u6848&#xff0c;\u7b2c\u4e8c\u7bc7\u4ecb\u7ecd INT8 QK&#xff1b;\u672c\u6587\u805a\u7126 Attention \u7684\u7b2c\u4e8c\u6b21\u77e9\u9635\u4e58\u6cd5 Softmax(Score)\u00d7V&#xff0c;\u4e5f\u5c31\u662f PV\u3002<\/p>\n<p>QK \u7684\u4f4e\u7cbe\u5ea6\u516c\u5f0f\u6bd4\u8f83\u76f4\u63a5&#xff1a;INT8 \u70b9\u79ef\u7ed3\u675f\u540e&#xff0c;\u4e58 Query Scale \u548c Key Scale\u5373\u53ef\u3002PV\u66f4\u9ebb\u70e6&#xff0c;\u56e0\u4e3a\u6bcf\u4e2a\u5386\u53f2 token \u7684Value\u90fd\u6709\u81ea\u5df1\u7684Scale&#xff0c;\u800cPV\u6070\u597d\u6cbf\u5386\u53f2 token\u6c42\u548c\u3002\u8fd9\u4e2aScale\u4e0d\u80fd\u5728\u6574\u6b21\u77e9\u9635\u4e58\u6cd5\u7ed3\u675f\u540e\u7edf\u4e00\u8865\u4e58&#xff0c;\u5fc5\u987b\u5148\u8fdb\u5165\u6982\u7387\u4fa7\u3002<\/p>\n<p>PV\u4e5f\u662f\u6574\u6761\u8def\u7ebf\u4e2d\u6700\u5bb9\u6613\u5199\u9519\u7684\u4e00\u6bb5\u3002\u7b2c\u4e00\u7248\u5185\u6838\u8fd0\u884c\u5f88\u5feb&#xff0c;\u4f46\u63a5\u5165\u670d\u52a1\u540e&#xff0c;\u4e24\u6761\u6b63\u5e38\u56de\u7b54\u90fd\u751f\u6210\u5230\u4e861024 token\u4e0a\u9650\u3002\u6211\u4eec\u6700\u521d\u6000\u7591 INT8 \u7cbe\u5ea6\u4e0d\u8db3&#xff0c;\u9010lane\u91cd\u5efafragment\u540e\u624d\u53d1\u73b0&#xff0c;\u95ee\u9898\u4e0d\u662f\u91cf\u5316\u516c\u5f0f&#xff0c;\u800c\u662f\u6982\u7387Scale\u7684\u5206\u7ec4\u6ca1\u6709\u5bf9\u9f50 gfx936 MMAC\u5b9e\u9645\u6d88\u8d39\u7684token\u3002<\/p>\n<p>\u4fee\u590dScale\u5206\u7ec4\u540e&#xff0c;4K\u30018K\u300116K\u5386\u53f2\u957f\u5ea6\u5206\u522b\u5f97\u52301.1049x\u30011.0979x\u30011.2653x&#xff0c;\u6700\u5927\u7edd\u5bf9\u8bef\u5dee\u4e0d\u9ad8\u4e8e0.000977\u3002\u8fd9\u4e9b\u6570\u636e\u53ea\u8bc1\u660ePV\u5355\u9879\u4f4e\u7cbe\u5ea6\u8ba1\u7b97\u6210\u7acb&#xff0c;\u5b8c\u6574INT8\u94fe\u8def\u7684\u7aef\u5230\u7aef\u4e0e\u5b98\u65b9\u7ed3\u679c\u5df2\u7ecf\u5728\u7b2c\u4e00\u7bc7\u7ed9\u51fa\u3002<\/p>\n<p>\u5bf9\u5e94\u4ee3\u7801\u4f4d\u4e8ecsrc\/rocm\/attention.cu\u7684INT8 PagedAttention\u548cgfx936_int8_prefix_attention_kernel\u4e2d\u3002tools\/xiandao_int8_pv_reference_check.py\u4f7f\u7528CPU fragment\u6a21\u578b\u6838\u5bf9lane\u6620\u5c04&#xff0c;csrc\/rocm\/int8_kv_cache.cu\u8d1f\u8d23\u5728\u4e0a\u6e38\u751f\u6210INT8 V\u548c\u5bf9\u5e94Scale\u3002<\/p>\n<h3>1. \u4e3a\u4ec0\u4e48PV\u4e0d\u80fd\u76f4\u63a5\u5957\u7528QK\u516c\u5f0f<\/h3>\n<p>\u5bf9\u4e00\u4e2aQuery row&#xff0c;PV\u53ef\u4ee5\u5199\u6210&#xff1a;<\/p>\n<p>O &#061; sum_i P_i \u00d7 V_i<\/p>\n<p>\u5176\u4e2di\u904d\u5386\u5386\u53f2token&#xff0c;P_i\u662fsoftmax\u6982\u7387\u3002INT8 KV Cache\u4e3a\u6bcf\u4e2aValue vector\u4fdd\u5b58\u72ec\u7acbScale&#xff1a;<\/p>\n<p>V_i \u2248 Vq_i \u00d7 sV_i<\/p>\n<p>\u4ee3\u5165\u53ef\u5f97&#xff1a;<\/p>\n<p>O \u2248 sum_i P_i \u00d7 Vq_i \u00d7 sV_i<\/p>\n<p>sV_i\u968f\u6c42\u548c\u4e0b\u6807i\u53d8\u5316&#xff0c;\u56e0\u6b64\u4e0d\u80fd\u63d0\u51fa\u6c42\u548c\u53f7\u3002\u4e0b\u9762\u8fd9\u79cd\u5199\u6cd5\u662f\u9519\u8bef\u7684&#xff1a;<\/p>\n<p>O \u2248 MMAC_INT8(Pq,Vq) \u00d7 \u4e00\u4e2a\u7edf\u4e00\u7684sV<\/p>\n<p>\u6700\u7ec8\u91c7\u7528\u7684\u53d8\u6362\u662f\u5148\u628aValue Scale\u878d\u5165\u6982\u7387&#xff1a;<\/p>\n<p>W_i &#061; P_i \u00d7 sV_i<br \/>\nO \u2248 sum_i W_i \u00d7 Vq_i<\/p>\n<p>\u7136\u540e\u5bf9\u4e00\u4e2aMMAC\u5b9e\u9645\u6d88\u8d39\u768432-token group\u4e2d\u7684W\u505a\u52a8\u6001\u91cf\u5316&#xff1a;<\/p>\n<p>sW &#061; max(abs(W_group)) \/ 127<br \/>\nWq &#061; round(W \/ sW)<\/p>\n<p>O_group \u2248 MMAC_INT8(Wq,Vq) \u00d7 sW<\/p>\n<p>\u4e25\u683c\u6765\u8bf4&#xff0c;\u9001\u5165MMAC\u7684\u5df2\u7ecf\u4e0d\u662f\u539f\u59cbsoftmax\u6982\u7387&#xff0c;\u800c\u662f\u878d\u5408\u4e86per-token Value Scale\u7684\u6743\u91cd\u3002\u6587\u7ae0\u4ecd\u5c06\u8fd9\u6bb5\u79f0\u4e3aPV&#xff0c;\u662f\u56e0\u4e3a\u5b83\u5bf9\u5e94Attention\u4e2d\u7684P\u00d7V\u9636\u6bb5&#xff0c;\u4f46\u5185\u6838\u5b9e\u73b0\u5fc5\u987b\u6309W\u00d7Vq\u7406\u89e3\u3002<\/p>\n<p>\u8fd9\u5957\u53d8\u6362\u4e5f\u80fd\u628a\u8bef\u5dee\u6765\u6e90\u62c6\u5f00\u3002\u8bb0&#xff1a;<\/p>\n<p>V_i &#061; sV_i \u00d7 Vq_i &#043; eV_i<br \/>\nW_i &#061; P_i \u00d7 sV_i &#061; sW_g \u00d7 Wq_i &#043; eW_i<\/p>\n<p>\u5219&#xff1a;<\/p>\n<p>O &#8211; O_hat &#061; sum_i P_i \u00d7 eV_i<br \/>\n          &#043; sum_i eW_i \u00d7 Vq_i<\/p>\n<p>\u7b2c\u4e00\u9879\u6765\u81eaV Cache\u91cf\u5316&#xff0c;\u7b2c\u4e8c\u9879\u6765\u81ea\u6982\u7387\u4fa7\u7684\u5206\u7ec4\u91cf\u5316\u3002\u51cf\u5c0fW\u7684\u91cf\u5316\u7ec4\u53ef\u4ee5\u7f29\u5c0fScale\u8986\u76d6\u8303\u56f4&#xff0c;\u5374\u4f1a\u589e\u52a0absmax\u5f52\u7ea6\u548cScale\u6570\u91cf\u3002\u6700\u7ec8\u9009\u62e932 token&#xff0c;\u4e0d\u53ea\u662f\u4e3a\u4e86\u65b9\u4fbf&#xff0c;\u800c\u662f\u56e0\u4e3a\u5b83\u6b63\u597d\u5bf9\u5e94\u4e00\u6b21INT8 MMAC\u7684K\u7ef4&#xff0c;\u80fd\u591f\u907f\u514d\u989d\u5916\u7684\u8de8\u7ec4\u5f52\u7ea6\u3002<\/p>\n<h3>2. \u5728online softmax\u4e2d\u751f\u6210\u4f4e\u7cbe\u5ea6\u6982\u7387<\/h3>\n<p>\u82e5\u5148\u7269\u5316\u5b8c\u6574Score\u6216\u6982\u7387\u77e9\u9635&#xff0c;\u518d\u542f\u52a8\u72ec\u7acb\u91cf\u5316kernel&#xff0c;\u4f1a\u4ea7\u751f\u5927\u91cfHBM\u8bfb\u5199\u3002\u6700\u7ec8\u5185\u6838\u6cbf\u7528FlashAttention\u7684online softmax\u601d\u8def&#xff0c;\u9010\u4e2akey tile\u5904\u7406\u3002QK\u4ea7\u751f\u7684INT32 accumulator\u5148\u6062\u590d\u4e3aFP32 score&#xff1a;<\/p>\n<p>score_i &#061; int32_acc_i \u00d7 sQ \u00d7 sK_i \/ sqrt(d)<\/p>\n<p>\u5e26\u5386\u53f2Prefill\u548cDecode\u90fd\u4e0d\u4f1a\u628a\u5b8c\u6574\u6982\u7387\u77e9\u9635\u5199\u5165\u5168\u5c40\u663e\u5b58&#xff0c;\u4f46\u4e24\u8005\u8fdb\u5165PV\u524d\u7684\u6743\u91cd\u5f62\u5f0f\u5e76\u4e0d\u5b8c\u5168\u76f8\u540c\u3002<\/p>\n<h4>2.1 \u5e26\u5386\u53f2Prefill&#xff1a;\u91cf\u5316\u672a\u5f52\u4e00\u5316\u6743\u91cd<\/h4>\n<p>\u5e26\u5386\u53f2Prefill\u5728\u540c\u4e00\u4e2aAttention\u5185\u6838\u4e2d\u7ef4\u62a4&#xff1a;<\/p>\n<p>m &#061; \u5f53\u524d\u6700\u5927score<br \/>\nl &#061; exp(score-m)\u7684\u7d2f\u8ba1\u548c<br \/>\no &#061; \u5f53\u524d\u8f93\u51fa\u7d2f\u8ba1<\/p>\n<p>\u8bbe\u65e7\u72b6\u6001\u4e3a(m,l,o)&#xff0c;\u65b0tile\u5408\u5e76\u540e\u7684\u6700\u5927\u503c\u4e3am&#039;&#xff1a;<\/p>\n<p>alpha     &#061; exp(m-m&#039;)<br \/>\np_tilde_i &#061; exp(score_i-m&#039;)<\/p>\n<p>\u7136\u540e\u66f4\u65b0&#xff1a;<\/p>\n<p>o &#061; alpha \u00d7 o &#043; sum_i p_tilde_i \u00d7 sV_i \u00d7 Vq_i<br \/>\nl &#061; alpha \u00d7 l &#043; sum_i p_tilde_i<\/p>\n<p>\u5168\u90e8tile\u7ed3\u675f\u540e\u624d\u8ba1\u7b97&#xff1a;<\/p>\n<p>O &#061; o \/ l<\/p>\n<p>\u8fd9\u4e00\u9636\u6bb5\u91cf\u5316\u7684\u662f\u5f53\u524donline softmax\u57fa\u51c6\u4e0b\u7684\u672a\u5f52\u4e00\u5316\u6743\u91cd&#xff1a;<\/p>\n<p>W_i &#061; p_tilde_i \u00d7 sV_i<\/p>\n<h4>2.2 Decode&#xff1a;\u5148\u5728\u5206\u533a\u5185\u5f52\u4e00\u5316<\/h4>\n<p>Decode\u6309256 token\u5212\u5206\u5386\u53f2\u5206\u533a\u3002\u6bcf\u4e2a\u5206\u533a\u5148\u6c42\u51fa\u81ea\u5df1\u7684\u6700\u5927\u503cm_g\u548c\u6307\u6570\u548cl_g&#xff1a;<\/p>\n<p>P_i &#061; exp(score_i-m_g) \/ l_g<br \/>\nW_i &#061; P_i \u00d7 sV_i<\/p>\n<p>\u968f\u540e\u518d\u6309MMAC\u5b9e\u9645\u62e5\u6709\u768432-token group\u91cf\u5316W\u5e76\u6267\u884cPV\u3002\u5206\u533a\u8f93\u51fa\u3001m_g\u548cl_g\u88ab\u4fdd\u7559\u4e0b\u6765&#xff0c;\u6700\u540e\u901a\u8fc7log-sum-exp\u6743\u91cd\u5f52\u5e76\u591a\u4e2a\u5206\u533a\u3002<\/p>\n<p>\u56e0\u6b64&#xff0c;\u66f4\u51c6\u786e\u7684\u8bf4\u6cd5\u662f&#xff1a;Prefill\u91cf\u5316p_tilde\u00d7sV&#xff0c;Decode\u91cf\u5316\u5206\u533a\u5185\u5f52\u4e00\u5316\u540e\u7684P\u00d7sV\u3002\u4e24\u6761\u8def\u5f84\u7684\u5f52\u4e00\u5316\u4f4d\u7f6e\u4e0d\u540c&#xff0c;\u4f46\u5171\u540c\u7ea6\u675f\u662f\u5fc5\u987b\u5148\u628aper-token Value Scale\u6298\u53e0\u8fdb\u6982\u7387\u4fa7&#xff0c;\u518d\u8fdb\u884cINT8\u91cf\u5316\u3002<\/p>\n<p>\u8fd9\u6279\u6743\u91cd\u53ea\u5728\u5bc4\u5b58\u5668\u548cLDS\u4e2d\u5b58\u5728\u3002\u6bcf\u4e2aMMAC-owned group\u4f9d\u6b21\u6267\u884c&#xff1a;<\/p>\n<p>\u8ba1\u7b97W\u7684absmax<br \/>\n\u2192 \u751f\u6210Scale<br \/>\n\u2192 \u5c06W\u91cf\u5316\u4e3aINT8<br \/>\n\u2192 \u8bfb\u53d6\u5206\u9875INT8 V<br \/>\n\u2192 \u6267\u884cINT8 PV MMAC<br \/>\n\u2192 \u5c06\u7ed3\u679c\u6309Scale\u6062\u590d\u5e76\u7d2f\u52a0\u5230FP32\u8f93\u51fa<\/p>\n<p>\u8fd9\u6761\u6570\u636e\u6d41\u907f\u514d\u4e86\u56db\u7c7b\u989d\u5916\u5f00\u9500&#xff1a;<\/p>\n<ul>\n<li>\u5b8c\u6574\u6982\u7387\u77e9\u9635\u7684\u5168\u5c40\u5199\u5165\u548c\u8bfb\u53d6&#xff1b;<\/li>\n<li>\u5b8c\u6574BF16 V\u4e2d\u95f4\u5f20\u91cf&#xff1b;<\/li>\n<li>\u72ec\u7acb\u7684\u6982\u7387\u91cf\u5316kernel&#xff1b;<\/li>\n<li>\u6bcf\u4e2atoken\u5355\u72ec\u6267\u884c\u6d6e\u70b9P\u00d7sV\u00d7V_int8\u3002<\/li>\n<\/ul>\n<p>\u4f46\u6982\u7387\u91cf\u5316\u672c\u8eab\u4e5f\u4e0d\u662f\u514d\u8d39\u64cd\u4f5c\u3002\u6bcf\u4e2agroup\u65b0\u589e\u4e00\u6b21max reduction\u3001\u4e00\u6b21\u5012\u6570\u3001\u820d\u5165\u4ee5\u53ca\u4e00\u4e2aScale\u3002\u53ea\u6709INT8 MMAC\u548cINT8 V\u8bfb\u53d6\u8282\u7701\u7684\u65f6\u95f4\u5927\u4e8e\u8fd9\u4e9b\u6210\u672c&#xff0c;PV\u4f4e\u7cbe\u5ea6\u8def\u5f84\u624d\u6709\u610f\u4e49\u3002<\/p>\n<h3>3. P\u548cV\u5982\u4f55\u6620\u5c04\u5230MMAC<\/h3>\n<p>\u7b2c\u4e8c\u7bc7\u5df2\u7ecf\u4ecb\u7ecd\u8fc7v_mmac_i32_16x16x32_i8\u7684\u901a\u7528fragment\u6620\u5c04&#xff0c;\u8fd9\u91cc\u53ea\u8ba8\u8bbaPV\u4e0e\u8be5\u6307\u4ee4\u7684\u5bf9\u5e94\u5173\u7cfb\u3002 PV\u4e2d\u53ef\u4ee5\u628a16\u4e2aQuery row\u770b\u4f5cM&#xff0c;32\u4e2a\u5386\u53f2token\u770b\u4f5cK&#xff0c;16\u4e2aValue\u8f93\u51fa\u7ef4\u5ea6\u770b\u4f5cN&#xff1a;<\/p>\n<p>Wq:  16 \u00d7 32<br \/>\nVq:  32 \u00d7 16<br \/>\nOut: 16 \u00d7 16<\/p>\n<p>operand A\u62e5\u6709\u8f93\u51fa\u884c&#xff0c;PV\u7684\u8f93\u51fa\u884c\u5bf9\u5e94Query row&#xff0c;\u56e0\u6b64\u81ea\u7136\u6620\u5c04\u4e3a&#xff1a;<\/p>\n<p>A &#061; quantized(P \u00d7 sV)<br \/>\nB &#061; V_int8<\/p>\n<p>\u65e9\u671f\u66fe\u8003\u8651\u6cbf\u7528\u5176\u4ed6\u67b6\u6784\u7684\u987a\u5e8f\u6267\u884cMMAC(V,P)&#xff0c;\u7136\u540e\u5728\u5171\u4eab\u5185\u5b58\u4e2d\u8f6c\u7f6e\u3002\u6570\u5b66\u7ed3\u679c\u7b49\u4ef7&#xff0c;\u4f46lane\u8f93\u51fa\u5f52\u5c5e\u4e0e\u6700\u7ec8\u8f93\u51fa\u7ef4\u5ea6\u4e0d\u4e00\u81f4&#xff0c;\u8fd8\u4f1a\u589e\u52a0\u4e00\u6b21\u590d\u6742\u8f6c\u7f6e\u3002\u6700\u7ec8GPU\u5185\u6838\u548cCPU fragment\u6a21\u578b\u90fd\u56fa\u5b9a\u4e3aP\u5728A\u3001V\u5728B\u3002<\/p>\n<p>\u5bf9\u4e8e\u540c\u6837\u768432-token K\u7ef4&#xff0c;BF16\u9700\u8981\u4e24\u676116\u00d716\u00d716\u6307\u4ee4&#xff0c;INT8\u53ea\u9700\u8981\u4e00\u676116\u00d716\u00d732\u6307\u4ee4\u3002\u540c\u65f6&#xff0c;V\u4e0d\u9700\u8981\u5728\u5bc4\u5b58\u5668\u4e2d\u8f6c\u6210BF16&#xff0c;\u6982\u7387LDS\u7684\u5143\u7d20\u5bbd\u5ea6\u4e5f\u4ece16 bit\u964d\u52308 bit\u3002<\/p>\n<p>\u6838\u5fc3\u6570\u636e\u6d41\u53ef\u4ee5\u7b80\u5316\u4e3a&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ \u5f53\u524donline softmax\u57fa\u51c6\u4e0b\u7684\u672a\u5f52\u4e00\u5316\u6743\u91cd&#xff0c;\u5e76\u5df2\u4e58\u5165V Scale\u3002<\/span><br \/>\n<span class=\"token keyword\">float<\/span> w<span class=\"token punctuation\">[<\/span><span class=\"token number\">32<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">exp_score_times_v_scale<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">float<\/span> amax <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">group_absmax<\/span><span class=\"token punctuation\">(<\/span>w<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">float<\/span> scale <span class=\"token operator\">&#061;<\/span> amax <span class=\"token operator\">\/<\/span> <span class=\"token number\">127.0f<\/span><span class=\"token punctuation\">;<\/span><br \/>\nint8x32 wq <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">quantize_i8<\/span><span class=\"token punctuation\">(<\/span>w<span class=\"token punctuation\">,<\/span>scale<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>int8x32 vq <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">load_v_fragment_from_paged_cache<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">.<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\nint32x4 acc <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">mmac_i32_16x16x32_i8<\/span><span class=\"token punctuation\">(<\/span>wq<span class=\"token punctuation\">,<\/span>vq<span class=\"token punctuation\">,<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> <span class=\"token number\">4<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token operator\">&#043;&#043;<\/span>i<span class=\"token punctuation\">)<\/span><br \/>\n    output<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#043;&#061;<\/span> <span class=\"token keyword\">float<\/span><span class=\"token punctuation\">(<\/span>acc<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">*<\/span> scale<span class=\"token punctuation\">;<\/span><\/p>\n<p>\u771f\u5b9e\u5b9e\u73b0\u753164\u4e2alane\u5171\u540c\u5b8c\u6210&#xff0c;wq\u548cvq\u5206\u6563\u5728wave\u5bc4\u5b58\u5668\u4e2d&#xff0c;\u8de8tile\u7684FP32\u8f93\u51fa\u7d2f\u52a0\u5668\u8fd8\u9700\u8981\u6309alpha\u91cd\u6807\u5b9a\u3002\u5355\u4e2aK&#061;32 MMAC\u7684INT32\u7edd\u5bf9\u4e0a\u754c\u4e3a&#xff1a;<\/p>\n<p>32 \u00d7 127 \u00d7 127 &#061; 516,128<\/p>\n<p>\u6bcf\u4e2atile\u7ed3\u675f\u540e&#xff0c;INT32\u7ed3\u679c\u7acb\u5373\u4e58\u56deScale\u5e76\u7d2f\u52a0\u5230FP32&#xff0c;\u56e0\u6b64\u6574\u6570\u7d2f\u52a0\u5668\u4e0d\u9700\u8981\u8de8\u957f\u5e8f\u5217\u4fdd\u5b58\u3002<\/p>\n<p>V Cache\u7684\u5e03\u5c40\u4e5f\u670d\u52a1\u4e8e\u8fd9\u4e00\u65b9\u5411&#xff1a;<\/p>\n<p>V cache: [block,kv_head,head_dim,block_size]<\/p>\n<p>token\u4f4d\u4e8e\u5185\u5c42&#xff0c;\u4e00\u4e2alane\u53ef\u4ee5\u4e3a\u56fa\u5b9a\u8f93\u51fa\u7ef4\u5ea6\u8fde\u7eed\u8bfb\u53d6\u591a\u4e2atoken\u7684INT8 V\u3002\u6700\u7ec8\u8def\u5f84\u4f7f\u752816-byte vector load&#xff1b;\u66fe\u7ecf\u5c1d\u8bd5\u76848-byte load\u53ea\u88c5\u5165\u4e86lane\u6240\u9700\u6570\u636e\u7684\u4e00\u534a&#xff0c;\u5c5e\u4e8e\u9519\u8bef\u5b9e\u73b0&#xff0c;\u800c\u4e0d\u662f\u66f4\u8f7b\u91cf\u7684\u6027\u80fd\u5019\u9009\u3002<\/p>\n<h3>4. Scale\u5206\u7ec4\u5fc5\u987b\u670d\u4eceMMAC Fragment<\/h3>\n<p>\u8fd9\u6b21\u95ee\u9898\u5b9a\u4f4d\u82b1\u8d39\u4e86\u5f88\u957f\u65f6\u95f4&#xff0c;\u4e5f\u662fPV\u6700\u503c\u5f97\u8bb0\u5f55\u7684\u4e00\u6b21\u9519\u8bef\u3002Decode PagedAttention\u4e2d&#xff0c;\u4e00\u4e2awave\u8986\u76d664\u4e2atoken&#xff0c;\u9700\u8981\u4e24\u6b21K&#061;32\u7684INT8 MMAC\u3002\u6211\u4eec\u6700\u521d\u6309\u903b\u8f91\u8fde\u7eed\u533a\u95f4\u8ba1\u7b97\u6982\u7387Scale&#xff1a;<\/p>\n<p>group 0: token  0-31<br \/>\ngroup 1: token 32-63<\/p>\n<p>\u8fd9\u5728\u666e\u901a\u7ebf\u6027\u5faa\u73af\u4e2d\u5f88\u81ea\u7136&#xff0c;\u5374\u4e0d\u662fgfx936 fragment\u7684\u5b9e\u9645\u6d88\u8d39\u987a\u5e8f\u3002\u4e24\u4e2aMMAC\u771f\u6b63\u53d6\u5f97\u7684token\u5206\u522b\u4e3a&#xff1a;<\/p>\n<p>MMAC 0: {0-7,16-23,32-39,48-55}<br \/>\nMMAC 1: {8-15,24-31,40-47,56-63}<\/p>\n<p>\u4e5f\u5c31\u662f\u8bf4&#xff0c;\u4e00\u4e2aMMAC\u768432\u4e2aK\u5143\u7d20\u7531\u56db\u6bb58-token slice\u4ea4\u7ec7\u7ec4\u6210\u3002\u65e7\u5b9e\u73b0\u4f7f\u7528\u8fde\u7eed0-31\u548c32-63\u7684\u6700\u5927\u503c\u751f\u6210Scale&#xff0c;\u5374\u628a\u7ed3\u679c\u5e94\u7528\u5230\u4ea4\u7ec7fragment&#xff0c;\u4e00\u6761MMAC\u4e2d\u4f1a\u6709\u4e00\u534a\u6982\u7387\u4f7f\u7528\u9519\u8bef\u7684Scale\u3002\u6700\u7ec8\u5185\u6838\u4e0d\u518d\u6839\u636e\u903b\u8f91token\u533a\u95f4\u731c\u6d4b\u5206\u7ec4&#xff0c;\u800c\u662f\u76f4\u63a5\u6839\u636eMMAC\u8f93\u51fa\u5f52\u5c5e\u8ba1\u7b97&#xff1a;<\/p>\n<p><span class=\"token keyword\">const<\/span> <span class=\"token keyword\">int<\/span> token_offset <span class=\"token operator\">&#061;<\/span> rowid <span class=\"token operator\">&#043;<\/span> i <span class=\"token operator\">*<\/span> <span class=\"token number\">4<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">const<\/span> <span class=\"token keyword\">int<\/span> pv_tile <span class=\"token operator\">&#061;<\/span> token_offset <span class=\"token operator\">\/<\/span> <span class=\"token number\">8<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>rowid\u662f16-lane\u5b50\u7ec4\u7f16\u53f7&#xff0c;i\u662f\u6bcf\u4e2alane\u6301\u6709\u7684\u56db\u4e2a\u8f93\u51fa\u3002absmax\u3001inverse Scale\u3001\u6982\u7387\u5199\u5165\u548c\u540e\u7eedfragment load\u5168\u90e8\u4f7f\u7528\u540c\u4e00\u4e2apv_tile\u5b9a\u4e49&#xff0c;\u4e0d\u518d\u7ef4\u62a4\u4e24\u5957\u5bb9\u6613\u5206\u53c9\u7684\u5206\u7ec4\u89c4\u5219\u3002\u4fee\u590d\u524d&#xff0c;\u5355\u72ec\u7684\u91cf\u5316\u53c2\u8003\u8bef\u5dee\u5e76\u4e0d\u5927&#xff0c;native kernel\u5374\u660e\u663e\u504f\u79bbBF16&#xff1a;<\/p>\n<p>\u53c2\u8003INT8 vs BF16:   max_abs &#061; 0.001293<br \/>\nnative INT8 vs BF16: max_abs &#061; 0.062622<\/p>\n<p>\u8fd9\u7ec4\u5dee\u5f02\u8bf4\u660e&#xff0c;\u91cf\u5316\u516c\u5f0f\u672c\u8eab\u6ca1\u6709\u51fa\u73b0\u6570\u91cf\u7ea7\u5f02\u5e38&#xff0c;\u9519\u8bef\u53d1\u751f\u5728\u786c\u4ef6fragment\u6620\u5c04\u3002\u670d\u52a1\u5c42\u7684\u8868\u73b0\u66f4\u660e\u663e\u3002\u6b63\u5e38\u4e24\u6761\u8f93\u51fa\u957f\u5ea6\u4e3a&#xff1a;<\/p>\n<p>[95,12]<\/p>\n<p>\u9519\u8befPV\u5185\u6838\u5374\u751f\u6210&#xff1a;<\/p>\n<p>[1024,1024]<\/p>\n<p>\u8868\u9762\u8f93\u51fa\u541e\u5410\u4ece7.996790 tok\/s\u5347\u523019.200604 tok\/s&#xff0c;TTFT\u548cTPOT\u5374\u6ca1\u6709\u51fa\u73b0\u5bf9\u5e94\u5e45\u5ea6\u7684\u6539\u5584\u3002\u6240\u8c13\u201c2.4\u500d\u541e\u5410\u201d\u6765\u81ea\u6a21\u578b\u4e00\u76f4\u4e0d\u80fd\u751f\u6210EOS&#xff0c;\u4e0d\u662f\u6027\u80fd\u63d0\u5347\u3002<\/p>\n<p>\u4ece\u8fd9\u6b21\u95ee\u9898\u4ee5\u540e&#xff0c;PV\u9a8c\u8bc1\u5fc5\u987b\u540c\u65f6\u6ee1\u8db3&#xff1a;<\/p>\n<ul>\n<li>Scale\u6309MMAC\u5b9e\u9645\u62e5\u6709\u7684token\u8ba1\u7b97&#xff1b;<\/li>\n<li>Wq\u5199\u5165\u548cfragment\u8bfb\u53d6\u4f7f\u7528\u540c\u4e00\u6620\u5c04&#xff1b;<\/li>\n<li>CPU reference\u4f7f\u7528\u540c\u4e00token group&#xff1b;<\/li>\n<li>native-vs-reference\u548cquantized-vs-BF16\u540c\u65f6\u901a\u8fc7&#xff1b;<\/li>\n<li>\u670d\u52a1\u8f93\u51fa\u957f\u5ea6\u548c\u6587\u672c\u4fdd\u6301\u5408\u7406\u3002<\/li>\n<\/ul>\n<p>\u53ea\u68c0\u67e5kernel\u662f\u5426\u5b8c\u6210\u3001\u8f93\u51fa\u662f\u5426\u4e3a\u6709\u9650\u6570&#xff0c;\u65e0\u6cd5\u53d1\u73b0\u8fd9\u7c7b\u9519\u8bef\u3002<\/p>\n<h3>5. \u4fee\u590d\u540e\u7684PV\u7b97\u5b50\u7ed3\u679c<\/h3>\n<p>\u4fee\u590dScale\u5206\u7ec4\u540e&#xff0c;\u6211\u4eec\u5728\u540c\u4e00\u4e2a\u539f\u751fINT8 Cache Attention\u5185\u6838\u4e2d&#xff0c;\u4ec5\u5207\u6362BF16 PV\u4e0eINT8 PV&#xff1a;<\/p>\n<table>\n<tr>\u5386\u53f2\u957f\u5ea6BF16 PVINT8 PV\u52a0\u901f\u6700\u5927\u7edd\u5bf9\u8bef\u5deeRMS\u8bef\u5dee<\/tr>\n<tbody>\n<tr>\n<td align=\"right\">4K<\/td>\n<td align=\"right\">57.149 us<\/td>\n<td align=\"right\">51.725 us<\/td>\n<td align=\"right\">1.1049x<\/td>\n<td align=\"right\">0.000977<\/td>\n<td align=\"right\">0.000252<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">8K<\/td>\n<td align=\"right\">74.186 us<\/td>\n<td align=\"right\">67.568 us<\/td>\n<td align=\"right\">1.0979x<\/td>\n<td align=\"right\">0.000732<\/td>\n<td align=\"right\">0.000179<\/td>\n<\/tr>\n<tr>\n<td align=\"right\">16K<\/td>\n<td align=\"right\">120.989 us<\/td>\n<td align=\"right\">95.619 us<\/td>\n<td align=\"right\">1.2653x<\/td>\n<td align=\"right\">0.000488<\/td>\n<td align=\"right\">0.000122<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0a\u4e0b\u6587\u8d8a\u957f&#xff0c;INT8 PV\u7684\u6536\u76ca\u8d8a\u660e\u663e\u3002\u56fa\u5b9a\u7684\u6982\u7387\u91cf\u5316\u3001Scale\u548c\u540c\u6b65\u5f00\u9500\u4f1a\u88ab\u66f4\u591aV\u8bfb\u53d6\u4e0e\u77e9\u9635\u4e58\u6cd5\u644a\u8584\u3002<\/p>\n<p>\u8fd9\u5f20\u8868\u7684\u5bf9\u7167\u8fb9\u754c\u4e3b\u8981\u6ce8\u610f&#xff1a;\u4e24\u4fa7\u5df2\u7ecf\u5171\u540c\u4f7f\u7528INT8 Cache\u548cINT8 QK&#xff0c;\u552f\u4e00\u53d8\u91cf\u662fPV\u5185\u90e8\u91c7\u7528BF16\u77e9\u9635\u8ba1\u7b97\u8fd8\u662fINT8 MMAC\u3002\u56e0\u6b64\u5b83\u80fd\u8bc1\u660e\u201cPV\u6539\u7528INT8 MMAC\u201d\u5728\u8be5\u5185\u6838\u4e2d\u6709\u6536\u76ca&#xff0c;\u4f46\u8fd8\u4e0d\u80fd\u8bc1\u660e\u4ece\u5b8c\u6574BF16\u670d\u52a1\u5207\u6362\u5230\u5b8c\u6574INT8\u670d\u52a1\u4f1a\u5f97\u5230\u540c\u6837\u6bd4\u4f8b\u3002<\/p>\n<p>\u6700\u7ec8INT8 PV\u4e0eINT8 QK\u3001\u878d\u5408producer\u548c\u9009\u62e9\u6027Prefill\u4e00\u8d77\u8fdb\u5165\u6b63\u5f0f\u63d0\u4ea4\u3002\u5b8c\u6574\u94fe\u8def\u7684\u670d\u52a1\u6570\u636e\u548c\u5b98\u65b9\u8bc4\u6d4b\u89c1\u7b2c\u4e00\u7bc7&#xff0c;\u5e73\u53f0\u6ca1\u6709\u63d0\u4f9bPV\u5355\u9879\u62c6\u5206\u3002<\/p>\n<h3>6. \u8e29\u5751\u7ecf\u5386<\/h3>\n<p>\u9664\u4e86\u524d\u9762\u7684Scale\u5206\u7ec4\u9519\u8bef&#xff0c;\u6211\u4eec\u8fd8\u5728\u8bbf\u5b58\u5bbd\u5ea6\u3001\u5206\u533a\u5927\u5c0f\u548c\u91cf\u5316\u7c92\u5ea6\u4e0a\u8d70\u8fc7\u51e0\u6761\u5f2f\u8def\u3002\u8fd9\u4e9b\u5c1d\u8bd5\u6709\u7684\u6027\u80fd\u4e0d\u7406\u60f3&#xff0c;\u6709\u7684\u5219\u662f\u770b\u8d77\u6765\u66f4\u5feb&#xff0c;\u5b9e\u9645\u5c11\u8ba1\u7b97\u4e86\u6570\u636e\u3002<\/p>\n<p>\u6700\u5178\u578b\u7684\u662f8-byte V load\u3002\u5b83\u770b\u8d77\u6765\u6bd416-byte load\u66f4\u7075\u6d3b&#xff0c;\u5b9e\u6d4b\u901f\u5ea6\u4e5f\u4e00\u5ea6\u66f4\u5feb&#xff0c;\u4f46\u9010lane\u6838\u5bf9\u540e\u53d1\u73b0&#xff0c;\u5b83\u53ea\u53d6\u5f97\u4e86\u5f53\u524dfragment\u6240\u970016\u4e2atoken\u7684\u4e00\u534a\u3002\u8fd9\u4e0d\u662f\u4e00\u4e2a\u8f83\u5feb\u7684\u4f18\u5316\u7248\u672c&#xff0c;\u800c\u662f\u6ca1\u6709\u5b8c\u6210\u5168\u90e8\u8ba1\u7b97\u7684\u9519\u8bef\u5b9e\u73b0\u3002\u6700\u7ec8\u8def\u5f84\u6062\u590d\u4e3a16-byte vector load\u3002\u7c7b\u4f3c\u7684\u95ee\u9898\u4e5f\u51fa\u73b0\u5728partition 512\u4e0a&#xff1a;\u65e9\u671f\u5b9e\u73b0\u7684\u5730\u5740\u6620\u5c04\u4e0efour-wave launch\u4e0d\u4e00\u81f4&#xff0c;\u4f1a\u8d8a\u8fc7\u6bcf\u4e2afragment\u5b9e\u9645\u62e5\u6709\u7684\u6570\u636e\u8303\u56f4&#xff1b;\u5373\u4f7f\u4fee\u6b63\u5bfb\u5740&#xff0c;\u6027\u80fd\u4e5f\u6ca1\u6709\u7a33\u5b9a\u4f18\u52bf&#xff0c;\u56e0\u6b64Decode\u6700\u7ec8\u4fdd\u7559256-token partition\u3002<\/p>\n<p>\u6211\u4eec\u8fd8\u5c1d\u8bd5\u8fc7\u4e3a\u6574\u4e2apartition\u53ea\u8ba1\u7b97\u4e00\u4e2aprobability Scale&#xff0c;\u5e0c\u671b\u51cf\u5c11Scale\u6570\u91cf\u3002\u4f46\u8fd9\u79cd\u505a\u6cd5\u9700\u8981\u989d\u5916\u7684\u8de8wave max reduction&#xff0c;\u589e\u52a0\u540c\u6b65\u5f00\u9500&#xff0c;\u800c\u4e14\u66f4\u5927\u7684\u91cf\u5316\u8303\u56f4\u4f1a\u964d\u4f4e\u6709\u6548\u7cbe\u5ea6\u3002\u6700\u7ec8\u9009\u62e9\u8ba9\u6bcf\u4e2aMMAC\u5b9e\u9645\u62e5\u6709\u768432-token group\u72ec\u7acb\u8ba1\u7b97Scale\u3002\u8fd9\u4e2a\u7c92\u5ea6\u65e2\u4e0e16\u00d716\u00d732\u6307\u4ee4\u7684K\u7ef4\u4e00\u81f4&#xff0c;\u4e5f\u4e0d\u9700\u8981\u989d\u5916\u8de8\u7ec4\u5f52\u7ea6\u3002<\/p>\n<p>\u53e6\u4e00\u6761\u770b\u4f3c\u7a33\u59a5\u7684\u8def\u7ebf\u662f\u5148\u628aINT8 V\u6062\u590d\u4e3a\u5b8c\u6574BF16 V&#xff0c;\u518d\u8c03\u7528\u539f\u6709PV\u3002\u8fd9\u6837\u867d\u7136\u5bb9\u6613\u590d\u7528\u6210\u719f\u5185\u6838&#xff0c;\u5374\u4f1a\u589e\u52a0\u4e2d\u95f4\u5f20\u91cf\u7684\u5199\u5165\u548c\u8bfb\u53d6&#xff0c;\u4e5f\u5b8c\u5168\u7528\u4e0d\u4e0aINT8 MMAC\u3002\u5373\u4f7f\u4e0d\u5199\u56de\u5168\u5c40\u663e\u5b58&#xff0c;\u53ea\u5728\u5bc4\u5b58\u5668\u4e2d\u9010fragment\u53cd\u91cf\u5316&#xff0c;\u7c7b\u578b\u8f6c\u6362\u548cScale\u6307\u4ee4\u4ecd\u53ef\u80fd\u62b5\u6d88INT8 V\u51cf\u5c11\u7684\u8bfb\u53d6\u5f00\u9500\u3002<\/p>\n<p>\u6982\u7387\u91c7\u7528UINT8\u4e5f\u66fe\u88ab\u5217\u4e3a\u5019\u9009\u3002softmax\u6982\u7387\u548cP\u00d7sV\u90fd\u975e\u8d1f&#xff0c;UINT8\u76840-255\u6bd4signed INT8\u76840-127\u591a\u4e00\u4f4d\u6709\u6548\u7cbe\u5ea6&#xff0c;\u7406\u8bba\u4e0a\u5177\u6709\u5438\u5f15\u529b\u3002\u4f46V\u4f7f\u7528\u5bf9\u79f0signed INT8&#xff0c;\u6982\u7387\u5355\u72ec\u6539\u4e3aUINT8\u8fd8\u9700\u8981\u53ef\u7528\u4e14\u9ad8\u6548\u7684mixed-signed\u6307\u4ee4\u8def\u5f84&#xff0c;\u6216\u8005\u5bf9V\u589e\u52a0\u504f\u79fb\u548c\u8865\u507f&#xff1b;\u540e\u8005\u4f1a\u5f15\u5165\u65b0\u7684\u5f52\u7ea6\u4e0e\u6821\u6b63\u3002\u6bd4\u8d5b\u7ed3\u675f\u524d&#xff0c;\u6211\u4eec\u6ca1\u6709\u5f97\u5230\u4e00\u6761\u540c\u65f6\u901a\u8fc7\u6b63\u786e\u6027\u548c\u6027\u80fd\u9a8c\u8bc1\u7684UINT8\u00d7INT8\u8def\u5f84&#xff0c;\u56e0\u6b64\u6700\u7ec8\u4ee3\u7801\u53ea\u4fdd\u7559signed INT8\u3002\u5f53\u524d\u65b9\u6848\u6309\u6bcf\u4e2a32-token group\u72ec\u7acb\u8ba1\u7b97Scale&#xff0c;\u8bef\u5dee\u5df2\u7ecf\u63a7\u5236\u57281e-3\u91cf\u7ea7&#xff1b;\u5bf9\u5b9e\u9645\u5185\u6838\u800c\u8a00&#xff0c;\u51cf\u5c11\u8f6c\u6362\u3001\u8865\u507f\u548c\u540c\u6b65&#xff0c;\u6bd4\u5355\u7eaf\u589e\u52a0\u4e00\u4e2abit\u7684\u6b63\u6570\u7f16\u7801\u8303\u56f4\u66f4\u91cd\u8981\u3002<\/p>\n<h3>7. \u7ed3\u8bed<\/h3>\n<p>\u5c06Softmax\u00d7V\u6539\u6210INT8 MMAC&#xff0c;\u6838\u5fc3\u4e0d\u662f\u628a\u6982\u7387\u76f4\u63a5\u8f6c\u6362\u4e3aINT8&#xff0c;\u800c\u662f\u5148\u628aper-token Value Scale\u6b63\u786e\u6298\u53e0\u8fdbonline softmax\u6743\u91cd&#xff0c;\u518d\u6309\u7167MMAC\u5b9e\u9645\u6d88\u8d39\u768432-token fragment\u8ba1\u7b97Scale\u548c\u91cf\u5316\u3002<\/p>\n<p>\u6700\u7ec8\u53ef\u4ee5\u786e\u8ba4&#xff1a;\u4fee\u590dfragment\u5206\u7ec4\u540e&#xff0c;4K\u30018K\u300116K\u7684PV\u5355\u9879\u5206\u522b\u8fbe\u52301.1049x\u30011.0979x\u30011.2653x&#xff0c;\u6700\u5927\u7edd\u5bf9\u8bef\u5dee\u4e0d\u9ad8\u4e8e0.000977\u3002<\/p>\n<p>QK\u7684\u56f0\u96be\u4e3b\u8981\u662f\u5206\u9875K\u4f9b\u6570\u548cGQA\u6620\u5c04&#xff0c;PV\u7684\u56f0\u96be\u5219\u662fScale\u4f4d\u4e8e\u6c42\u548c\u7ef4\u5ea6\u3001\u6982\u7387\u9700\u8981\u518d\u6b21\u91cf\u5316&#xff0c;\u4ee5\u53ca\u6570\u5b66\u5206\u7ec4\u5fc5\u987b\u670d\u4ece\u786c\u4ef6fragment\u3002\u4e24\u90e8\u5206\u5171\u540c\u6210\u7acb&#xff0c;INT8 KV\u624d\u771f\u6b63\u4ece\u5b58\u50a8\u683c\u5f0f\u53d8\u6210\u53ef\u88ab\u4f4e\u7cbe\u5ea6\u77e9\u9635\u5355\u5143\u76f4\u63a5\u6d88\u8d39\u7684\u6570\u636e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC&#xff1a;V Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4<br \/>\n\u524d\u8a00<br \/>\n\u672c\u6587\u662f\u7cfb\u5217\u7b2c\u4e09\u7bc7\u3002\u7b2c\u4e00\u7bc7\u4ecb\u7ecd\u5b8c\u6574 INT8 KV \u65b9\u6848&#xff0c;\u7b2c\u4e8c\u7bc7\u4ecb\u7ecd INT8 QK&#xff1b;\u672c\u6587\u805a\u7126 Attention \u7684\u7b2c\u4e8c\u6b21\u77e9\u9635\u4e58\u6cd5 Softmax(Score)\u00d7V&#xff0c;\u4e5f\u5c31\u662f PV\u3002<br \/>\nQK \u7684\u4f4e\u7cbe\u5ea6\u516c\u5f0f\u6bd4\u8f83\u76f4\u63a5&#xff1a;INT8 \u70b9\u79ef\u7ed3\u675f\u540e&#xff0c;\u4e58 Query Scale \u548c Key Scal<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,50,427],"topic":[],"class_list":["post-81487","post","type-post","status-publish","format-standard","hentry","category-server","tag-linux","tag-50","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/81487.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC&#xff1a;V Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4 \u524d\u8a00 \u672c\u6587\u662f\u7cfb\u5217\u7b2c\u4e09\u7bc7\u3002\u7b2c\u4e00\u7bc7\u4ecb\u7ecd\u5b8c\u6574 INT8 KV \u65b9\u6848&#xff0c;\u7b2c\u4e8c\u7bc7\u4ecb\u7ecd INT8 QK&#xff1b;\u672c\u6587\u805a\u7126 Attention \u7684\u7b2c\u4e8c\u6b21\u77e9\u9635\u4e58\u6cd5 Softmax(Score)\u00d7V&#xff0c;\u4e5f\u5c31\u662f PV\u3002 QK \u7684\u4f4e\u7cbe\u5ea6\u516c\u5f0f\u6bd4\u8f83\u76f4\u63a5&#xff1a;INT8 \u70b9\u79ef\u7ed3\u675f\u540e&#xff0c;\u4e58 Query Scale \u548c Key Scal\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/81487.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-24T18:36:19+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/81487.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/81487.html\",\"name\":\"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-24T18:36:19+00:00\",\"dateModified\":\"2026-07-24T18:36:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/81487.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/81487.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/81487.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/81487.html","og_locale":"zh_CN","og_type":"article","og_title":"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC&#xff1a;V Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4 \u524d\u8a00 \u672c\u6587\u662f\u7cfb\u5217\u7b2c\u4e09\u7bc7\u3002\u7b2c\u4e00\u7bc7\u4ecb\u7ecd\u5b8c\u6574 INT8 KV \u65b9\u6848&#xff0c;\u7b2c\u4e8c\u7bc7\u4ecb\u7ecd INT8 QK&#xff1b;\u672c\u6587\u805a\u7126 Attention \u7684\u7b2c\u4e8c\u6b21\u77e9\u9635\u4e58\u6cd5 Softmax(Score)\u00d7V&#xff0c;\u4e5f\u5c31\u662f PV\u3002 QK \u7684\u4f4e\u7cbe\u5ea6\u516c\u5f0f\u6bd4\u8f83\u76f4\u63a5&#xff1a;INT8 \u70b9\u79ef\u7ed3\u675f\u540e&#xff0c;\u4e58 Query Scale \u548c Key Scal","og_url":"https:\/\/www.wsisp.com\/helps\/81487.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-24T18:36:19+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/81487.html","url":"https:\/\/www.wsisp.com\/helps\/81487.html","name":"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-24T18:36:19+00:00","dateModified":"2026-07-24T18:36:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/81487.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/81487.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/81487.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"gfx936 DCU\u4e0a\u5b9e\u73b0INT8 PV MMAC\uff1aV Scale\u878d\u5408\u3001\u6982\u7387\u91cf\u5316\u4e0eFragment\u5206\u7ec4"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/81487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=81487"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/81487\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=81487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=81487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=81487"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=81487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}