<?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[Strix Halo本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結]]></title><description><![CDATA[<h1>Strix Halo（gfx1151）本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結</h1>
<h2>引言：從 Loose Box 影片到真實部署</h2>
<p dir="auto"><a href="https://www.youtube.com/watch?v=I83lB-_M3e4" rel="nofollow ugc">Loose Box 專案的影片</a> 與 <a href="https://www.lucebox.com/blog/deepseek-v4-strix-halo" rel="nofollow ugc">官方技術文件</a> 展示了令人印象深刻的成果：同樣的 Strix Halo（gfx1151）、同樣的 128GB LPDDR5X，用客製 ROCmFPX 量化模型 + DSpark 投機解碼，decode 達到 <strong>32.0 tok/s</strong>，sparse prefill 達到 <strong>~250 tok/s</strong>。</p>
<p dir="auto">我在同樣的硬體（Asus ROG Flow Z13 GZ302EA，Ryzen AI Max+ 395，Radeon 8060S，128GB）上用 <strong>同樣的 Loose Box 專案</strong>（Claude Code 協助部署）實作，結果有幾個關鍵差異，值得完整記錄。</p>
<p dir="auto"><strong>核心結論（先看這裡）：</strong></p>
<ul>
<li><strong>decode 29.7 tok/s，已達官方紀錄的 91%</strong>，對話式使用體驗良好。</li>
<li><strong>prefill 與官方差距大，原因不是設定錯誤，是量化版本不同：</strong>
<ul>
<li>官方 250 tok/s sparse prefill 建立在 <strong>ROCmFPX 客製量化</strong>（平均 2.88 bits/parameter）+ 專屬 kernel 之上。</li>
<li>我用標準量化版本，exact prefill 實測 <strong>20–32 tok/s</strong>，與官方 exact prefill 數據（22.5 tok/s）吻合——<strong>這才是 Strix Halo 沒有客製量化下的真實表現</strong>。</li>
</ul>
</li>
<li><strong>因 RTX 5090 eGPU 在 Linux 下無法成功啟動，不再嘗試跑客製量化版本。</strong></li>
<li><strong>接 agent 前務必算清楚：</strong> 如果你的系統提示超過 2K tokens，exact prefill 會花 1–3 分鐘。</li>
</ul>
<p dir="auto">以下從完整技術紀錄中節錄 Strix Halo 部署 DS4 的環境、失效、可行、技術總結。</p>
<hr />
<h2>環境</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>項目</th>
<th>規格</th>
</tr>
</thead>
<tbody>
<tr>
<td>機器</td>
<td>ASUS ROG Flow Z13 (GZ302EA)</td>
</tr>
<tr>
<td>SoC</td>
<td>AMD Ryzen AI MAX+ 395 (Strix Halo)</td>
</tr>
<tr>
<td>iGPU</td>
<td>Radeon 8060S, gfx1151 (RDNA 3.5), 40 CU</td>
</tr>
<tr>
<td>記憶體</td>
<td>128 GB LPDDR5X 統一記憶體 (~270 GB/s)</td>
</tr>
<tr>
<td>SSD</td>
<td>WD_BLACK SN770M 2TB (DRAM-less, HMB)</td>
</tr>
<tr>
<td>OS</td>
<td>Ubuntu 26.04 LTS, kernel 7.0.0-14</td>
</tr>
<tr>
<td>ROCm</td>
<td>7.1.1 (Ubuntu 內建)</td>
</tr>
<tr>
<td>模型</td>
<td>DeepSeek V4 Flash, 95.3 GiB, 256 experts MoE</td>
</tr>
</tbody>
</table>
<hr />
<h2>BIOS carve 調整</h2>
<p dir="auto">Strix Halo 的 BIOS 把 128 GB LPDDR5X 切成「RAM 側」與「VRAM carve」兩塊。部署 DS4 必須把 carve 調到最小（512 MB），讓 ROCm 改用 GTT 借主記憶體。</p>
<blockquote>
<p dir="auto"><img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/1f534.png?v=138704eccfe" class="not-responsive emoji emoji-android emoji--red_circle" style="height:23px;width:auto;vertical-align:middle" title="🔴" alt="🔴" /> <strong>如果 carve 還在 96/32 就開 Ubuntu：</strong> 系統 RAM 只剩 32 GB，DS4 的 95.3 GiB 載不進去。GTT 是 pinned、OOM killer 殺不掉 → 整台凍結，不是乾淨報錯。</p>
</blockquote>
<hr />
<h2>失效路線</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>路線</th>
<th>結果</th>
<th>原因</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>amdgpu.gttsize</code> 不調</td>
<td>載入失敗</td>
<td>iGPU 預設只能借用約一半系統記憶體（實測 61 GiB）</td>
</tr>
<tr>
<td><code>ttm.pages_limit</code> 未與 <code>gttsize</code> 對齊</td>
<td>載入失敗</td>
<td>TTM 另外卡住</td>
</tr>
<tr>
<td><code>amd_iommu=on iommu=pt</code></td>
<td>decode 從 29.10 掉到 0.60 tok/s（1/48）</td>
<td>統一記憶體分頁遷移每次都要過 IOMMU 位址轉換</td>
</tr>
<tr>
<td>earlyoom 預設值</td>
<td>模型載入完成就被殺</td>
<td>預設「可用記憶體低於 10% 就動手」，模型正常就佔 88%</td>
</tr>
<tr>
<td><code>/opt/rocm/lib → /usr/lib/x86_64-linux-gnu</code> symlink</td>
<td>cmake 找不到 amd_comgr</td>
<td><code>amd_comgr-config.cmake</code> 從自身剝 4 層推算前綴，symlink 層數不對</td>
</tr>
</tbody>
</table>
<hr />
<h2>可行設定</h2>
<p dir="auto"><strong>GRUB 開機參數（關鍵）：</strong></p>
<pre><code>amd_iommu=off amdgpu.gttsize=126976 ttm.pages_limit=32505856 ttm.page_pool_size=32505856
</code></pre>
<ul>
<li><code>gttsize=126976</code> (MB) = 124 GiB</li>
<li><code>ttm.pages_limit</code> 必須與 gttsize 對齊（32505856 × 4KiB = 124 GiB）</li>
<li>驗證：<code>dmesg | grep GTT</code> 應出現 <code>126976M of GTT memory ready</code></li>
</ul>
<p dir="auto"><strong>反直覺的發現：模型其實不住在 GTT 裡</strong></p>
<pre><code>ggml_cuda: device 0 integrated, alloc 94.9 GiB (&gt; 45% of 124.9 GiB RAM)
           -&gt; unified (managed) memory

mem_info_gtt_used  = 12,020 MiB    ← GTT 只用了 12 GiB
dflash_server RSS  = 99.7 GiB      ← 模型在一般系統記憶體
</code></pre>
<blockquote>
<p dir="auto"><img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/1f4a1.png?v=138704eccfe" class="not-responsive emoji emoji-android emoji--bulb" style="height:23px;width:auto;vertical-align:middle" title="💡" alt="💡" /> 模型走 <code>hipMallocManaged</code> 統一記憶體路徑，124 GiB GTT 上限並不是實際約束條件。</p>
</blockquote>
<p dir="auto"><strong>Ubuntu 26.04 的佈局差異：</strong></p>
<ul>
<li>套件名稱：<code>libhipblas-dev</code>、<code>librocwmma-dev</code>（不是 <code>hipblas-dev</code>）</li>
<li><code>/opt/rocm</code> 正確做法：<code>sudo ln -sfn /usr /opt/rocm</code></li>
<li>rocWMMA 標頭不完整，必須手動從 GitHub <code>rocm-7.1.0</code> branch 補上</li>
</ul>
<p dir="auto"><strong>earlyoom 修正：</strong></p>
<pre><code class="language-bash">EARLYOOM_ARGS="-m 3 -r 3600 --avoid '(^|/)(dflash_server|llama-server)$'"
</code></pre>
<hr />
<h2>實測效能</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>指標</th>
<th>數值</th>
</tr>
</thead>
<tbody>
<tr>
<td>decode（有投機解碼）</td>
<td><strong>29.7 tok/s</strong>（命中率 0.957）</td>
</tr>
<tr>
<td>prefill（644 tokens）</td>
<td>20.2 s（31.9 tok/s）</td>
</tr>
<tr>
<td>prefill（10,422 tokens）</td>
<td>527.5 s（19.8 tok/s）</td>
</tr>
<tr>
<td>溫度</td>
<td>從 60°C 衝到 91–94°C，長 prefill 可達 101°C</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>比對 Loose Box 官方數據：</strong></p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>項目</th>
<th>Loose Box 官方</th>
<th>我實測</th>
</tr>
</thead>
<tbody>
<tr>
<td>decode（有投機解碼）</td>
<td>32.0 tok/s</td>
<td>29.7 tok/s（91%）</td>
</tr>
<tr>
<td>decode（無投機解碼）</td>
<td>25.3 tok/s</td>
<td>~20 tok/s</td>
</tr>
<tr>
<td>exact prefill（短 prompt）</td>
<td>22.5–23 tok/s</td>
<td>31.9 tok/s</td>
</tr>
<tr>
<td>exact prefill（8K tokens）</td>
<td>16.46 tok/s</td>
<td>19.8 tok/s（10K）</td>
</tr>
<tr>
<td>sparse prefill（8K tokens）</td>
<td>251.79 tok/s（ROCmFPX 客製）</td>
<td>未用客製量化</td>
</tr>
</tbody>
</table>
<blockquote>
<p dir="auto"><img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/26a0.png?v=138704eccfe" class="not-responsive emoji emoji-android emoji--warning" style="height:23px;width:auto;vertical-align:middle" title="⚠" alt="⚠" />️ <strong>因 RTX 5090 eGPU 在 Linux 下無法成功啟動（Blackwell + USB4 + Linux CUDA 運算必崩，見第二篇），未能嘗試在 5090 上跑 Loose Box 客製量化版本。</strong></p>
</blockquote>
<hr />
<h2>技術總結</h2>
<ol>
<li><strong>記憶體很夠，GTT 設定正確就能載入接近 100 GiB 的模型。</strong></li>
<li><strong>decode 表現超出預期，</strong> 29.7 tok/s 已達 Loose Box 紀錄的 91%，對話式使用體驗良好。</li>
<li><strong>prefill 是硬傷，</strong> LPDDR5X ~270 GB/s vs 960 GB/s，參數調不動。接 agent 前先算清楚系統提示要多久才能消化完。</li>
<li><strong>散熱是真實限制，</strong> 平板形態的機身在持續滿載下必然降頻，長時間使用考慮外接散熱。</li>
<li><strong>IOMMU 開著不能用，</strong> 會讓 decode 掉到 1/48。</li>
<li><strong>sparse prefill 的 250 tok/s 需要客製 ROCmFPX 量化 + 專屬 kernel，</strong> 標準版本做不到。</li>
</ol>
]]></description><link>https://lcz.me/topic/1010/strix-halo本地部署-deepseek-v4-flash-環境-失效-可行與技術總結</link><generator>RSS for Node</generator><lastBuildDate>Tue, 11 Aug 2026 15:57:06 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/1010.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 03 Aug 2026 07:27:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Strix Halo本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結 on Tue, 04 Aug 2026 04:26:44 GMT]]></title><description><![CDATA[<p dir="auto">19.8 tok/s 的 prefill 对 Agent 场景确实不可用：每次请求都要把整段上下文重算一遍，10K token 意味着每次回复前先干等 8-9 分钟，等于没法用。</p>
<p dir="auto">先说明为什么慢：prefill 是算力瓶颈（要对整段 prompt 做 attention），decode 才是显存带宽瓶颈。Strix Halo 的 iGPU 强在带宽（~256GB/s），弱在 FP16 算力，所以它"日常对话流畅、长上下文预填充拉胯"是硬件特性决定的，不是配置错了。</p>
<p dir="auto">优化路径按性价比排序：</p>
<ol>
<li>
<p dir="auto">KV/前缀缓存（最有效）：Agent 场景里 system prompt + 工具定义占了上下文大头且基本不变。开启前缀缓存（llama.cpp 的 --cache-reuse，或 Ollama 自带的上下文缓存）后，命中部分直接跳过重算——10K token 里如果 8K 是稳定前缀，prefill 时间直接砍掉 80%。这是最值得先做的。</p>
</li>
<li>
<p dir="auto">精简上下文：对话历史定期压缩（把旧轮次总结成摘要再喂回去），从源头减少每次 prefill 的 token 量。Agent 跑得越久这条越重要。</p>
</li>
<li>
<p dir="auto">chunked prefill：SGLang/vLLM 的分块预填充能改善首 token 延迟（TTFT），但那是为高并发服务设计的，单用户单卡收益有限；而且 A 卡上 SGLang 部署坑多（terry 楼上说了），优先级放后面。</p>
</li>
<li>
<p dir="auto">确认开了 Flash Attention：llama.cpp 加 -fa，ROCm 下用 Composable Kernel 的 FA 对 prefill 提升很明显，先确认没漏掉这个基础项。</p>
</li>
</ol>
<p dir="auto">结论：先做缓存，再谈换框架。对 Strix Halo 这种带宽强算力弱的平台，缓存命中率就是决定 Agent 可用性的第一要素，比换推理引擎划算得多。</p>
]]></description><link>https://lcz.me/post/11384</link><guid isPermaLink="true">https://lcz.me/post/11384</guid><dc:creator><![CDATA[Xiaote]]></dc:creator><pubDate>Tue, 04 Aug 2026 04:26:44 GMT</pubDate></item><item><title><![CDATA[Reply to Strix Halo本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結 on Tue, 04 Aug 2026 02:48:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/eric-su" aria-label="Profile: Eric-Su">@<bdi>Eric-Su</bdi></a> A卡SG-Lang不好部署，问题很多，但是如果弄好，我感觉效果会好很多，因为SG-Lang能解决Prefill慢成狗的问题，你别说这是个很好的思路。</p>
]]></description><link>https://lcz.me/post/11368</link><guid isPermaLink="true">https://lcz.me/post/11368</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Tue, 04 Aug 2026 02:48:31 GMT</pubDate></item><item><title><![CDATA[Reply to Strix Halo本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結 on Tue, 04 Aug 2026 02:24:47 GMT]]></title><description><![CDATA[<p dir="auto">好奇，如果用SGLang會不會有較好的PP表現?</p>
]]></description><link>https://lcz.me/post/11362</link><guid isPermaLink="true">https://lcz.me/post/11362</guid><dc:creator><![CDATA[Eric Su]]></dc:creator><pubDate>Tue, 04 Aug 2026 02:24:47 GMT</pubDate></item><item><title><![CDATA[Reply to Strix Halo本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結 on Mon, 03 Aug 2026 22:10:57 GMT]]></title><description><![CDATA[<p dir="auto">一样非常关心这个问题</p>
]]></description><link>https://lcz.me/post/11348</link><guid isPermaLink="true">https://lcz.me/post/11348</guid><dc:creator><![CDATA[包磊]]></dc:creator><pubDate>Mon, 03 Aug 2026 22:10:57 GMT</pubDate></item><item><title><![CDATA[Reply to Strix Halo本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結 on Mon, 03 Aug 2026 15:09:20 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mshavl" aria-label="Profile: MSHAVL">@<bdi>MSHAVL</bdi></a> <a href="/post/11294">说</a>:</p>
<p dir="auto">prefill（10,422 tokens）	527.5 s（19.8 tok/s）</p>
</blockquote>
<p dir="auto">pp这个速度基本就是不可用啊。后续有优化好一点么？</p>
]]></description><link>https://lcz.me/post/11334</link><guid isPermaLink="true">https://lcz.me/post/11334</guid><dc:creator><![CDATA[fcme]]></dc:creator><pubDate>Mon, 03 Aug 2026 15:09:20 GMT</pubDate></item><item><title><![CDATA[Reply to Strix Halo本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結 on Mon, 03 Aug 2026 07:50:38 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/terry" aria-label="Profile: terry">@<bdi>terry</bdi></a> <a href="/post/11295">说</a>:</p>
<p dir="auto">日常对话，问问代码应该问题不大，带宽天生残疾，跑Agent不太现实，但是可以跑122B Qwen，或许3.8更新的时候会有这个玩意。3.5的就挺好了，知识面大。跑Agent的话用35B A3B，体验不如27b。帖子质量很高，还是要实拍图，屏幕截图。</p>
</blockquote>
<p dir="auto">確實，一開始用AI max+395時很有耐心都可以等。購入5090才被行雲流水的tps炸了腦。玩到現在越能體現這句話：「可跑不代表質量好，質量好不代表跑得快，跑得快不代表撐的久」。在眾多知識類AI媒體中只有版主能讓我駐足。這邊也小小的分享自身的經驗。</p>
]]></description><link>https://lcz.me/post/11297</link><guid isPermaLink="true">https://lcz.me/post/11297</guid><dc:creator><![CDATA[MSHAVL]]></dc:creator><pubDate>Mon, 03 Aug 2026 07:50:38 GMT</pubDate></item><item><title><![CDATA[Reply to Strix Halo本地部署 DeepSeek V4 Flash — 環境、失效、可行與技術總結 on Mon, 03 Aug 2026 07:33:03 GMT]]></title><description><![CDATA[<p dir="auto">日常对话，问问代码应该问题不大，带宽天生残疾，跑Agent不太现实，但是可以跑122B Qwen，或许3.8更新的时候会有这个玩意。3.5的就挺好了，知识面大。跑Agent的话用35B A3B，体验不如27b。帖子质量很高，还是要实拍图，屏幕截图。</p>
]]></description><link>https://lcz.me/post/11295</link><guid isPermaLink="true">https://lcz.me/post/11295</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Mon, 03 Aug 2026 07:33:03 GMT</pubDate></item></channel></rss>