<?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[RX 7900 XTX 跑 Strata-rdna3（gfx1100）调优记录：IQ3_S + MTP，prefill 2,640 / decode 99.3]]></title><description><![CDATA[<h1>RX 7900 XTX 跑 Strata-rdna3（gfx1100）调优记录：IQ3_S + MTP，prefill 2,640 / decode 99.3</h1>
<p dir="auto"><strong>先说项目地址：<a href="https://github.com/nicejunjie/Strata-rdna3" rel="nofollow ugc">https://github.com/nicejunjie/Strata-rdna3</a><br />
向项目人员致敬。</strong></p>
<p dir="auto">硬件是上一代服务器平台：华南金牌 x99 TF + E5 2696v4 + DDR4 64G，搭配 7900 XTX。结论先说：<strong>decode 已经追平作者 README 的参考值，prefill 差 23%</strong>；这 23% 的差距来自 CPU 平台，不是参数。</p>
<h2>一、环境</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>GPU</td>
<td>Radeon RX 7900 XTX 24 GB（gfx1100）</td>
</tr>
<tr>
<td>CPU</td>
<td>Xeon E5-2696v4，22 核 44 线程（Broadwell，只有 AVX2）</td>
</tr>
<tr>
<td>内存</td>
<td>DDR4-2400，62 GB 可用</td>
</tr>
<tr>
<td>系统</td>
<td>Linux 7.0，ROCm 10.1（自编译），hipBLASLt 100401</td>
</tr>
<tr>
<td>引擎</td>
<td><code>nicejunjie/Strata-rdna3</code> 分支 <code>rdna3</code> @ <code>fc8f823</code>（引擎版本号 0.1.43，llama.cpp pin <code>3cf03257</code>）</td>
</tr>
<tr>
<td>模型</td>
<td>IQ3_S pack（<code>sc117-iq3_s</code>）+ MTP 草稿头，<code>--resident-experts</code> 全常驻</td>
</tr>
<tr>
<td>调优表</td>
<td><code>gfx1100-hipblaslt-100401-full.txt</code>（48 行，全命中，无 fallback）</td>
</tr>
</tbody>
</table>
<p dir="auto">使用 AVX2 主机前，需要先修复一个 SIGILL 问题：<code>src/kernels/cpu/iq_avx512.cpp</code> 里的 <code>iq3s_planes_ready</code> / <code>iq3xxs_tables_ready</code> 是命名空间作用域内由 lambda 初始化的查表。它们会被编译器按文件级 AVX-512 属性常量折叠成 <code>vmovdqa64 %zmm0</code>，在 <code>main</code> 之前执行，从而产生非法指令。把它们改成带 <code>__attribute__((noinline, target("sse4.2")))</code> 的填充函数后即可解决（作者使用 Zen4，看不到这个问题）。</p>
<h2>二、调优过程对比</h2>
<p dir="auto">测试口径：使用同一二进制、同一 pack，只改参数；每条 prompt 加时间戳，强制不复用缓存，<code>reused==0</code> 才算有效；每档跑 2 次并取中位数。主测 prompt 为 11,168 token（模拟真实 RAG 长上下文），另测 665 token 短 prompt。</p>
<h3>1）先定“用哪套 env”</h3>
<p dir="auto">11K prompt，各 3 次，<code>--resident-budget-gib 30</code>：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>配置</th>
<th style="text-align:right">prefill</th>
<th style="text-align:right">decode</th>
</tr>
</thead>
<tbody>
<tr>
<td>只有基础 8 个变量</td>
<td style="text-align:right">1,842</td>
<td style="text-align:right">71.7</td>
</tr>
<tr>
<td>+ fork 的 18 个 decode 专用变量</td>
<td style="text-align:right">1,902</td>
<td style="text-align:right">82.6</td>
</tr>
<tr>
<td>+ 合并集（45 个变量）</td>
<td style="text-align:right">2,502</td>
<td style="text-align:right">82.7</td>
</tr>
</tbody>
</table>
<p dir="auto">fork 的 decode 内核（<code>STRATA_GR_RDNA</code> / <code>STRATA_RDNA_Q6K</code> / <code>STRATA_GR_FUSED</code> / <code>STRATA_PA_KLDS</code> 这批变量）确实只在这个分支里有，上游到 v0.2.7.1 都没有等价实现。合并集比纯 decode 集 prefill 高 30% 以上，所以直接采用合并集。</p>
<h3>2）常驻策略：<code>--resident-budget-gib</code> 是个坑</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>参数</th>
<th style="text-align:right">常驻内存</th>
<th style="text-align:right">prompt 借用区</th>
<th style="text-align:right">内存占用</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>--resident-budget-gib 34 / 36 / 42</code></td>
<td style="text-align:right">29.66 GiB</td>
<td style="text-align:right">0 / 2858 进 RAM</td>
<td style="text-align:right">66%</td>
</tr>
<tr>
<td><code>--resident-experts</code>（固定 <code>--prefill 16384</code>）</td>
<td style="text-align:right">35.07 GiB</td>
<td style="text-align:right">2858 / 2858</td>
<td style="text-align:right">74.9%</td>
</tr>
<tr>
<td><code>--resident-experts</code> + <code>--prefill auto</code></td>
<td style="text-align:right">39.27 GiB</td>
<td style="text-align:right">5288 / 5288</td>
<td style="text-align:right">82.3%</td>
</tr>
</tbody>
</table>
<p dir="auto">带 budget 时，引擎会走“按 profile 排名塞满”的分支；源码里的 <code>lend_from_slot = -1;</code> 会直接关掉 prompt 借用的区域，因此借用的专家每次预填充都要从 NVMe 重读。日志中会出现：</p>
<pre><code class="language-text">WARNING: a prompt chunk of 16384 tokens lends 2858 cache slots ... only 0 of their experts
fit in RAM (#669)
</code></pre>
<p dir="auto">预算调到 42 GiB 也一样，因为问题不是内存不够，而是这条路径被关掉了。上游 0.1.47 才补上“budget 下也保留借用区”，这个 fork 还是 0.1.43。换成 <code>--resident-experts</code> 就正常，日志应出现：</p>
<pre><code class="language-text">2858 of the prompt path's 2858 lendable slots keep their experts in RAM too
</code></pre>
<h3>3）单参数对比</h3>
<p dir="auto">11,168 token，各 2 次：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>配置</th>
<th style="text-align:right">prefill</th>
<th style="text-align:right">decode</th>
</tr>
</thead>
<tbody>
<tr>
<td>起点：<code>--prefill 16384</code>、<code>--vram-reserve-mib 896</code>、<code>--pool-workers 20</code></td>
<td style="text-align:right">2,533 / 2,539</td>
<td style="text-align:right">86.3 / 92.8</td>
</tr>
<tr>
<td>+ <code>--prefill auto</code>（<code>STRATA_PREFILL_AUTO_MAX=32768</code>）+ <code>--vram-reserve-mib 512</code></td>
<td style="text-align:right">2,625 / 2,633</td>
<td style="text-align:right">91.5 / 99.9</td>
</tr>
<tr>
<td>再加 <code>--mtp-q4 all --mtp-window 4096 --spec 3</code></td>
<td style="text-align:right">2,649</td>
<td style="text-align:right">93.9</td>
</tr>
<tr>
<td>再加 <code>STRATA_PREFILL_CPU_SHARE_MAX=12288</code> + <code>STRATA_PREFILL_MMQ_TILE_ROWS=64</code> + workers 21</td>
<td style="text-align:right">2,218（退）</td>
<td style="text-align:right">103.3</td>
</tr>
<tr>
<td>定稿：auto + 512 + <code>--pool-workers 21</code></td>
<td style="text-align:right">2,633 / 2,640</td>
<td style="text-align:right">99.3 / 99.4</td>
</tr>
</tbody>
</table>
<p dir="auto">短 prompt（665 token，定稿）：prefill 约 486、decode 约 83。</p>
<p dir="auto">有效的只有三个：</p>
<ul>
<li><code>--prefill auto</code>：chunk 会按“RAM 能兜住多少借用专家”自适应；借用区从 2858 涨到 5288 个槽并全部驻留，才吃得住大 chunk。固定 16384 反而浪费。</li>
<li><code>--vram-reserve-mib 512</code>（原 896）：多给 194 个 GPU 专家槽（9,058 → 9,252）。</li>
<li><code>--pool-workers 21</code>（= 物理核 − 1）：decode 从 91~92 稳定到 99。</li>
</ul>
<p dir="auto">无效或反效果：</p>
<ul>
<li><code>--mtp-q4 all --mtp-window 4096 --spec 3</code>：与 spec 4 无实质差别（decode 中位 93.9）。</li>
<li><code>STRATA_PREFILL_CPU_SHARE_MAX=12288</code> + <code>TILE_ROWS=64</code>：prefill 掉 16%。在 AVX2 主机上不要改动这两项。</li>
</ul>
<h2>三、和作者 README 的差距</h2>
<p dir="auto">README 里 IQ3_S / 1 GPU 那行：<code>3,432 / 100.0</code>、<code>3,436 / 100.4</code>、<code>3,091 / 93.6</code>，跑在 9950X3D2 + DDR5 + 128 GB 上。</p>
<p dir="auto">本机：decode 99.3（持平），prefill 2,640（差 23%）。</p>
<p dir="auto">原因在预填充的算法结构：MoE 专家行那部分由 CPU 计算，<code>iq_avx512.cpp</code> 的 AVX-512 VNNI 路径只在 AVX-512 主机上生效，AVX2 机器回落到普通 dot；再加上 DDR5 与 DDR4-2400 的带宽差。单核相差 1.5–2 倍，内存相差 2 倍；这个缺口不是参数能补的。</p>
<h2>四、定稿参数（可直接抄）</h2>
<p dir="auto">启动参数：</p>
<pre><code class="language-bash">--pack &lt;包目录&gt; --native &lt;GGUF-1&gt; --ple-gguf &lt;GGUF-2&gt; --ple-io direct
--resident-experts --expert-profile &lt;expert-profile.bin&gt; --expert-cache auto
--spec 4 --spec-min-p 0.5 --mtp &lt;MTP目录&gt;
--max-context 196608 --pcie-frac 0 --kv int8 --pool-workers 21
--adapt-every 2 --adapt-async 1 --vision
--prefill auto --kv-resident 32768 --vram-reserve-mib 512
--prompt-cache 16 --prompt-cache-tail
</code></pre>
<p dir="auto">环境变量（45 个）：</p>
<pre><code class="language-bash"># hipBLASLt / WMMA
STRATA_HIPBLASLT_TUNING=/path/gfx1100-hipblaslt-100401-full.txt
STRATA_HIPBLASLT_VERBOSE=1
STRATA_WMMA_GEMM=1
STRATA_HIP_WMMA=1
STRATA_PF_SWITCH_MIN_T=4096
STRATA_WATCHDOG_S=180

# RDNA3 decode 内核（fork 专属）
STRATA_RDNA_MMVQ_WAVE=3
STRATA_SELECT_WMMA=1
STRATA_SH_STREAM=0
STRATA_GR_RDNA=1
STRATA_GR_RDNA_Q8=1
STRATA_RDNA_Q6K=1
STRATA_GR_RDNA_A8=1
STRATA_GR_FUSED=1

# prefill
STRATA_PREFILL_AUTO_MAX=32768
STRATA_PREFILL_MMQ_TILE_ROWS=32
STRATA_PREFILL_CPU_SHARE=auto
STRATA_PREFILL_CPU_SHARE_MAX=6144
STRATA_STAGER_RING=64
STRATA_PREFILL_RING=192
STRATA_PF_F16=2
STRATA_PF_FUSED=1
STRATA_PF_PAD=1
STRATA_PF_HCDOWN=1
STRATA_PF_GROUP_RES=1
GPU_MAX_HW_QUEUES=6

# verify / decode 融合
STRATA_QFUSE=1
STRATA_COMBINE_CPU=1
STRATA_VERIFY_QDEDUP=1
STRATA_WAIT_FUSE=1
STRATA_ROUTE_PUBLISH=1
STRATA_GR_INJ_UP=1

# GDN / 注意力
STRATA_GDN_HEAD=1
STRATA_GDN_CHUNKED=1
STRATA_GDN_CHUNK_GDV=0
STRATA_GDN_PP=1
STRATA_GDN_CONVL2=1
STRATA_GDN_NOY=1
STRATA_PA_KLDS=1
STRATA_PA_FAST=1

# 杂项
STRATA_HC_UPMIX=1
STRATA_FUSE_CONVAB=1
STRATA_HEAD_MIX_MULTI=1
STRATA_KV_HOST_DMA=1
</code></pre>
<p dir="auto">反向经验：不要用 <code>--resident-budget-gib</code>（借用区会被关掉），不要在 AVX2 主机上调大 <code>STRATA_PREFILL_CPU_SHARE_MAX</code> / <code>STRATA_PREFILL_MMQ_TILE_ROWS</code>。</p>
<h2>五、怎么验证调对了</h2>
<pre><code class="language-bash">grep -a "lendable slots keep" strata.log
grep -E "expert cache [0-9]+ slots|resident RAM mode" strata.log
grep -E "prompt [0-9]+ tokens =" strata.log
</code></pre>
]]></description><link>https://lcz.me/topic/2670</link><generator>RSS for Node</generator><lastBuildDate>Tue, 24 Nov 2026 00:16:10 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/2670.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 28 Oct 2026 18:00:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to RX 7900 XTX 跑 Strata-rdna3（gfx1100）调优记录：IQ3_S + MTP，prefill 2,640 / decode 99.3 on Thu, 29 Oct 2026 00:36:31 GMT]]></title><description><![CDATA[<p dir="auto"><img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=b5f8626d144" class="not-responsive emoji emoji-android emoji--white_check_mark" style="height:1.4em;width:auto;vertical-align:middle" title="✅" alt="✅" /> 版主审定：本帖设为<strong>优秀</strong>，作者 <strong>+3 积分</strong>奖励，继续加油！</p>
<blockquote>
<p dir="auto">奖励凭证：优秀 +3 分 · 编号 e2670-120-1</p>
</blockquote>
]]></description><link>https://lcz.me/post/28909</link><guid isPermaLink="true">https://lcz.me/post/28909</guid><dc:creator><![CDATA[Xiaote]]></dc:creator><pubDate>Thu, 29 Oct 2026 00:36:31 GMT</pubDate></item><item><title><![CDATA[Reply to RX 7900 XTX 跑 Strata-rdna3（gfx1100）调优记录：IQ3_S + MTP，prefill 2,640 / decode 99.3 on Wed, 28 Oct 2026 22:32:03 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kenshin" aria-label="Profile: kenshin">@<bdi>kenshin</bdi></a> 是啊，我用的是7900xtx，可能是作者没有针对我用的模型优化</p>
]]></description><link>https://lcz.me/post/28881</link><guid isPermaLink="true">https://lcz.me/post/28881</guid><dc:creator><![CDATA[J Z 0]]></dc:creator><pubDate>Wed, 28 Oct 2026 22:32:03 GMT</pubDate></item><item><title><![CDATA[Reply to RX 7900 XTX 跑 Strata-rdna3（gfx1100）调优记录：IQ3_S + MTP，prefill 2,640 / decode 99.3 on Wed, 28 Oct 2026 22:18:08 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/j-z-0" aria-label="Profile: J-Z-0">@<bdi>J-Z-0</bdi></a> 这是是针对 rx 7000 系列显卡的优化 Strata 分支版本。</p>
]]></description><link>https://lcz.me/post/28874</link><guid isPermaLink="true">https://lcz.me/post/28874</guid><dc:creator><![CDATA[kenshin]]></dc:creator><pubDate>Wed, 28 Oct 2026 22:18:08 GMT</pubDate></item><item><title><![CDATA[Reply to RX 7900 XTX 跑 Strata-rdna3（gfx1100）调优记录：IQ3_S + MTP，prefill 2,640 / decode 99.3 on Wed, 28 Oct 2026 20:00:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/kenshin" aria-label="Profile: kenshin">@<bdi>kenshin</bdi></a> 试了一下， 5900xt 128g ddr4，跑的是Q4_K_XL。比最新的strata没有提升，几乎差不多。 --ple-io ram 在我这里最好， direct decode速度从60调到30。 STRATA_VERIFY_PROFILE=1 对我也是速度减半， 去掉反而好。<br />
总之这个对我没什么帮助， 还有个模型跑完一直卡在100% GPU使用的问题</p>
]]></description><link>https://lcz.me/post/28866</link><guid isPermaLink="true">https://lcz.me/post/28866</guid><dc:creator><![CDATA[J Z 0]]></dc:creator><pubDate>Wed, 28 Oct 2026 20:00:58 GMT</pubDate></item></channel></rss>