<?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[【實測】重點：一個錯誤，prefill 少一半 —— RX 7900 XT 20GB 升級 STRATA 0.2.5 → 0.2.18 + tune auto（675 → 1728 tok/s）]]></title><description><![CDATA[<blockquote>
<p dir="auto"><strong>TL;DR（30 秒版）</strong></p>
<ol>
<li><strong>升級 + tune 之後，11.5K prompt 嘅 prefill 由 674.7 tok/s 升到 1,728.9 tok/s（+156%，2.56 倍）</strong>，TTFT 由 17.11 秒 減到 6.68 秒</li>
<li><strong>最大嘅元兇唔係版本舊，係一張「錯調校表」</strong>：profile pin 死咗 <code>100401</code> 張 hipBLASLt 表，但實際 runtime 係 <code>100200</code> → 每次 prefill 都 fallback 去慢嘅 hipBLASEx，<strong>唔崩潰、唔報錯，只係默默慢一倍</strong></li>
<li><strong><code>--prefill auto</code> 預設封頂 8192 token／chunk</strong>，大 GEMM shape 食唔到；放開去 <code>auto:16384</code> 即刻再多 9%</li>
<li><strong><code>tune auto</code> quick 模式 11 分鐘、+4%、答案完全一致</strong>（改 <code>--kv-resident 65536</code>），但 <strong>preset 唔會自動改你明確指定嘅 <code>--profile</code> 檔</strong></li>
<li>而家 peak prefill <strong>1,721 tok/s</strong>，已經超過官方對比表入面 STRATA 0.2.9 嘅 1,453，接近 Avalon 報嘅 1,854</li>
</ol>
</blockquote>
<h3>平台</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>項目</th>
<th>規格</th>
</tr>
</thead>
<tbody>
<tr>
<td>CPU</td>
<td>AMD Ryzen 9 5900XT（16C/32T，Zen 3）</td>
</tr>
<tr>
<td>RAM</td>
<td>121GB DDR4</td>
</tr>
<tr>
<td>GPU</td>
<td><strong>Radeon RX 7900 XT 20GB</strong>（gfx1100 / RDNA3）</td>
</tr>
<tr>
<td>主機板</td>
<td>B550M AORUS ELITE AX</td>
</tr>
<tr>
<td>系統</td>
<td>Ubuntu 26.04.1 LTS</td>
</tr>
<tr>
<td>ROCm</td>
<td>Core SDK 10.1.0（hipBLASLt runtime <strong>100200</strong>）</td>
</tr>
<tr>
<td>模型</td>
<td>Qwen3.8-Flash-Next GSQ-RCO <strong>IQ3_S</strong>（~83.6GB，兩檔）</td>
</tr>
<tr>
<td>Context</td>
<td>131K</td>
</tr>
<tr>
<td>引擎</td>
<td>STRATA 0.2.18（build 0.1.64）／engine 0.1.64-hip-rx7900</td>
</tr>
<tr>
<td>Vision</td>
<td>strata-vision CPU reader（threads 16，max 300 image tokens）</td>
</tr>
</tbody>
</table>
<hr />
<h2>一、點解會去查呢樣嘢</h2>
<p dir="auto">之前睇 Avalon README 有一行對比：STRATA 0.2.9 喺 <strong>同一張 7900 XT</strong> 上面 max prefill 報 <strong>1,453 tok/s</strong>。我部機硬件仲好過佢（5900XT 16C vs 3800XT 8C、121GB vs 64GB），點知實測得 <strong>674 tok/s</strong>？</p>
<p dir="auto">差一倍幾，明顯唔合理。於是逐層拆，拆出三個<strong>互相獨立</strong>嘅問題。</p>
<h2>二、問題一：一張錯嘅調校表（最隱蔽）</h2>
<p dir="auto">Log 入面一直有呢句，但佢唔係 error，好易睇漏：</p>
<pre><code>prefill gemm: hipBLASLt version mismatch: file=100401 runtime=100200; using hipBLASEx
</code></pre>
<p dir="auto"><strong>成件事係咁：</strong></p>
<p dir="auto">hipBLASLt 調校表入面嘅 solution id <strong>只對一個 arch + 一個 hipBLASLt 版本有效</strong>。引擎會 check 兩者，啱唔上就 fallback 去 plain hipBLAS（hipBLASEx）。用官方源碼嘅講法：</p>
<blockquote>
<p dir="auto"><em>"a wrong table can never change a result, it only wastes the speed-up"</em></p>
</blockquote>
<p dir="auto">即係<strong>永遠唔會錯，只會慢</strong> —— 所以佢唔會崩，你唔會知。</p>
<p dir="auto">我部機裝嘅係 ROCm Core SDK <strong>10.1.0（runtime 100200）</strong>，但 profile 把 <code>STRATA_HIPBLASLT_TUNING</code> <strong>pin 死咗 <code>gfx1100-hipblaslt-100401.txt</code></strong>。</p>
<p dir="auto"><strong>改啱版本之後：</strong></p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>場景</th>
<th>錯表（100401）</th>
<th>啱表（100200）</th>
<th>變化</th>
</tr>
</thead>
<tbody>
<tr>
<td>2.9K prefill</td>
<td>574.5 tok/s</td>
<td><strong>833.4 tok/s</strong></td>
<td><strong>+45%</strong></td>
</tr>
<tr>
<td>2.9K TTFT</td>
<td>5.05 s</td>
<td><strong>3.48 s</strong></td>
<td>−31%</td>
</tr>
<tr>
<td>11.5K prefill</td>
<td>674.7 tok/s</td>
<td><strong>1,069.3 tok/s</strong></td>
<td><strong>+58%</strong></td>
</tr>
<tr>
<td>11.5K TTFT</td>
<td>17.11 s</td>
<td><strong>10.79 s</strong></td>
<td>−37%</td>
</tr>
<tr>
<td>decode</td>
<td>63.5 tok/s</td>
<td>63.3 tok/s</td>
<td>冇變（唔關 GEMM 事）</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>一個 config 值，即刻 +58% prefill。</strong></p>
<h3>順帶講：點解唔可以直接用 100401 嗰張？</h3>
<p dir="auto">因為 100401 張表其實<strong>覆蓋得多好多</strong>：</p>
<pre><code>gfx1100-hipblaslt-100100.txt   rows=31
gfx1100-hipblaslt-100200.txt   rows=27   ← 版本啱，但覆蓋最少
gfx1100-hipblaslt-100202.txt   rows=27
gfx1100-hipblaslt-100401.txt   rows=44   ← 覆蓋最多，但版本唔啱用唔到
gfx1100-hipblaslt-100500.txt   rows=33
</code></pre>
<p dir="auto">呢個都係剩低嗰 13% 差距嘅原因之一 —— 未列喺表入面嘅 GEMM shape 都行未 tune 路徑。</p>
<h3><img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/26a0.png?v=2bf455356c3" class="not-responsive emoji emoji-android emoji--warning" style="height:1.4em;width:auto;vertical-align:middle" title="⚠" alt="⚠" />️ 一個好易中伏嘅位：<code>AUTO_ARCHS</code> 唔包括 gfx1100</h3>
<p dir="auto">源碼 <code>strata_control/hipblaslt_tuning.py</code> 有兩條關鍵規則：</p>
<pre><code class="language-python">AUTO_USES_TABLE = False
AUTO_ARCHS = ("gfx1151",)
</code></pre>
<p dir="auto">即係：<strong>喺 gfx1100 上面，就算你移除硬 pin 轉返 auto，都唔會自動用表</strong>，會 fallback 去 plain hipBLAS，<strong>反而慢返</strong>。</p>
<p dir="auto">原因寫得好清楚 —— 用表會改變浮點捨入，答案唔係 bit-identical，需要 owner 明確決定；gfx1151（Strix Halo）因為社區實測 251→529 tok/s（2.11×）先至入咗白名單。</p>
<p dir="auto"><strong>正確做法係用開關，而唔係硬 pin 路徑：</strong></p>
<pre><code class="language-json">"env": { "STRATA_HIPBLASLT_TABLE": "on" }
</code></pre>
<p dir="auto">咁佢會自動配對 <strong>engine package 內建嘅 <code>tuning/&lt;arch&gt;-hipblaslt-&lt;BUILD.json 版本&gt;.txt</code></strong>，跟住 package 行 —— <strong>升級 ROCm 時表自動跟版本，唔使人手改路徑，唔會再靜靜 fallback</strong>。</p>
<p dir="auto">確認方法（point of truth）：</p>
<pre><code>prefill gemm: hipBLASLt tuning enabled (26 rows, gfx1100, version 100200)
version mismatch: 0
hipBLASEx fallback: 0
</code></pre>
<h2>三、問題二：<code>--prefill auto</code> 封頂 8192</h2>
<p dir="auto"><code>strata --help</code> 講咗但好容易忽略：</p>
<pre><code>--prefill CHUNK   batched prompt processing in chunks of CHUNK tokens;
                  auto = the largest chunk up to 8192 whose buffers the
                  expert cache can lend;
                  auto:16384 / auto:32768 (or STRATA_PREFILL_AUTO_MAX) allow bigger ones
</code></pre>
<p dir="auto">細 chunk 食唔到大 GEMM shape。實測三種設定：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>設定</th>
<th>8K</th>
<th>16K</th>
<th>32K</th>
<th>64K</th>
<th>peak</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>auto</code>（封頂 8192）</td>
<td>1,142</td>
<td>1,155</td>
<td>1,149</td>
<td>1,107</td>
<td><strong>1,155</strong></td>
</tr>
<tr>
<td><strong><code>auto:16384</code></strong> <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=2bf455356c3" class="not-responsive emoji emoji-android emoji--white_check_mark" style="height:1.4em;width:auto;vertical-align:middle" title="✅" alt="✅" /></td>
<td>1,130</td>
<td><strong>1,256</strong></td>
<td><strong>1,258</strong></td>
<td>1,214</td>
<td><strong>1,257.7</strong></td>
</tr>
<tr>
<td><code>auto:32768</code></td>
<td>1,068</td>
<td>1,222</td>
<td>1,169</td>
<td>1,198</td>
<td>1,222（太大反而差）</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong><code>auto:16384</code> 係 sweet spot</strong>，再多就反轉 —— 呢個位唔係越大越好。</p>
<h2>四、問題三：引擎版本過舊 —— 升級 0.2.5 → 0.2.18</h2>
<p dir="auto">之前 peak 一直卡喺 1,155，改設定都突破唔到，證明係<strong>引擎層上限</strong>。升級之後即刻唔同。</p>
<h3>升級路上撞到嘅四個坑</h3>
<p dir="auto"><strong>坑 1：入口搬咗家</strong><br />
0.2.18 冇咗頂層 <code>strata.py</code>，新入口係 <strong><code>terminal/strata.py</code></strong>。systemd 嘅 <code>ExecStart</code> 唔改就完全起唔到。</p>
<p dir="auto"><strong>坑 2：<code>releases/latest</code> 已經係 0.2.19／引擎 0.1.65</strong><br />
預設 feed 搵 0.1.64 會 <strong>404</strong>。要指住 v0.2.18 自己嘅 feed：</p>
<pre><code class="language-bash">strata update --feed https://github.com/Niko1221/Strata/releases/download/v0.2.18/strata-feed.json
</code></pre>
<p dir="auto"><strong>坑 3：引擎組件同 source 控制層必須匹配</strong><br />
呢部機之前有一次 0.1.48 升級失敗記錄：</p>
<pre><code>ImportError: cannot import name 'explicit_no_key' from 'serve.server'
</code></pre>
<p dir="auto">即係<strong>淨升引擎唔升控制層會死</strong>，兩樣要一齊升。好在更新器有做簽名驗證 + 測試啟動（載模型＋答一個 token 先 switch），失敗會 rollback。</p>
<p dir="auto"><strong>坑 4：引擎裝咗去 components 目錄，profile 三處要改</strong></p>
<pre><code>~/.local/share/strata/components/engine/0.1.64-linux-x86_64-hip-rx7900/
</code></pre>
<p dir="auto"><code>exe</code>、<code>lib_dirs</code>、<code>vision.exe</code> 都要跟住改指新目錄，唔然繼續行舊引擎。</p>
<h2>五、<code>tune auto</code> quick 模式結果</h2>
<pre><code class="language-bash">strata tune auto --mode quick --goal speed --name &lt;preset名&gt; &lt;profile&gt;
</code></pre>
<p dir="auto"><strong>11 分鐘完成，+4% 快，答案與標準設定完全相同（<code>class: exact</code>）：</strong></p>
<pre><code>改咗：--kv-resident 32768 → 65536
測量：65.2 → 67.9 tok/s（2 of 2 回合都快）
門檻：要 +3.0% 先計；同機重複跑差異 0.8%
</code></pre>
<p dir="auto">佢嘅方法論幾紮實：交錯回合對比、只保留超過噪音嘅增益、答覆要 identical 先敢用。</p>
<h3>兩個要注意</h3>
<ol>
<li>
<p dir="auto"><strong>preset 唔會自動改你明確指定嘅 <code>--profile</code> 檔</strong>。佢講嘅「applied at every start」係指經 <code>strata launch</code> 嗰條路。用明確 <code>--profile</code> 就要手動將 <code>--kv-resident 65536</code> 寫入。</p>
</li>
<li>
<p dir="auto"><strong>quick 模式有兩個 knob 被略過</strong>（因為會輕微改變答案）：</p>
<ul>
<li><code>Re-balance the expert cache faster</code></li>
<li><code>Forget old expert use a little faster</code></li>
</ul>
<p dir="auto">想榨盡要加 <code>--allow-small-differences</code>，或者行 <code>--mode thorough</code>（最多 2 小時）。</p>
</li>
</ol>
<h2>六、最終成效總表</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>指標</th>
<th>原始（0.2.5＋錯表）</th>
<th>最終（0.2.18＋tune）</th>
<th>變化</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>11.5K prefill</strong></td>
<td>674.7 tok/s</td>
<td><strong>1,728.9 tok/s</strong></td>
<td><strong>+156%</strong>（2.56×）</td>
</tr>
<tr>
<td><strong>11.5K TTFT</strong></td>
<td>17.11 s</td>
<td><strong>6.68 s</strong></td>
<td><strong>−61%</strong></td>
</tr>
<tr>
<td>8K prefill</td>
<td>574.5 tok/s</td>
<td><strong>1,382.5 tok/s</strong></td>
<td>+141%</td>
</tr>
<tr>
<td><strong>peak prefill</strong></td>
<td>1,155 tok/s</td>
<td><strong>1,720.9 tok/s</strong></td>
<td><strong>+49%</strong></td>
</tr>
<tr>
<td>prefix cache TTFT（11.5K 重用）</td>
<td>0.24 s</td>
<td><strong>0.05 s</strong></td>
<td><strong>−79%</strong></td>
</tr>
<tr>
<td>decode（1024 tok）</td>
<td>63.5 tok/s</td>
<td><strong>65.9 tok/s</strong></td>
<td>+4%</td>
</tr>
</tbody>
</table>
<h3>Prompt 長度掃描（最終設定）</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>prompt tokens</th>
<th>prefill tok/s</th>
<th>TTFT</th>
</tr>
</thead>
<tbody>
<tr>
<td>8,180</td>
<td>1,686.2</td>
<td>4.85 s</td>
</tr>
<tr>
<td>16,340</td>
<td>1,720.1</td>
<td>9.50 s</td>
</tr>
<tr>
<td>32,708</td>
<td><strong>1,720.9</strong></td>
<td>19.01 s</td>
</tr>
<tr>
<td>65,396</td>
<td>1,691.1</td>
<td>38.67 s</td>
</tr>
</tbody>
</table>
<p dir="auto">好平坦 —— 由 8K 到 65K 都企穩喺 1,690–1,720，冇晒之前嗰種隨長度衰減。</p>
<h3>同官方對比表嘅位置</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>引擎（同一张 7900 XT）</th>
<th>max prefill</th>
</tr>
</thead>
<tbody>
<tr>
<td>升級前（STRATA 0.2.5 + 錯表）</td>
<td>675 tok/s</td>
</tr>
<tr>
<td>STRATA 0.2.9（Avalon 對比基線）</td>
<td>1,453 tok/s</td>
</tr>
<tr>
<td><strong>升級後（STRATA 0.2.18 + tune）</strong></td>
<td><strong>1,721 tok/s</strong></td>
</tr>
<tr>
<td>Avalon（自家 IQ3_KS hybrid）</td>
<td>1,854 tok/s</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>由差人一半，到反超 0.2.9 基線 18%，接近 Avalon。</strong></p>
<h2>七、最終配置（可照抄）</h2>
<pre><code>exe        : ~/.local/share/strata/components/engine/0.1.64-linux-x86_64-hip-rx7900/strata
lib_dirs   : [&lt;engine 目錄&gt;, /opt/rocm/lib]
vision     : &lt;engine 目錄&gt;/strata-vision（CPU reader，threads 16，max 300 image tokens）
env        : STRATA_HIPBLASLT_TABLE = on          ← 唔好硬 pin 表路徑
args 關鍵  : --expert-cache auto
             --vram-reserve-mib 768
             --prefill auto:16384                 ← 唔好留 auto
             --spec 4
             --max-context 131072
             --kv int8
             --kv-resident 65536                  ← tune auto 嘅結果
版本       : strata 0.2.18 (build 0.1.64) / engine 0.1.64-hip-rx7900
</code></pre>
<h2>八、幾句總結</h2>
<ol>
<li><strong>「靜默嘅慢」比崩潰更危險。</strong> 錯調校表唔報錯、唔崩潰，只係默默行慢路徑 —— 如果唔主動去 log 度搵 <code>version mismatch</code>，可能永遠唔知自己蝗咗。建議任何 HIP 機都主動核對一次 log 入面 <code>file=</code> 對唔對得上 <code>runtime=</code>。</li>
<li><strong>三個問題互相獨立，要逐個拆。</strong> 如果只升級版本，會以為「升完得 1,155，唔係話好好多？」；如果只改表，會撞住 chunk 封頂。三個疊埋先至有 +156%。</li>
<li><strong><code>--prefill</code> 唔係越大越好</strong>，<code>auto:16384</code> 係呢部機嘅拐點，<code>auto:32768</code> 反而跌。</li>
<li><strong>用開關（<code>=on</code>）而唔係硬 pin 路徑</strong>，升級時先至唔會再次中伏。</li>
<li><strong><code>tune auto</code> quick 值得跑</strong>：11 分鐘、+4%、答案保證一致，仲會話你知邊啲 knob 被略過、點解。</li>
</ol>
<hr />
<p dir="auto"><em>實測日期：2026-11-22（HKT）。測試方法：同一個基準腳本、loopback 直打 OpenAI 兼容 API，讀 server 自報嘅 <code>timings</code>（prompt_per_second / predicted_per_second / prompt_ms），唔係外層計時。每個數字都係實際跑出嚟，冇計平均。</em></p>
]]></description><link>https://lcz.me/topic/3272</link><generator>RSS for Node</generator><lastBuildDate>Sun, 29 Nov 2026 03:12:02 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/3272.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 22 Nov 2026 12:24:14 GMT</pubDate><ttl>60</ttl></channel></rss>