<?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[关于双AMD RX7900XTX的使用感受]]></title><description><![CDATA[<p dir="auto">我的主板是<br />
处理器	Intel Core i7-10700K @ 3.80GHz（8核16线程）<br />
显卡	2张 AMD Radeon RX 7900 XTX（gfx1100）——XFX 一块 + Sapphire 一块<br />
内存	62GiB（约64GB）ddr4<br />
磁盘	1块 NVMe 1.9TB：系统盘 /（190G ext4，已用93%）+ 新加卷（1.7T ntfs，挂载到 /media/qiankun/新加卷）<br />
系统	Ubuntu 22.04.5 LTS（内核 6.8.0-138-generic，GNOME Wayland）<br />
主板是 华硕 z590 吹雪<br />
部署到模型：Qwen3.8-27B-Uncensored-GPTQ-Int4-sym-G128-MTP-BF16</p>
<p dir="auto">我是按照<a href="https://github.com/StevenChenSE/vllm/tree/feat/dflash-perf-opt" rel="nofollow ugc">https://github.com/StevenChenSE/vllm/tree/feat/dflash-perf-opt</a> 这个项目去编译本地vllm的<br />
关于速度的话其实我已经满意了，聚合测试下，2并发达到85t/s，4并发达到40t/s<br />
长上下文的话接近200k是基本在50t/s左右<br />
这个速度是我连接codex调用模型和hermes还有DSH调用模型观察出来的，不是机器短测试<br />
模型运行起来，第一句话会久一点，大概1分钟半，第二句话的就基本在5秒左右就能看懂响应<br />
用起来给我的体感特别好，就像用在线模型一样，然后我是驾校文员嘛，本地处理学员资料的话<br />
调用Qwen3.8-27b的这个模型都能完成我的任务<br />
用codex目前也在按照我的想法制作《我的世界》，看看多久才能做出来<br />
Hermes作为主智能体就是工作干活<br />
DSH基本作为玩具，经常就是调用模型来写插件<br />
总体来说，已经非常棒了，两张卡二手，一张去年4000收的，一张今年4700收的，加上主板其他总价值在1w5左右的机器<br />
耗电来说我正常使用下来白天干活，我睡觉就关机，耗电是4.5度电，运行时间早上9点到晚上12点<br />
因为处理器是10代的原因，主板走的是PCIE3.0<em>8的通道 速度才这么些，如果我换了cpu支持PCIE4.0的话，速度将会更快，如果换了主板，支持原生Pcle4.0</em>16或者pcie5.0点话，我估计无论是输入速度或者输出速度，会更快<br />
还有就是我用的双电源，另外一张电源是给一张显卡独立供电的<br />
下面是我让我的hermes总结编译踩的坑，如果有什么其他问题可以给我留言，我会让我的小马获取数据发出来</p>
<h1>从 GitHub 源码编译 vLLM（ROCm 版）踩坑全记录</h1>
<blockquote>
<p dir="auto">环境：Ubuntu 22.04 裸机 + 双 AMD Radeon RX 7900 XTX（gfx1100）+ ROCm 7.2<br />
源码：GitHub fork（含 DFlash2 / MTP 投机解码魔改，feat/dflash-perf-opt 分支，1282 个提交）<br />
安装方式：venv（Python 3.12）+ <code>pip install -e .</code> 可编辑安装<br />
成品版本：<code>0.1.dev1159+gd9d13a27b.rocm721</code>（rocm 后缀 = ROCm 构建，这是正常的）</p>
</blockquote>
<p dir="auto"><strong>先说结论</strong>：整条路走通了。编译阶段 6 个坑，运行阶段 3 个坑，全部踩平。最终测试结果：单请求实测 <strong>73.2 ~ 82.6 tok/s</strong>（Qwen3.8-27B GPTQ Int4 + 自带 MTP 投机解码，双卡 TP2，草稿接受率 84%）。下面按时间顺序讲每个坑怎么踩的、怎么解决的。</p>
<hr />
<h2>一、源码阶段：3 个坑</h2>
<h3>坑 1：GitHub 国内直连不通，大仓库拉不下来</h3>
<p dir="auto"><strong>症状</strong>：<code>git clone https://github.com/...</code> 直接超时，连网页都打不开。</p>
<p dir="auto"><strong>解决</strong>：换 <code>ghfast.top</code> 镜像代理：</p>
<pre><code class="language-bash">git clone https://ghfast.top/https://github.com/StevenChenSE/vllm.git
</code></pre>
<p dir="auto">小仓库直连有时能过，但 vLLM 这种仓库体积大，必须走镜像。<code>ghproxy.net</code> 和 <code>mirror.ghproxy.com</code> 实测不通，别浪费时间试。</p>
<h3>坑 2：浅克隆让版本管理器报警（虚惊）</h3>
<p dir="auto"><strong>症状</strong>：编译一开始就刷警告：</p>
<pre><code>UserWarning: "/home/qiankun/vllm-dflash" is shallow and may cause errors
</code></pre>
<p dir="auto">还顺带导致版本号算出来是 <code>0.1.dev1159+g...</code> 这种丑样子，看起来像编译出问题了。</p>
<p dir="auto"><strong>解决</strong>：不用解决。<code>git clone --depth 1</code> 浅克隆会让 setuptools_scm 没法从 tag 推算正式版本号，于是退化成 dev 版本号。它自己说了"may cause errors"——实测<strong>没造成影响</strong>，功能完好。为了一个好看的版本号去 <code>git fetch --unshallow</code> 重拉几个 G，不值。</p>
<h3>坑 3：PyPI 的默认 wheel 是 CUDA 版，装了也白装</h3>
<p dir="auto"><strong>症状</strong>：之前图省事 <code>pip install vllm</code> 装的是 PyPI 默认包，结果在 AMD 卡上直接失败——因为 PyPI 上的 wheel 是给 NVIDIA CUDA 编的。</p>
<p dir="auto"><strong>解决</strong>：AMD 卡必须走 <strong>ROCm 构建</strong>。先装了官方 ROCm wheel（<code>vllm 0.28.0+rocm723</code>）顶着用，后来要跑魔改分支的投机解码功能，只能回退到源码编译：</p>
<pre><code class="language-bash">/home/qiankun/vllm-venv/bin/pip install -e /home/qiankun/vllm-dflash
</code></pre>
<p dir="auto"><code>-e</code>（editable）的好处：改一行源码，重启就生效，不用反复重新打包。安装时 pip 自动发现并卸载了旧的 <code>0.28.0+rocm723</code> wheel，干净替换，这一步没出幺蛾子。</p>
<hr />
<h2>二、编译阶段：3 个坑</h2>
<h3>坑 4：C++ 扩展编译时满屏 deprecated 警告</h3>
<p dir="auto"><strong>症状</strong>：编译 csrc 阶段（C++/HIP 代码编译成 <code>.so</code>）刷出一堆：</p>
<pre><code>csrc/cumem_allocator_compat.h:45:26: warning:
'hipError_t hipCtxGetCurrent(ihipCtx_t**)' is deprecated:
This API is marked as deprecated and might not be supported in future releases
</code></pre>
<p dir="auto">看着很吓人，像要挂。</p>
<p dir="auto"><strong>解决</strong>：<strong>不用管，全是警告不是错误</strong>。ROCm 在标一批旧 HIP API 弃用，vLLM 的兼容层还在用。只要最后看到 <code>Successfully installed ... vllm-0.1.dev1159+...rocm721</code> 就是成功。判别标准只有一条：<strong>error 才是事故，warning 是噪音</strong>。</p>
<h3>坑 5：GLIBCXX_3.4.31 not found（最隐蔽的一个）</h3>
<p dir="auto"><strong>症状</strong>：编译明明成功了，一跑 <code>import vllm</code> 直接崩：</p>
<pre><code>ImportError: /lib/x86_64-linux-gnu/libstdc++.so.6:
version 'GLIBCXX_3.4.31' not found
(required by .../torch/lib/libtorch_python.so)
</code></pre>
<p dir="auto">torch 的 ROCm 版是按较新的系统 C++ 运行时编的，Ubuntu 22.04 自带的 libstdc++ 只有 GLIBCXX 3.4.28，差一个版本都不行。<strong>这个坑最隐蔽</strong>——它不在编译期暴露，编译全绿、安装成功，直到第一次 import 才炸。</p>
<p dir="auto"><strong>解决</strong>：从 ROCm/torch 包里拿一个新版 libstdc++ 放到独立目录，启动时用 <code>LD_LIBRARY_PATH</code> 指过去：</p>
<pre><code class="language-bash"># /home/qiankun/libs/libstdc++.so.6 携带 GLIBCXX_3.4.32
export LD_LIBRARY_PATH=/home/qiankun/libs:/opt/rocm/lib:/opt/rocm/lib64
</code></pre>
<p dir="auto">这个 export 必须写进启动脚本（<code>start-kernelogic.sh</code> 第一行），漏掉它 torch 就起不来。<strong>注意：这条只影响 vllm 自己的环境</strong>——我后来用系统 python 查 GPU 风扇的时候就因为没带这个路径，"GPU 负载测试"白跑了两分钟，GPU 根本没收到负载，还以为风扇有问题。教训：测 GPU 之前先确认 python 进程真的活着在吃卡。</p>
<h3>坑 6：编译日志没有时间戳，耗时算不清</h3>
<p dir="auto"><strong>症状</strong>：想知道编译到底花了多久，翻 <code>vllm-build.log</code> 发现里面除了 pip 的输出什么都没有时间戳，948 行里全是 "Running command xxx: started / finished"。</p>
<p dir="auto"><strong>解决</strong>：用日志文件修改时间 + 启动日志里的时间戳交叉推算：编译完成时间（build log mtime 22:30 前后）到 serve 日志里第一条 worker 时间戳（23:05）的间隔，再加上引擎自报的 "compilation: 54.87 s"，基本能对上是<strong>十几分钟的量级</strong>。以后想精确计时，编译命令套一层 <code>time pip install -e . 2&gt;&amp;1 | tee build.log</code> 就一劳永逸——这次是事后补的，没留干净数据，不装懂。</p>
<hr />
<h2>三、运行阶段：3 个坑</h2>
<h3>坑 7：双卡 TP=2 一启动就 NCCL 崩</h3>
<p dir="auto"><strong>症状</strong>：<code>--tensor-parallel-size 2</code> 启动直接崩，NCCL 通信初始化失败。</p>
<p dir="auto"><strong>解决</strong>：ROCm 双卡 IPC 的祖传问题，两行环境变量钉死：</p>
<pre><code class="language-bash">export HSA_ENABLE_IPC_MODE_LEGACY=0    # 关旧 IPC 模式
export HSA_FORCE_FINE_GRAIN_AMDGPU=1    # 强制细粒度内存
</code></pre>
<p dir="auto">一个都不能少。TP=1 能跑但模型塞不下，TP=2 又必崩——卡就这两张，没得选，只能修。</p>
<h3>坑 8：首次启动"卡死"3 分钟，其实是在编译</h3>
<p dir="auto"><strong>症状</strong>：启动后日志停在 CUDA graph 捕获进度条上，几分钟没动静，人已经准备 ctrl+c 了。</p>
<p dir="auto"><strong>解决</strong>：等。真实数据在这台机器上的日志里写得明明白白：</p>
<pre><code>init engine (profile, create kv cache, warmup model) took 174.56 s
(compilation: 54.87 s)
Capturing CUDA graphs (PIECEWISE): 27/27 [00:11]
Capturing CUDA graphs (FULL):      15/15 [00:05]
</code></pre>
<p dir="auto">首次启动总耗时约 3 分钟：torch.compile 编译 55 秒 + Triton 按 shape JIT 编译 kernel + 两轮 CUDA graph 捕获（分段图 11 秒 + 完整图 5 秒）。<strong>这是正常流程不是死锁</strong>。之后缓存落盘，重启只要约 2 分钟。唯一的例外：清掉 <code>~/.triton/cache</code> 会重新计时。</p>
<h3>坑 9：进程杀不干净，重启必 OOM</h3>
<p dir="auto"><strong>症状</strong>：APIServer 崩了（exit 1，日志里没 traceback），端口空了、<code>curl /health</code> 不通，感觉服务没了——但下次一重启就报：</p>
<pre><code>ValueError: Free memory on device cuda:0 (1.29/23.98 GiB) on startup
is less than desired GPU memory utilization (0.95, 22.79 GiB)
</code></pre>
<p dir="auto"><strong>根因</strong>：vLLM 是多进程架构，主 API 进程崩了，Worker/EngineCore 会变成<strong>孤儿进程残留</strong>继续霸占显存。更坑的是 <code>rocm-smi --showpids | grep python</code> 查不到它们——孤儿进程名是 <code>VLLM::Worker_TP</code> / <code>VLLM::EngineCor</code>，不带 "python" 字样。</p>
<p dir="auto"><strong>解决</strong>：</p>
<pre><code class="language-bash">rocm-smi --showpids          # 找 VLLM:: 开头、显存占用非 0 的进程
kill -9 &lt;PID1&gt; &lt;PID2&gt; ...    # Worker_TP0/TP1 + EngineCore 全杀
rocm-smi --showpids | grep VLLM   # 确认清空再重启
</code></pre>
<p dir="auto">另外别用 <code>pkill -9 -f vllm</code>——会把自己 shell 命令里带 "vllm" 字样的部分一起杀掉，进程看起来"杀了又复活"，其实是 pgrep 匹配到了自己。判真伪只认两条：端口（<code>ss -ltn</code>）和显存（<code>rocm-smi</code>）。</p>
<hr />
<h2>四、最终测试结果（真实数据）</h2>
<p dir="auto">服务起在 8655 端口，模型为 kernelogic Qwen3.8-27B（GPTQ Int4 + 自带 MTP 投机解码，双卡 TP2）。</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项目</th>
<th>结果</th>
</tr>
</thead>
<tbody>
<tr>
<td>健康检查</td>
<td><code>/health</code> 返回 200</td>
</tr>
<tr>
<td>单请求速度（400 token，实时实测）</td>
<td>400 tok / 5.5s = <strong>73.2 tok/s</strong></td>
</tr>
<tr>
<td>单请求速度（800 token，复测）</td>
<td><strong>82.6 tok/s</strong></td>
</tr>
<tr>
<td>稳定区间</td>
<td>77.8 ~ 82.6 tok/s</td>
</tr>
<tr>
<td>MTP 草稿接受率</td>
<td><strong>84%</strong>（接受 1 次出 2 个 token）</td>
</tr>
<tr>
<td>引擎初始化（首次）</td>
<td>174.56 秒（其中编译 54.87 秒）</td>
</tr>
<tr>
<td>CUDA graph 捕获</td>
<td>PIECEWISE 27 档 11 秒 + FULL 15 档 5 秒</td>
</tr>
<tr>
<td>KV cache</td>
<td>10.99 GiB，max-model-len 200000 撑得住</td>
</tr>
</tbody>
</table>
<p dir="auto">对照：加 MTP 之前同模型同双卡是 ~58 tok/s，加了自带 MTP 之后到 77.8+，<strong>提速约 34%</strong>。这个提速是接口口径的均速（completion_tokens ÷ 总耗时，含思考 token），不是峰值——自回归生成是稳态过程，均速就等于实际速度。</p>
<p dir="auto">回答"体感慢"的常见疑问：这个模型思考很长，而思考部分和正文是<strong>同一个解码速度</strong>，所以体感慢的锅不在引擎，在思考长度。想快只能压思考（<code>--reasoning-parser qwen3</code> 已配，把思考抽到 reasoning 字段不污染正文），再往上提只能换模型。</p>
<hr />
<h2>五、一张表总结所有坑</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>#</th>
<th>坑</th>
<th>阶段</th>
<th>症状</th>
<th>解法</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>GitHub 直连不通</td>
<td>拉源码</td>
<td>clone 超时</td>
<td>走 ghfast.top 镜像</td>
</tr>
<tr>
<td>2</td>
<td>浅克隆版本报警</td>
<td>编译</td>
<td>"shallow may cause errors"</td>
<td>虚惊，忽略</td>
</tr>
<tr>
<td>3</td>
<td>PyPI wheel 是 CUDA 版</td>
<td>安装</td>
<td>AMD 卡上直接失败</td>
<td>用 ROCm 构建（rocm 后缀）</td>
</tr>
<tr>
<td>4</td>
<td>HIP API deprecated 警告</td>
<td>编译</td>
<td>满屏 warning</td>
<td>是 warning 不是 error，忽略</td>
</tr>
<tr>
<td>5</td>
<td>GLIBCXX_3.4.31 缺失</td>
<td>运行</td>
<td>import 崩，最隐蔽</td>
<td>LD_LIBRARY_PATH 指新版 libstdc++</td>
</tr>
<tr>
<td>6</td>
<td>日志无时间戳</td>
<td>计时</td>
<td>算不清编译耗时</td>
<td>以后 tee + 交叉验证</td>
</tr>
<tr>
<td>7</td>
<td>TP=2 NCCL 崩</td>
<td>运行</td>
<td>双卡通信失败</td>
<td>两行 HSA 环境变量</td>
</tr>
<tr>
<td>8</td>
<td>首启"卡死"3 分钟</td>
<td>运行</td>
<td>像死锁</td>
<td>等，实际在 JIT 编译 + 捕图</td>
</tr>
<tr>
<td>9</td>
<td>孤儿进程霸显存</td>
<td>运行</td>
<td>重启必 OOM</td>
<td>rocm-smi 按 <code>VLLM::</code> 精确杀</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>一句话血泪总结</strong>：编译阶段 6 个坑里只有 GLIBCXX 是真坑（其余是虚惊或镜像问题），运行阶段 3 个坑个个"差一个参数就崩"。坑不可怕，可怕的是每个坑的报错都像别的事——NCCL 崩像驱动问题、OOM 像显存不够、import 崩像编译失败。诊断顺序永远是：<strong>看进程是不是真的活着（端口+显存）→ 看日志里第一条真实报错 → 再动手</strong>。</p>
]]></description><link>https://lcz.me/topic/1482</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 22:53:36 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/1482.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 03 Sep 2026 07:10:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 关于双AMD RX7900XTX的使用感受 on Fri, 04 Sep 2026 02:02:18 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> 还是非常值得的，960g带宽，pcie如果不成为瓶颈的话速度我觉得会很恐怖</p>
]]></description><link>https://lcz.me/post/15771</link><guid isPermaLink="true">https://lcz.me/post/15771</guid><dc:creator><![CDATA[坤坤]]></dc:creator><pubDate>Fri, 04 Sep 2026 02:02:18 GMT</pubDate></item><item><title><![CDATA[Reply to 关于双AMD RX7900XTX的使用感受 on Fri, 04 Sep 2026 02:01:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/iamvirus" aria-label="Profile: iamvirus">@<bdi>iamvirus</bdi></a> 主要测试哪些呢，我对那些成绩怎么测试也不太懂，只能从实际应用来达到测试，还请麻烦说下能测哪些</p>
]]></description><link>https://lcz.me/post/15770</link><guid isPermaLink="true">https://lcz.me/post/15770</guid><dc:creator><![CDATA[坤坤]]></dc:creator><pubDate>Fri, 04 Sep 2026 02:01:35 GMT</pubDate></item><item><title><![CDATA[Reply to 关于双AMD RX7900XTX的使用感受 on Fri, 04 Sep 2026 01:34:41 GMT]]></title><description><![CDATA[<p dir="auto">不错，多来点测试！主要看看prefill。其实现在发现双R9700 速度是双7900xtx的双倍了，而且还是fp8。。。虽然目前双7900xtx 速度也不错了</p>
]]></description><link>https://lcz.me/post/15763</link><guid isPermaLink="true">https://lcz.me/post/15763</guid><dc:creator><![CDATA[iamvirus]]></dc:creator><pubDate>Fri, 04 Sep 2026 01:34:41 GMT</pubDate></item><item><title><![CDATA[Reply to 关于双AMD RX7900XTX的使用感受 on Thu, 03 Sep 2026 13:19:53 GMT]]></title><description><![CDATA[<p dir="auto">很好，双xtx我也打算年底有空的时候折腾下。踩坑总结的不错。</p>
]]></description><link>https://lcz.me/post/15695</link><guid isPermaLink="true">https://lcz.me/post/15695</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Thu, 03 Sep 2026 13:19:53 GMT</pubDate></item><item><title><![CDATA[Reply to 关于双AMD RX7900XTX的使用感受 on Thu, 03 Sep 2026 08:16:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/farmer-node" aria-label="Profile: farmer-node">@<bdi>farmer-node</bdi></a> 没有诶，可能你不是死循环，而是思考内容太多太多了，思考开中就行，就是，medium</p>
]]></description><link>https://lcz.me/post/15637</link><guid isPermaLink="true">https://lcz.me/post/15637</guid><dc:creator><![CDATA[坤坤]]></dc:creator><pubDate>Thu, 03 Sep 2026 08:16:59 GMT</pubDate></item><item><title><![CDATA[Reply to 关于双AMD RX7900XTX的使用感受 on Thu, 03 Sep 2026 07:57:43 GMT]]></title><description><![CDATA[<p dir="auto">我也是这个版本，但是用的时候，容易死循环，单流速度确实挺快的，但是2流或是3流就直接卡死了，你这边有这些问题吗？</p>
]]></description><link>https://lcz.me/post/15633</link><guid isPermaLink="true">https://lcz.me/post/15633</guid><dc:creator><![CDATA[farmer node]]></dc:creator><pubDate>Thu, 03 Sep 2026 07:57:43 GMT</pubDate></item></channel></rss>