<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[4 x Tesla V100 32G, Maya-DS4, DeepSeek-V4.1-Flash-1017 EXL3 2.9bpw, decode 37 tok/s, prefill 640 tok/s, 部署,調優與避坑紀錄]]></title><description><![CDATA[<p dir="auto">DeepSeek-V4.1-Flash-1017 在4台GB10上表現不錯, 又看到DGX論壇上EXL3 2.9bpw量化品質似乎不差, 所以想在我的v100 32G x 4上面試試, 跑了一陣子感覺還可以, 就是prefill有點慢, 尚待優化. 以下為部署,調優與避坑紀錄.</p>
<p dir="auto"><strong>主機環境</strong>：AMD EPYC 7K62 48-Core / 96-Thread，128GB RAM，4 × NVIDIA Tesla V100-SXM2 32GB</p>
<hr />
<h2>1. 模型與運行設定</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="text-align:left">項目</th>
<th style="text-align:left">正式線上生產配置 (Production)</th>
<th style="text-align:left">備註說明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left"><strong>模型全名</strong></td>
<td style="text-align:left"><code>DeepSeek-V4.1-Flash-1017 EXL3 2.9bpw</code></td>
<td style="text-align:left">含 Engram 1017 專家分片</td>
</tr>
<tr>
<td style="text-align:left"><strong>模型權重路徑</strong></td>
<td style="text-align:left"><code>~/deepseek-v4.1-flash-1017/packs/maya-ds4</code></td>
<td style="text-align:left">EXL3 量化權重</td>
</tr>
<tr>
<td style="text-align:left"><strong>引擎軟體</strong></td>
<td style="text-align:left"><code>maya-ds4</code> (專案路徑: <code>project-maya</code>)</td>
<td style="text-align:left">版本: <strong>1.1.41</strong> (Git commit <code>bcf379f</code>)</td>
</tr>
<tr>
<td style="text-align:left"><strong>上下文上限 (Context)</strong></td>
<td style="text-align:left"><strong>500,000 tokens</strong> (<code>--max-context 500000</code>)</td>
<td style="text-align:left">實測至 497,714 tokens 100% 針檢索通過</td>
</tr>
<tr>
<td style="text-align:left"><strong>預設取樣設定</strong></td>
<td style="text-align:left"><code>temperature=0.4</code>, <code>reasoning_effort="high"</code></td>
<td style="text-align:left">支援 Thinking 思考鏈輸出</td>
</tr>
<tr>
<td style="text-align:left"><strong>DSpark 配置</strong></td>
<td style="text-align:left"><strong>DSpark OFF</strong> (<code>--dspark none</code>)</td>
<td style="text-align:left">釋放 GPU 1 被夾困的 7.5GB VRAM</td>
</tr>
<tr>
<td style="text-align:left"><strong>GPU 分割與專家配置</strong></td>
<td style="text-align:left">GPU 0–3 各承載 28.6~28.7 GB 專家（共 15,467 專家在 VRAM）</td>
<td style="text-align:left">GPU VRAM 餘裕 ~400 MiB</td>
</tr>
<tr>
<td style="text-align:left"><strong>主機 RAM 專家 (Direct RAM)</strong></td>
<td style="text-align:left"><strong>98.4 GB 常駐 Anonymous Heap</strong> (<code>--mmap-experts off</code>)</td>
<td style="text-align:left"><code>DS4_REQUIRE_ALL_RAM=1</code>, <code>DS4_COPY_GB=90</code></td>
</tr>
<tr>
<td style="text-align:left"><strong>Prefill Chunk 大小</strong></td>
<td style="text-align:left"><strong>4096 tokens</strong> (<code>--prefill-chunk 4096</code>)</td>
<td style="text-align:left">對齊 <code>kVlRows=4096</code> 流水線最優塊</td>
</tr>
<tr>
<td style="text-align:left"><strong>Attention 核心</strong></td>
<td style="text-align:left"><code>DS4_ATTN_V7=0</code></td>
<td style="text-align:left">SM70 架構最優穩定 Tensor Core Attention</td>
</tr>
<tr>
<td style="text-align:left"><strong>資源守護底線</strong></td>
<td style="text-align:left"><code>MemAvailable &gt;= 15.0 GiB</code>, <code>Engine VmSwap = 0</code></td>
<td style="text-align:left">500K Prefill 期間允許暫降至 10.0 GiB</td>
</tr>
</tbody>
</table>
<hr />
<h2>2. Repo 更新與核心優化</h2>
<h3>A. 上游 v1.1.41 程式碼同步</h3>
<ul>
<li><strong>上游基礎版本</strong>：同步自官方 <code>origin/main</code>（commit <code>9030b73</code>，tag <code>v1.1.41</code>）。</li>
<li><strong>合併分支</strong>：<code>integration/sync-upstream-v1141</code> -&gt; Fast-Forward 合併至 <code>production/upstream-20261027</code>。</li>
<li><strong>主要增強</strong>：
<ol>
<li>啟用 Volta Tensor Core WMMA GEMM 矩陣運算核心（<code>EXL3_WMMA_V70</code>）。</li>
<li>升級 Prefill DMA 排程與批次流式傳輸機制。</li>
<li>保留本地多 GPU 區塊取消界限守護（<code>ds4_chunk_cancel::Boundary</code>），與上游 <code>yield_to</code> / <code>run_yields</code> 協同運作。</li>
<li>保留本地自研之零命中跳過邏輯，與上游 <code>DS4_SKIP_UNPICKED</code> 實現雙軌相容。</li>
</ol>
</li>
</ul>
<h3>B. Zero-hit Expert Transfer Skipping (<code>DS4_SKIP_ZERO_EXPERTS=1</code>)</h3>
<ul>
<li><strong>核心機制</strong>：在 Prefill 階段，各層於 GPU 完成 Top-K Routing 後，檢查 <code>cur_bounds[v+1] == cur_bounds[v]</code>。若命中 Token 數為 0，則跳過該冷專家的 PCIe DMA 傳輸。</li>
<li><strong>傳輸節省</strong>：
<ul>
<li>32K Prefill：節省 <strong>66.9% ~ 73.2%</strong> 的 H2D 傳輸量。</li>
<li>128K Prefill：節省 <strong>65.6% ~ 70.3%</strong> 的 H2D 傳輸量。</li>
<li>500K Prefill：節省 <strong>82.9%</strong> 的 H2D 傳輸量（GPU 0/1 傳輸量從 3.03TB 驟降至 503GB）。</li>
</ul>
</li>
<li><strong>品質保證</strong>：不修改 EXL3 權重、不修改 Top-K 結果、不漏算任何有效 Token，貪婪輸出與原始版本維持 Bit-Exact 完全一致。</li>
</ul>
<h3>C. Direct RAM 啟動 Compaction 防護</h3>
<p dir="auto">針對 Direct RAM（98.4GB）啟動時容易因 Linux 核心記憶體碎片引發 <code>migrate_longterm_unpinnable_folios</code> 導致長達 10 分鐘卡頓的問題，實施兩項核心修復：</p>
<ol>
<li><strong>Buddyinfo 自適應 THP 檢測</strong> (<a href="src/ds4/ds4_os.hpp"><code>ds4_os.hpp</code></a>)：<br />
動態檢查 <code>/proc/buddyinfo</code>。僅在系統擁有足夠的連續 2MB 頁框時才啟用 <code>MADV_HUGEPAGE</code>；若碎片化嚴重則自動回退為標準 4KB 頁框，徹底杜絕核心逐頁遷移與 Compaction 重試停頓。</li>
<li><strong>8 執行緒並行 <code>cudaHostRegister</code></strong> (<a href="src/ds4/ds4_model.cu"><code>ds4_model.cu</code></a>)：<br />
將 61 個層的 Host Memory Pinned 註冊改為 8 條執行緒並行執行，加速完成 DMA 映射。</li>
</ol>
<hr />
<h2>3. 最新實測效能與驗證資訊</h2>
<h3>A. Cold Prefill &amp; Decode 效能矩陣</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="text-align:left">評測維度</th>
<th style="text-align:center">原始基準 (Skip OFF)</th>
<th style="text-align:center">前期版本 (Skip ON)</th>
<th style="text-align:center"><strong>最新 v1.1.41 (Skip ON)</strong></th>
<th style="text-align:center">較前期提升</th>
<th style="text-align:center">較原始基準提升</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left"><strong>32K Cold Prefill (Tok/s)</strong></td>
<td style="text-align:center">429.0 tok/s</td>
<td style="text-align:center">486.5 tok/s</td>
<td style="text-align:center"><strong>605.9 tok/s</strong></td>
<td style="text-align:center"><strong>+24.5%</strong> <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/1f680.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--rocket" style="height:1.4em;width:auto;vertical-align:middle" title="🚀" alt="🚀" /></td>
<td style="text-align:center"><strong>+41.2%</strong> <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/1f680.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--rocket" style="height:1.4em;width:auto;vertical-align:middle" title="🚀" alt="🚀" /></td>
</tr>
<tr>
<td style="text-align:left"><strong>32K TTFT 首字延遲</strong></td>
<td style="text-align:center">73.30 s</td>
<td style="text-align:center">64.66 s</td>
<td style="text-align:center"><strong>52.21 s</strong></td>
<td style="text-align:center"><strong>-12.45 s</strong></td>
<td style="text-align:center"><strong>-21.09 s</strong></td>
</tr>
<tr>
<td style="text-align:left"><strong>32K Decode (Tok/s)</strong></td>
<td style="text-align:center">34.60 tok/s</td>
<td style="text-align:center">34.71 tok/s</td>
<td style="text-align:center"><strong>37.39 tok/s</strong></td>
<td style="text-align:center"><strong>+7.7%</strong></td>
<td style="text-align:center"><strong>+8.1%</strong></td>
</tr>
<tr>
<td style="text-align:left"><strong>32K Needle 正確性</strong></td>
<td style="text-align:center">100%</td>
<td style="text-align:center">100%</td>
<td style="text-align:center"><strong>100% (Pass)</strong></td>
<td style="text-align:center">一致</td>
<td style="text-align:center">一致</td>
</tr>
<tr>
<td style="text-align:left"><strong>128K Cold Prefill (Tok/s)</strong></td>
<td style="text-align:center">462.0 tok/s</td>
<td style="text-align:center">500.0 tok/s</td>
<td style="text-align:center"><strong>640.3 tok/s</strong></td>
<td style="text-align:center"><strong>+28.1%</strong> <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/1f680.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--rocket" style="height:1.4em;width:auto;vertical-align:middle" title="🚀" alt="🚀" /></td>
<td style="text-align:center"><strong>+38.6%</strong> <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/1f680.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--rocket" style="height:1.4em;width:auto;vertical-align:middle" title="🚀" alt="🚀" /></td>
</tr>
<tr>
<td style="text-align:left"><strong>128K TTFT 首字延遲</strong></td>
<td style="text-align:center">281.95 s</td>
<td style="text-align:center">260.59 s</td>
<td style="text-align:center"><strong>203.90 s</strong></td>
<td style="text-align:center"><strong>-56.69 s</strong></td>
<td style="text-align:center"><strong>-78.05 s</strong></td>
</tr>
<tr>
<td style="text-align:left"><strong>128K Decode (Tok/s)</strong></td>
<td style="text-align:center">29.80 tok/s</td>
<td style="text-align:center">30.22 tok/s</td>
<td style="text-align:center"><strong>37.13 tok/s</strong></td>
<td style="text-align:center"><strong>+22.9%</strong> <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/1f680.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--rocket" style="height:1.4em;width:auto;vertical-align:middle" title="🚀" alt="🚀" /></td>
<td style="text-align:center"><strong>+24.6%</strong> <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/1f680.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--rocket" style="height:1.4em;width:auto;vertical-align:middle" title="🚀" alt="🚀" /></td>
</tr>
<tr>
<td style="text-align:left"><strong>128K Needle 正確性</strong></td>
<td style="text-align:center">100%</td>
<td style="text-align:center">100%</td>
<td style="text-align:center"><strong>100% (Pass)</strong></td>
<td style="text-align:center">一致</td>
<td style="text-align:center">一致</td>
</tr>
</tbody>
</table>
<h3>B. 功能與穩定性測試</h3>
<ol>
<li><strong>單元測試套件</strong>：
<ul>
<li><code>python3 -m unittest tools.test_ds4_pack serve.test_server</code>：<strong>145/145 測試全部通過</strong>（耗時 35.3s）。</li>
</ul>
</li>
<li><strong>Thinking 思考鏈推理</strong>：
<ul>
<li>驗證 Prompt：<code>How many letters in the word "apple"? Output reasoning and answer.</code></li>
<li>3.77s 內順利回傳 <code>reasoning_content</code> 與標準解答，思考鏈標籤未發生截斷或錯位。</li>
</ul>
</li>
<li><strong>Tool Calling 結構化調用</strong>：
<ul>
<li>驗證 Prompt：<code>What is the stock price of NVDA?</code> + <code>lookup_stock</code> tools schema。</li>
<li>成功命中並回傳標準 OpenAI tool_calls JSON 結構：<code>{'name': 'lookup_stock', 'arguments': '{"ticker":"NVDA"}'}</code>。</li>
</ul>
</li>
<li><strong>長上下文能力</strong>：
<ul>
<li>通過 500,000 邊界保護測試（<code>&lt;= 500000</code> 正常運作，<code>&gt; 500000</code> 正常回傳 400 錯誤）。</li>
</ul>
</li>
</ol>
<hr />
<hr />
<h2>4. 異常調查：長 Prefill 原因與修復 (Prefill Cache Stall / Long Prefill Fix)</h2>
<h3>A. 問題現象</h3>
<p dir="auto">在生產環境運行多輪 Agent / OpenCode 對話時，發現每次對話都會出現長達 60~90 秒的長 Prefill（如 54K、57K、64K、69K Tokens），日誌顯示：</p>
<pre><code class="language-text">ds4: took back a 22090-token shared start (0.01 s)
maya ds4 serve: prompt 69438 tokens = 22090 reused + 47348 read in 89230 ms (530.6 tok/s)
</code></pre>
<p dir="auto">Prefix Cache 始終只能重用前 22,090 tokens（System Prompt），後續對話增量（20,000 ~ 47,000 tokens）每一輪都在重新進行 Cold Prefill。</p>
<h3>B. 根因分析 (Root Cause)</h3>
<ol>
<li><strong>觸發旗標殘留 (<code>/tmp/maya_always_cold_prefill</code>)</strong>：
<ul>
<li>20:03 執行的 <code>scripts/run_upstream_v1141_verification.py</code> 測試腳本在跑純冷啟動壓測時寫入了 <code>/tmp/maya_always_cold_prefill</code>，但結束時未清理。</li>
<li><code>scripts/restart_production.sh</code> 先前重啟步驟中亦未清理 <code>/tmp/maya_*</code> 旗標。</li>
</ul>
</li>
<li><strong>C++ 引擎行為</strong>：
<ul>
<li>於 <code>src/ds4/ds4_main.cpp</code> 第 1400 行：<pre><code class="language-cpp">if (access("/tmp/maya_always_cold_prefill", F_OK) == 0 ||
    (std::getenv("DS4_ALWAYS_COLD_PREFILL") != nullptr &amp;&amp; std::atoi(std::getenv("DS4_ALWAYS_COLD_PREFILL")) != 0)) {
    m.reset();
}
</code></pre>
</li>
<li>生產環境每當接收到任何請求時，該檔案強制觸發 <code>m.reset()</code>，將當前對話的動態 KV Cache 完全清空。</li>
<li>引擎只剩下開機時常駐於 RAM 的 22,090-token System Prompt（<code>prefixes</code> RAM Tier），因此日誌只能「<code>took back a 22090-token shared start</code>」，導致後續數萬 tokens 每次均被迫重算。</li>
</ul>
</li>
</ol>
<h3>C. 修復措施與驗證</h3>
<ol>
<li><strong>立即移除殘留旗標</strong>：
<ul>
<li>刪除 <code>/tmp/maya_always_cold_prefill</code>。</li>
</ul>
</li>
<li><strong>自動化重啟防禦加固</strong>：
<ul>
<li>更新 [<code>scripts/restart_production.sh</code>]，在重啟生產服務前強制執行 <code>rm -f /tmp/maya_always_cold_prefill /tmp/maya_skip_zero_experts</code>。</li>
<li>更新 [<code>scripts/run_upstream_v1141_verification.py</code>]，加入 <code>finally</code> 區塊與啟動/結束清理，確保測試旗標絕不遺留。</li>
</ul>
</li>
<li><strong>線上驗證實測</strong>：
<ul>
<li>旗標移除後，第 1 個請求（70,965 tokens）：<br />
<code>prompt 70965 tokens = 69438 reused + 1527 read in 7739 ms (197.3 tok/s)</code><br />
<strong>重用率瞬間升至 97.8%，Prefill 時間由 89.2 秒銳減至 7.7 秒</strong>！</li>
<li>第 2 個請求（72,493 tokens）：<br />
<code>prompt read: 1180 tokens in 4.9 s</code>，重用逾 71,313 tokens，<strong>耗時僅 4.9 秒</strong>。</li>
<li>驗證 Prefix Cache 機制 100% 正常，長 Prefill 現象徹底解除。</li>
</ul>
</li>
</ol>
]]></description><link>https://lcz.me/topic/2770</link><generator>RSS for Node</generator><lastBuildDate>Tue, 10 Nov 2026 00:19:48 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/2770.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 01 Nov 2026 10:32:03 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 4 x Tesla V100 32G, Maya-DS4, DeepSeek-V4.1-Flash-1017 EXL3 2.9bpw, decode 37 tok/s, prefill 640 tok/s, 部署,調優與避坑紀錄 on Mon, 02 Nov 2026 14:24:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/soop-ladios" aria-label="Profile: soop-ladios">@<bdi>soop-ladios</bdi></a> 感谢您的耐心讲解。您这个混合的架构理解起来还真的有点绕。我本来就简单计算4x32 = 128GB， 一部分offload到CPU走PCIe。实际情况比这个复杂了。 V100 有那种4卡和8卡NVlink的可能瓶颈会更少吧。不过这个就不是垃圾佬的范畴了。现在V100 32GB的卡价格也炒上去了，我还是耐心等AI泡沫破了看看有没有机会捡到A100 A200。哈哈有点白日梦。 因为我入门比较晚，没有大佬们的硬件玩具现在捡了一张V100 16GB，一张P100 16GB 跑跑边缘小模型做写vision UD， 小UD LLM, qWen image 2.1生图之类的边缘玩意了。 保持关注~ 再次感谢！</p>
]]></description><link>https://lcz.me/post/30589</link><guid isPermaLink="true">https://lcz.me/post/30589</guid><dc:creator><![CDATA[Lei Gao]]></dc:creator><pubDate>Mon, 02 Nov 2026 14:24:58 GMT</pubDate></item><item><title><![CDATA[Reply to 4 x Tesla V100 32G, Maya-DS4, DeepSeek-V4.1-Flash-1017 EXL3 2.9bpw, decode 37 tok/s, prefill 640 tok/s, 部署,調優與避坑紀錄 on Mon, 02 Nov 2026 09:50:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lei-gao" aria-label="Profile: Lei-Gao">@<bdi>Lei-Gao</bdi></a> 我的四張卡排列比較特殊, GPU0/GPU1是外接顯卡鄔, 接pcie switch佔一條pcie插槽, 有nvlink.<br />
GPU2/GPU3是分開插在兩條PCIE, 所以走的是TP2, PP2.  我請Gemini小弟解釋一下:</p>
<h1>DeepSeek-V4.1-Flash-1017 NVLink 拓撲與實質效益分析報告</h1>
<p dir="auto"><strong>主機環境</strong>: AMD EPYC 7K62 48C/96T, 128GB RAM, 4 × NVIDIA Tesla V100-SXM2 32GB<br />
<strong>模型版本</strong>: <code>DeepSeek-V4.1-Flash-1017 EXL3 2.9bpw + Engram 1017</code><br />
<strong>推論引擎</strong>: <code>project-maya / maya-ds4</code> (<code>--tp 2 --layer-split auto</code>)</p>
<hr />
<h2>結論</h2>
<p dir="auto"><strong>NVLink 在本機推論此模型時有局部的實質加速作用，但不是決定整體端到端效能的核心瓶頸</strong>（對端到端速度的實質貢獻估計約在 <strong>5% ~ 10%</strong> 左右）。</p>
<hr />
<h2>一、 實體硬體拓撲現況（關鍵前置事實）</h2>
<p dir="auto">經由 <code>nvidia-smi topo -m</code> 與 <code>nvidia-smi nvlink -s</code> 檢測，本機 4 張 V100 的互聯是<strong>不對稱</strong>的：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="text-align:left">GPU 配對</th>
<th style="text-align:left">實體連線方式</th>
<th style="text-align:left">頻寬</th>
<th style="text-align:left">狀態</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left"><strong>GPU 0 <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:1.4em;width:auto;vertical-align:middle" title="↔" alt="↔" /> GPU 1</strong></td>
<td style="text-align:left"><strong>NVLink 2.0 (5 條 bonded, NV5)</strong></td>
<td style="text-align:left"><strong>~128.9 GB/s</strong></td>
<td style="text-align:left"><strong>Active (運作中)</strong></td>
</tr>
<tr>
<td style="text-align:left"><strong>GPU 2 <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:1.4em;width:auto;vertical-align:middle" title="↔" alt="↔" /> GPU 3</strong></td>
<td style="text-align:left"><strong>PCIe / Host Bridge (NODE)</strong></td>
<td style="text-align:left">~12–15 GB/s (PCIe Gen3)</td>
<td style="text-align:left"><strong>No NVLink (全數 Inactive)</strong></td>
</tr>
<tr>
<td style="text-align:left"><strong>GPU 0/1 <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:1.4em;width:auto;vertical-align:middle" title="↔" alt="↔" /> GPU 2/3</strong></td>
<td style="text-align:left"><strong>PCIe Host Bridge (NODE)</strong></td>
<td style="text-align:left">~12–15 GB/s (PCIe Gen3)</td>
<td style="text-align:left">跨節點走 PCIe</td>
</tr>
</tbody>
</table>
<hr />
<h2>二、 模型並行架構下的通訊分佈</h2>
<p dir="auto">目前的服務配置為 <code>--tp 2 --layer-split auto</code>（即 <strong>TP=2 + PP=2</strong>）：</p>
<ul>
<li><strong>Stage 0（前 20 層，Layers 0..19）</strong>：切在 <strong>GPU 0</strong> 與 <strong>GPU 1</strong>（TP=2）。</li>
<li><strong>Stage 1（後 20 層，Layers 20..39 + LM Head）</strong>：切在 <strong>GPU 2</strong> 與 <strong>GPU 3</strong>（TP=2）。</li>
<li><strong>PP 流水線交接</strong>：Stage 0 算完後的 Hidden States 跨卡傳給 Stage 1。</li>
</ul>
<hr />
<h2>三、 NVLink 在哪裡有「實質作用」？</h2>
<ol>
<li><strong>加速 Stage 0（Layers 0..19）的 TP All-Reduce：</strong>
<ul>
<li>每一層的 MLA (Multi-head Latent Attention) 投影與 MoE 共享專家（Shared Expert）輸出，都需要在 TP 兩卡間做 All-Reduce 聚合。</li>
<li><strong>GPU 0 <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:1.4em;width:auto;vertical-align:middle" title="↔" alt="↔" /> GPU 1</strong> 走 NVLink 5 條通道，延遲極低（&lt; 10 µs），通訊耗時基本能被計算完全重疊（Overlap）。</li>
</ul>
</li>
<li><strong>避免 Stage 0 的 PCIe 總線爭搶（Bus Contention）：</strong>
<ul>
<li>由於 GPU 0 與 GPU 1 的 TP 溝通走的是專用 NVLink 實體鏈路，不會佔用主機板的 PCIe 通道，使得這兩張卡的 PCIe 頻寬能 100% 留給 CPU 串流專家資料。</li>
</ul>
</li>
</ol>
<hr />
<h2>四、 為什麼 NVLink「無法成為全局決定性因素」？</h2>
<ol>
<li><strong>核心瓶頸在 CPU <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:1.4em;width:auto;vertical-align:middle" title="↔" alt="↔" /> GPU 冷專家動態串流（走 PCIe Gen3）：</strong>
<ul>
<li>模型總共有約 <strong>92.4 GB ~ 100 GB 的冷專家權重</strong> 駐留在 CPU Host RAM，推論時需要根據動態路由經由 PCIe 串流到 GPU（即日誌中的 <code>CPU lane ~22%~28% experts</code>）。</li>
<li><strong>NVLink 只能加速 GPU <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:1.4em;width:auto;vertical-align:middle" title="↔" alt="↔" /> GPU 互聯，無法加速 CPU RAM <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:1.4em;width:auto;vertical-align:middle" title="↔" alt="↔" /> GPU 的 H2D 傳輸</strong>。這部分的頻寬上限受死在 PCIe Gen3 x16（約 12–13 GB/s），是整個系統最大的延遲來源。</li>
</ul>
</li>
<li><strong>木桶效應：Stage 1（GPU 2 <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2194.png?v=a055419e292" class="not-responsive emoji emoji-android emoji--left_right_arrow" style="height:1.4em;width:auto;vertical-align:middle" title="↔" alt="↔" /> GPU 3）沒有 NVLink：</strong>
<ul>
<li>後半段 20 層的 TP=2 在 GPU 2 與 GPU 3 上執行，由於這兩張卡之間沒有啟用 NVLink，它們的 All-Reduce 只能走 PCIe (NODE)。</li>
<li>流水線（Pipeline）的速度由最慢的一環決定，Stage 1 在 PCIe 上的通訊延遲，會抵消掉 Stage 0 NVLink 帶來的部分增益。</li>
</ul>
</li>
<li><strong>PP 傳輸的資料量極小：</strong>
<ul>
<li>Stage 0 傳給 Stage 1 只需要傳遞單個 Token 的活化向量（Hidden States，大小僅約數 KB），在 PCIe 上傳輸耗時僅需幾微秒，NVLink 在此處毫無顯著差別。</li>
</ul>
</li>
</ol>
<hr />
<h2>五、 總結評估</h2>
<ul>
<li><strong>實質效益</strong>：有，它確保了前半部模型（GPU 0/1）通訊不打架、低延遲，估計貢獻了約 <strong>5% ~ 10%</strong> 的端到端效能。</li>
<li><strong>全局瓶頸</strong>：目前推論速度（Decode ~35–45 tok/s）的主導瓶頸是 <strong>CPU 記憶體頻寬與 PCIe Gen3 串流速度</strong>，而非 GPU-to-GPU 的通訊頻寬。</li>
</ul>
]]></description><link>https://lcz.me/post/30542</link><guid isPermaLink="true">https://lcz.me/post/30542</guid><dc:creator><![CDATA[soop ladios]]></dc:creator><pubDate>Mon, 02 Nov 2026 09:50:33 GMT</pubDate></item><item><title><![CDATA[Reply to 4 x Tesla V100 32G, Maya-DS4, DeepSeek-V4.1-Flash-1017 EXL3 2.9bpw, decode 37 tok/s, prefill 640 tok/s, 部署,調優與避坑紀錄 on Mon, 02 Nov 2026 05:26:00 GMT]]></title><description><![CDATA[<p dir="auto">v100被你搞出第二春了，这样玩卡间通讯用到nvlink吗？还是就pcie？</p>
]]></description><link>https://lcz.me/post/30484</link><guid isPermaLink="true">https://lcz.me/post/30484</guid><dc:creator><![CDATA[Lei Gao]]></dc:creator><pubDate>Mon, 02 Nov 2026 05:26:00 GMT</pubDate></item><item><title><![CDATA[Reply to 4 x Tesla V100 32G, Maya-DS4, DeepSeek-V4.1-Flash-1017 EXL3 2.9bpw, decode 37 tok/s, prefill 640 tok/s, 部署,調優與避坑紀錄 on Sun, 01 Nov 2026 11:55:57 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry" aria-label="Profile: terry">@<bdi>terry</bdi></a> 確實，不過考慮到這價錢不到一台DGX spark GB10, 而這個量化要兩台GB10才跑的起來，就覺得還可以了.<br />
37 tok/s不至於慢到不能接受，640 tok/s prefill就.. 靠kv緩存命中彌補了</p>
]]></description><link>https://lcz.me/post/30291</link><guid isPermaLink="true">https://lcz.me/post/30291</guid><dc:creator><![CDATA[soop ladios]]></dc:creator><pubDate>Sun, 01 Nov 2026 11:55:57 GMT</pubDate></item><item><title><![CDATA[Reply to 4 x Tesla V100 32G, Maya-DS4, DeepSeek-V4.1-Flash-1017 EXL3 2.9bpw, decode 37 tok/s, prefill 640 tok/s, 部署,調優與避坑紀錄 on Sun, 01 Nov 2026 10:43:51 GMT]]></title><description><![CDATA[<p dir="auto">牛逼是牛逼了，但是这效率跑Deepseek太勉强了，</p>
]]></description><link>https://lcz.me/post/30258</link><guid isPermaLink="true">https://lcz.me/post/30258</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Sun, 01 Nov 2026 10:43:51 GMT</pubDate></item></channel></rss>