<?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[【H3剑心比赛】2×7900XTX | TP=2 | P2P open | MiniMax H3主流生成2D、3D影像]]></title><description><![CDATA[<p dir="auto">交个参赛作业，顺便还修了个BUG</p>
<p dir="auto">之前搞的Kuzuryusen项目，可以在MiniMax H3工作流中可以无痛提升18.8％。</p>
<p dir="auto">项目链接：<a href="https://lcz.me/topic/2857">https://lcz.me/topic/2857</a></p>
<p dir="auto">当时少考虑了项目的复杂性，少考虑了Lora加载的情况导致报错：<br />
<img src="https://upload.lcz.me/uploads/6c26edce-665b-45ce-a534-fae6d8006725.jpeg" alt="image.jpeg" class="img-markdown  img-fluid" /></p>
<p dir="auto">所以就修了这个BUG，并在Repo中更新。<br />
跑了三版（2D，单卡、2D，TP＝2、3D，TP＝2），也是顺便验证项目的有效性。</p>
<p dir="auto">先交作业<br />
H3 FINAL 3D：<br />
<a href="https://youtu.be/IpkkcJagdVM" rel="nofollow ugc">https://youtu.be/IpkkcJagdVM</a><br />
H3 FINAL 2D TP2：<br />
<a href="https://youtu.be/HsgJ8mvc2bQ" rel="nofollow ugc">https://youtu.be/HsgJ8mvc2bQ</a><br />
H3 FINAL 3D TP2<br />
<a href="https://youtu.be/uS11v5KtLuE" rel="nofollow ugc"><i class="fa fa-youtube" aria-hidden="true"></i> Youtube Video</a></p><div class="js-lazyYT lazyYT-container" data-youtube-id="uS11v5KtLuE" data-width="640" data-height="360" data-parameters style="width:640px;padding-bottom:360px">
 <div class="ytp-thumbnail lazyYT-image-loaded" style="background-image:url(&quot;https://i.ytimg.com/vi/uS11v5KtLuE/hqdefault.jpg&quot;)">
  <button class="ytp-large-play-button ytp-button" tabindex="23" aria-live="assertive" style="transform:scale(0.85)" onclick="$(this).lazyYT(this);return false;">
   <svg height="100%" version="1.1" viewbox="0 0 68 48" width="100%">
    <path class="ytp-large-play-button-bg" d="m .66,37.62 c 0,0 .66,4.70 2.70,6.77 2.58,2.71 5.98,2.63 7.49,2.91 5.43,.52 23.10,.68 23.12,.68 .00,-1.3e-5 14.29,-0.02 23.81,-0.71 1.32,-0.15 4.22,-0.17 6.81,-2.89 2.03,-2.07 2.70,-6.77 2.70,-6.77 0,0 .67,-5.52 .67,-11.04 l 0,-5.17 c 0,-5.52 -0.67,-11.04 -0.67,-11.04 0,0 -0.66,-4.70 -2.70,-6.77 C 62.03,.86 59.13,.84 57.80,.69 48.28,0 34.00,0 34.00,0 33.97,0 19.69,0 10.18,.69 8.85,.84 5.95,.86 3.36,3.58 1.32,5.65 .66,10.35 .66,10.35 c 0,0 -0.55,4.50 -0.66,9.45 l 0,8.36 c .10,4.94 .66,9.45 .66,9.45 z" fill="#1f1f1e" fill-opacity="0.9">
    </path>
    <path d="m 26.96,13.67 18.37,9.62 -18.37,9.55 -0.00,-19.17 z" fill="#fff">
    </path>
    <path d="M 45.02,23.46 45.32,23.28 26.96,13.67 43.32,24.34 45.02,23.46 z" fill="#ccc">
    </path>
   </svg>
  </button>
 </div>
</div><p></p>
<h1>H3 打斗片 · 复现手册</h1>
<blockquote>
<p dir="auto">目标：在同类机器上，凭本文件 + <code>workflow/*.json</code> + <code>comfyui-tp2</code> 补丁 + 3 个核心文件补丁，复现出 <code>H3_FINAL_3D</code> / <code>H3_FINAL_3D_TP2</code> / <code>H3_FINAL_2D_TP2</code> 三条 1344×768、12.25 s 带音轨的片子。<br />
所有版本、md5、参数、耗时均为本机实测或日志原文；推算值已标注"推算"。<br />
任务来源：<code>https://lcz.me/topic/3045</code></p>
</blockquote>
<hr />
<h2>1. 交付物</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>产物</th>
<th>路径</th>
<th>大小</th>
<th>规格</th>
<th>生成模式</th>
<th>总耗时</th>
</tr>
</thead>
<tbody>
<tr>
<td>3D 单卡</td>
<td><code>h3_output/H3_FINAL_3D.mp4</code></td>
<td>14.2 MB</td>
<td>1344×768 / 294f / 12.25s / H.264+AAC 24fps</td>
<td>单卡 8188</td>
<td>31:28</td>
</tr>
<tr>
<td>3D TP=2</td>
<td><code>h3_output/H3_FINAL_3D_TP2.mp4</code></td>
<td>15.1 MB</td>
<td>同上</td>
<td>双卡 8191/8192</td>
<td>26:00</td>
</tr>
<tr>
<td>2D TP=2</td>
<td><code>h3_output/H3_FINAL_2D_TP2.mp4</code></td>
<td>17.5 MB</td>
<td>同上</td>
<td>双卡 8191/8192</td>
<td>25:43</td>
</tr>
</tbody>
</table>
<hr />
<h2>2. 硬件</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>CPU</td>
<td>Intel Xeon E5-2696 v4 @ 2.20 GHz（22 逻辑核）</td>
</tr>
<tr>
<td>内存</td>
<td>131,782,056 kB ≈ 125.7 GiB（跑双卡时必须留 ≥ 60 GiB 空闲：两个 rank 各加载 27 GB 文本编码器）</td>
</tr>
<tr>
<td>GPU</td>
<td>2 × AMD Radeon RX 7900 XTX，24 GB，gfx1100</td>
</tr>
<tr>
<td>GPU 链路</td>
<td>sysfs 报告 16.0 GT/s ×16（两卡经同一 PCIe switch）；<strong>实测 P2P 拷贝 5.14 GB/s</strong></td>
</tr>
<tr>
<td>ROCm</td>
<td>7.2（hip 7.2.53211）</td>
</tr>
<tr>
<td>存储</td>
<td>权重在 <code>/mnt/ai/models/ComfyUI</code>（345 GB），安装目录在 <code>/mnt/ai/ComfyUI-AMD</code></td>
</tr>
</tbody>
</table>
<hr />
<h2>3. 软件栈</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>用途</th>
<th>安装目录</th>
<th>代码版本</th>
<th>解释器</th>
<th>torch</th>
</tr>
</thead>
<tbody>
<tr>
<td>单卡 / TP=2 出片（8188、8191/8192）</td>
<td><code>/home/jay/ComfyUI-AMD/ComfyUI</code>（= <code>/mnt/ai/ComfyUI-AMD/ComfyUI</code>）</td>
<td>Revision 6237 <code>423cbd20</code>（ComfyUI 0.43.2，2026-10-30）</td>
<td><code>/home/jay/ComfyUI-AMD/venv</code>（Python 3.12.3）</td>
<td><strong>2.14.1+rocm7.2</strong></td>
</tr>
<tr>
<td>备用 / 对照（本次未参与交付片）</td>
<td><code>/home/jay/ComfyUI</code></td>
<td>commit <code>426f5ee</code></td>
<td><code>/home/jay/sglang-venv</code></td>
<td>2.13.0+rocm7.2</td>
</tr>
</tbody>
</table>
<p dir="auto">三条交付片全部出自 <strong>ComfyUI-AMD 这一份安装 + 2.14.1+rocm7.2</strong>；TP=2 只是换了启动参数（<code>--use-ck-attention --mmap-torch-files</code>、两个进程、两个端口），解释器与依赖与单卡完全相同。</p>
<p dir="auto">启动命令（脚本已封装）：</p>
<pre><code class="language-bash"># 单卡：workflow/run_single.sh
cd /home/jay/ComfyUI-AMD/ComfyUI &amp;&amp; ../venv/bin/python main.py --disable-xformers --port 8188

# 双卡（交付片实际用法，必须显式覆盖 COMFY/PY，脚本默认指向 /home/jay/ComfyUI）：
COMFY=/home/jay/ComfyUI-AMD/ComfyUI \
PY=/home/jay/ComfyUI-AMD/venv/bin/python \
MIN_FREE_MIB=16384 bash /home/jay/tp2/run_tp.sh 2 8191 h3fix
#   run_tp.sh 内部再加：--use-ck-attention --mmap-torch-files --listen 127.0.0.1 --port 8191/8192
#                       MASTER_ADDR=127.0.0.1  MASTER_PORT=base_port+300
</code></pre>
<p dir="auto"><code>--use-ck-attention --mmap-torch-files</code> 是 TP 的默认 <code>EXTRA_ARGS</code>；<code>--mmap-torch-files</code> 让权重按需 mmap，实测采样前准备 91.7 → 58.0 s。</p>
<hr />
<h2>4. 插件（custom_nodes）</h2>
<p dir="auto">图里真正用到的只有三处来源：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>提供方</th>
<th>提供的东西</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>ComfyUI 核心 <code>comfy_extras/nodes_minimax_h3.py</code></td>
<td><code>MiniMaxH3ReferenceToVideo</code>、<code>MiniMaxH3SigmaShift</code>、<code>MiniMaxH3LatentAV</code>、<code>EmptyMiniMaxH3LatentAV</code>、<code>LTXVSeparateAVLatent</code> 等 8 个 H3 节点</td>
<td>必须是有 H3 支持的 ComfyUI 版本（本机 <code>423cbd20</code>）</td>
</tr>
<tr>
<td><code>custom_nodes/comfyui-tp2</code></td>
<td>TP 切分、LoRA runtime patch、<code>TP2VAEDecodeSplit</code></td>
<td><strong>本项目的核心补丁，见 §5</strong></td>
</tr>
<tr>
<td><code>custom_nodes/ComfyUI-KJNodes</code></td>
<td><code>ImageResizeKJv2</code>（参考图 1536 长边、<code>divisible_by=32</code>）</td>
<td>也可用核心 <code>ImageScale</code> 替代</td>
</tr>
</tbody>
</table>
<p dir="auto">同装但本次未参与计算（出片、分析可选用）：<code>ComfyUI-VideoHelperSuite</code>、<code>rgthree-comfy</code>、<code>rocm-sdpa-fix</code>、<code>ComfyUI_MiniMaxH3_Director</code>、<code>ComfyUI-YCNodes-MiniMax-H3</code>、<code>ComfyUI-H3-LongVideo</code>、<code>Comfyui_Minimax_h3_latent_Upscaler</code>、<code>ComfyUI-Spectrum-MiniMax-H3</code>、<code>ComfyUI_Qwen_H3_Prompt</code>、<code>ComfyUI-Prompt-Assistant</code>、<code>comfyui-portrait-master-zh-cn</code>、<code>audio-separation-nodes-comfyui</code>、<code>seedvr2_videoupscaler</code>、<code>selflift-Avatar</code>、<code>ComfyUI-Manager</code>。</p>
<hr />
<h2>5. 补丁</h2>
<p dir="auto">交付片依赖两层补丁，<strong>必须同时存在</strong>。核心 ComfyUI 不是原版，<code>git status</code> 里有 3 个改动文件（另有若干 <code>models/*/put_*_here</code>、<code>input/example.png</code> 的删除，是安装时清示例，与出片无关）。</p>
<h3>5.0 指纹与回滚</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>文件</th>
<th>行数</th>
<th>md5</th>
<th>作用</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>custom_nodes/comfyui-tp2/__init__.py</code></td>
<td>838</td>
<td><code>14fd4c4edef91b68ddc15a264b5051c2</code></td>
<td>TP=2 全部切分 / 通信 / LoRA runtime patch</td>
</tr>
<tr>
<td><code>comfy/sd.py</code></td>
<td>—</td>
<td><code>a9f96a489358ca59210b6c38587f26d6</code></td>
<td>VAE encode 三维输入按 1e6 元素分段 + 失败原因写日志</td>
</tr>
<tr>
<td><code>comfy_extras/nodes_audio.py</code></td>
<td>—</td>
<td><code>6f1691eb8913de31899baae6447f4a33</code></td>
<td>音频 VAE 分块编码，OOM 时整段退 CPU 再拼回</td>
</tr>
<tr>
<td><code>comfy_api/latest/_input_impl/video_types.py</code></td>
<td>—</td>
<td><code>e1a9d9f0d13756fdc045ed28ad9618c1</code></td>
<td>音轨 mux 抛 <code>av.error.ArgumentError</code> 时降级为无声成片，不丢整条</td>
</tr>
</tbody>
</table>
<p dir="auto">回滚：</p>
<pre><code class="language-bash"># TP 补丁回到 377 行（补丁前）版本
cp /home/jay/tp2/backups/comfyui-tp2.bak-377line-11071942/__init__.py \
   /home/jay/ComfyUI-AMD/ComfyUI/custom_nodes/comfyui-tp2/__init__.py   # md5 da086f0b39585fd4520b970e1c46a5a7
# 核心三个文件
cd /home/jay/ComfyUI-AMD/ComfyUI &amp;&amp; git checkout -- comfy/sd.py comfy_extras/nodes_audio.py comfy_api/latest/_input_impl/video_types.py
</code></pre>
<p dir="auto"><code>/home/jay/ComfyUI</code>（426f5ee）里另有一份 832 行版 tp2（md5 <code>4d206ff98746d4cb67dfd254d2400d63</code>），<strong>不是</strong>交付片用的版本，不要混。</p>
<h3>5.1 它做了什么</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>能力</th>
<th>实现要点</th>
</tr>
</thead>
<tbody>
<tr>
<td>行/列并行</td>
<td>qkv、fc1 列并行；out_proj、fc2 行并行；attention 按 head 切（56 → 28/rank）</td>
</tr>
<tr>
<td>LoRA runtime patch</td>
<td>不再把 LoRA 合并进 int8 convrot 权重，而是各 rank split 成 patch；启动日志 <code>[tp2] rank0 lora split keys=208/416</code>、<code>208 patches attached</code>。<strong>这是解决</strong> <strong><code>adaln_proj.linear.weight shape '[96768, 8]'</code></strong> <strong>的那一步</strong></td>
</tr>
<tr>
<td>MLP 分块重叠（A 轨）</td>
<td><code>COMFY_TP_MLP_CHUNKS=8</code>，第 i 块 allreduce 与第 i+1 块 GEMM 在两条 stream 重叠</td>
</tr>
<tr>
<td>全归约 dtype</td>
<td><code>COMFY_TP_AR_MODE=bf16</code>（默认）；<code>int8</code> 可再省 8%，但 4 步 latent 均值偏差 5%、PSNR 24.5 dB，画质未验收，<strong>不要开</strong></td>
</tr>
<tr>
<td>出片跨卡解码</td>
<td><code>COMFY_TP_VAE_SPLIT=1</code> 时把 <code>VAEDecode</code> 换成 <code>TP2VAEDecodeSplit</code>，两卡按 VAE 时间块各解一半（8 步 832×480×124 实测 post 34.2 → 27.1 s，与单卡逐位一致）。<strong>本次没开</strong></td>
</tr>
<tr>
<td>P2P 拓扑修正</td>
<td><code>p2p_patch.py --print</code> 生成 <code>/home/jay/tp2/p2p_topology.xml</code>，让 RCCL 走 P2P/IPC 而不是回退 SHM。注意：该拓扑是<strong>手工构造</strong>（把两卡写成同一 switch 下 16 GT/s ×16），目的是让 RCCL 不降级，真实带宽以 §9 实测 5.14 GB/s 为准</td>
</tr>
<tr>
<td>显存仲裁</td>
<td><code>run_tp.sh</code> 调 <code>gpu-mode.sh acquire</code>（挂起 Strata），启动后把 holder 钉到真实 <code>main.py</code> pid，否则 60 s 后 watchdog 会 release 并把出片挤掉</td>
</tr>
</tbody>
</table>
<h3>5.2 环境变量</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>变量</th>
<th>本次值</th>
<th>作用</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>COMFY_TP_WORLD</code> / <code>COMFY_TP_RANK</code></td>
<td>2 / 0,1</td>
<td>由 launcher 注入</td>
</tr>
<tr>
<td><code>COMFY_TP_MLP_CHUNKS</code></td>
<td><strong>8</strong></td>
<td>MLP 分块重叠</td>
</tr>
<tr>
<td><code>COMFY_TP_AR_MODE</code></td>
<td><strong>bf16</strong></td>
<td>全归约精度（int8 画质未过）</td>
</tr>
<tr>
<td><code>COMFY_TP_VAE_SPLIT</code></td>
<td><strong>0</strong></td>
<td>出片跨卡解码（实测可再省 18~23 s）</td>
</tr>
<tr>
<td><code>COMFY_TP_P2P</code></td>
<td><strong>1</strong></td>
<td>启用拓扑修正</td>
</tr>
<tr>
<td><code>COMFY_TP_P2P_WARMUP</code></td>
<td>1</td>
<td>启动时预热 P2P</td>
</tr>
<tr>
<td><code>COMFY_TP_AR_SKIP</code> / <code>COMFY_TP_ROW_BF16</code> / <code>COMFY_TP_DUP</code></td>
<td>未设</td>
<td>调试开关</td>
</tr>
<tr>
<td><code>H3_AUDIO_ENCODE_CHUNK</code></td>
<td><strong>5</strong>（默认）</td>
<td>音频 VAE 编码分段秒数（<code>nodes_audio.py</code> 补丁读它；长音轨单次编码会打爆 24 GB）</td>
</tr>
<tr>
<td><code>MIN_FREE_MIB</code></td>
<td><strong>16384</strong></td>
<td>acquire 时要求的最小空闲显存</td>
</tr>
</tbody>
</table>
<hr />
<h2>6. 模型文件</h2>
<p dir="auto"><code>/mnt/ai/models/ComfyUI</code>（<code>~/ComfyUI/models</code> 下为软链）：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>角色</th>
<th>文件</th>
<th>大小</th>
<th>备注</th>
</tr>
</thead>
<tbody>
<tr>
<td>UNET（本次用）</td>
<td><code>diffusion_models/MiniMax/minimax_h3_ref2va_pruned_int8_convrot.safetensors</code></td>
<td>20.97 GB</td>
<td>pruned 基座</td>
</tr>
<tr>
<td>UNET（动作 LoRA 只能配这个）</td>
<td><code>diffusion_models/MiniMax/minimax_h3_hybrid_fl2va_ref2va_b20-49-int8.safetensors</code></td>
<td>20.97 GB</td>
<td>hybrid 基座</td>
</tr>
<tr>
<td>Turbo LoRA</td>
<td><code>loras/minimax_h3_turbo_v4_step600_ema_pruned_comfyui.safetensors</code></td>
<td>0.62 GB</td>
<td><strong>必须配 pruned</strong>；hybrid 配 <code>turbo_v4_step600_comfyui_T8-convert</code> 或 Combat</td>
</tr>
<tr>
<td>文本编码器</td>
<td><code>text_encoders/qwen3vl_32b_minimax_h3_int8_convrot.safetensors</code></td>
<td>27.14 GB</td>
<td>24 GB 卡放不下 → <code>device=cpu</code></td>
</tr>
<tr>
<td>视频 VAE</td>
<td><code>vae/minimax_h3_video_vae_fp16.safetensors</code></td>
<td>5.21 GB</td>
<td>TP 端文件名首字母大写 <code>Minimax_h3_video_vae_fp16</code></td>
</tr>
<tr>
<td>音频 VAE</td>
<td><code>vae/minimax_h3_audio_vae_fp32.safetensors</code></td>
<td>0.61 GB</td>
<td>&lt;br /&gt;</td>
</tr>
</tbody>
</table>
<p dir="auto">配对铁律：<code>pruned</code> 只配 <code>*_ema_pruned*</code>；<code>hybrid</code> 只配 <code>T8-convert</code> / <code>Combat</code> / <code>VBVR</code> / <code>FrameRush</code>。混用必报 <code>adaln_proj</code> 维度错。</p>
<hr />
<h2>7. 出片参数</h2>
<h3>7.1 公共</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>参数</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>分辨率 / 帧数 / fps</td>
<td>1344×768 / 294（=17×17+5，H3 的合法帧数网格）/ 24</td>
</tr>
<tr>
<td>steps / scheduler / sampler</td>
<td>6 / <code>beta</code> / <code>euler_ancestral</code></td>
</tr>
<tr>
<td>sigma shift</td>
<td>video 12.0 → audio 3.0（<code>MiniMaxH3SigmaShift</code>）</td>
</tr>
<tr>
<td>seed / 噪声</td>
<td>20261114（<code>RandomNoise</code>）</td>
</tr>
<tr>
<td>LoRA 强度</td>
<td>1.0</td>
</tr>
<tr>
<td>参考图预处理</td>
<td><code>ImageResizeKJv2</code>：1536×1536、<code>nearest-exact</code>、<code>resize</code>、<code>divisible_by=32</code>、<code>device=cpu</code></td>
</tr>
<tr>
<td>解码</td>
<td><code>VAEDecodeTiled</code> tile 512 / overlap 64 / temporal 64-8 + <code>VAEDecodeAudio</code></td>
</tr>
<tr>
<td>封装</td>
<td><code>CreateVideo(fps=24, bit_depth=8)</code> → <code>SaveVideo(mp4, h264)</code></td>
</tr>
<tr>
<td>提示词骨架</td>
<td><code>(Style: …)</code> + <code>subject_definitions</code>（三张参考图逐个点名）+ <code>Subject/Action/Environment</code></td>
</tr>
</tbody>
</table>
<h3>7.2 三版差异</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>项</th>
<th>3D 单卡</th>
<th>3D TP=2</th>
<th>2D TP=2</th>
</tr>
</thead>
<tbody>
<tr>
<td>JSON</td>
<td><code>workflow/s3d.json</code></td>
<td><code>workflow/s3d_tp2.json</code></td>
<td><code>workflow/s2d_tp2.json</code></td>
</tr>
<tr>
<td>风格行</td>
<td><code>(Style: 3D CGI animation)</code></td>
<td>同左</td>
<td><code>(Style: 2D traditional anime)</code></td>
</tr>
<tr>
<td>参考图</td>
<td><code>jx_3d.jpg</code> / <code>zzx_fire.jpg</code> / <code>zzx_blue.jpg</code></td>
<td>同左</td>
<td><code>jx_2d_front.jpg</code> / <code>jx_2d_side.jpg</code> / <code>zzx_purple.jpg</code></td>
</tr>
<tr>
<td>attention</td>
<td><code>ModelAttentionBackend = comfy kitchen attention</code></td>
<td>服务端 <code>--use-ck-attention</code>，图上不挂该节点</td>
<td>同 TP</td>
</tr>
<tr>
<td>端口</td>
<td>8188</td>
<td>8191 + 8192（两端口同时提交）</td>
<td>同 TP</td>
</tr>
<tr>
<td>启动</td>
<td><code>workflow/run_single.sh</code></td>
<td><code>MIN_FREE_MIB=16384 bash run_tp.sh 2 8191 h3fix</code></td>
<td>同 TP</td>
</tr>
</tbody>
</table>
<hr />
<h2>8. 脚本与 JSON</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>文件</th>
<th>作用</th>
<th>用法</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>workflow/build_prompt.py</code></td>
<td>读参数 JSON → 组 API 图（<code>build()</code> 返回 <code>(graph, frames)</code>）→ 多端口同时 POST <code>/prompt</code> → 轮询 <code>/history</code></td>
<td><code>python3 build_prompt.py --params s3d_tp2.json</code></td>
</tr>
<tr>
<td><code>workflow/run_single.sh</code></td>
<td>单卡：acquire → <code>exec</code> ComfyUI（PID 与锁同生共死）</td>
<td>直接跑</td>
</tr>
<tr>
<td><code>/home/jay/tp2/run_tp.sh</code></td>
<td>双卡 launcher：acquire、注入 TP 环境变量、生成 <code>NCCL_TOPO_FILE</code>、起两 rank、钉 holder</td>
<td><code>bash run_tp.sh 2 8191 &lt;tag&gt;</code></td>
</tr>
<tr>
<td><code>/home/jay/tp2/p2p_patch.py</code></td>
<td>生成 P2P 拓扑 xml</td>
<td><code>--print</code> 输出路径</td>
</tr>
<tr>
<td><code>workflow/make_ui_workflow.py</code></td>
<td>从 <code>/history</code> 的 API prompt 还原前端 UI workflow（节点坐标/连线/素材）</td>
<td><code>python3 make_ui_workflow.py H3_TP_3D &lt;out.json&gt;</code></td>
</tr>
<tr>
<td><code>workflow/capture_ui.py</code></td>
<td>headless Chrome + CDP 截 ComfyUI 画布</td>
<td><code>python3 capture_ui.py out.png 2600 1520 &lt;wf.json&gt;</code></td>
</tr>
<tr>
<td><code>workflow/make_assets.py</code></td>
<td>成片抽帧 + 日志截图</td>
<td>直接跑</td>
</tr>
<tr>
<td><code>workflow/bench_encode.py</code></td>
<td>编码单测（256×256×22f、1 步，跑两次取第二次）</td>
<td>需 TP 服务在跑</td>
</tr>
<tr>
<td><code>workflow/bench_decode.py</code></td>
<td>解码单测（<code>EmptyMiniMaxH3LatentAV</code> 1344×768×294 → 解码 → 封装）</td>
<td>需 TP 服务在跑</td>
</tr>
</tbody>
</table>
<p dir="auto">3D工作流<br />
<img src="https://upload.lcz.me/uploads/bc278ae6-9851-4862-8f14-1e848f9959b1.jpeg" alt="image.jpeg" class="img-markdown  img-fluid" /></p>
<p dir="auto">2D工作流<br />
<img src="https://upload.lcz.me/uploads/039d1e76-b65b-477f-a8b3-379a7f5d47c5.jpeg" alt="image.jpeg" class="img-markdown  img-fluid" /></p>
<p dir="auto">参数 JSON：</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>文件</th>
<th>用途</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>s3d.json</code></td>
<td>3D 单卡正式</td>
</tr>
<tr>
<td><code>s3d_tp2.json</code></td>
<td>3D TP=2 正式 <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=3c59dda5525" class="not-responsive emoji emoji-android emoji--white_check_mark" style="height:1.4em;width:auto;vertical-align:middle" title="✅" alt="✅" /></td>
</tr>
<tr>
<td><code>s2d_tp2.json</code></td>
<td>2D TP=2 正式 <img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=3c59dda5525" class="not-responsive emoji emoji-android emoji--white_check_mark" style="height:1.4em;width:auto;vertical-align:middle" title="✅" alt="✅" /></td>
</tr>
<tr>
<td><code>s2d.json</code></td>
<td>2D 单卡（未跑，留档）</td>
</tr>
<tr>
<td><code>chk.json</code> / <code>s2d_tp.json</code></td>
<td>832×480×56 探针（4 步，验证补丁是否出画面）</td>
</tr>
</tbody>
</table>
<p dir="auto">前端工作流（可直接 File → Open）：<code>/home/jay/ComfyUI/user/default/workflows/h3_3d_tp2.json</code>、<code>h3_2d_tp2.json</code>。</p>
<hr />
<h2>9. 实测指标</h2>
<h3>9.1 阶段耗时（1344×768×294）</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>阶段</th>
<th>单卡</th>
<th>TP=2</th>
<th>测量方式</th>
</tr>
</thead>
<tbody>
<tr>
<td>采样 6 步</td>
<td>1300 s（216.6 s/it）</td>
<td>739 s（123.1 s/it）</td>
<td>进度条 <code>6/6</code> 累计</td>
</tr>
<tr>
<td>文本编码</td>
<td>≈170 s（推算）</td>
<td><strong>≈215 s</strong></td>
<td>模型驻留后重跑编码 222.3 s，扣 1 步 + 22 帧解码</td>
</tr>
<tr>
<td>解码+音轨+封装</td>
<td>≈116 s（推算）</td>
<td><strong>116.0 s</strong></td>
<td><code>bench_decode.py</code> 实测 116.04 s</td>
</tr>
<tr>
<td>加载/初始化</td>
<td>≈472 s（推算）</td>
<td>≈473 s</td>
<td>总耗时 − 上三项</td>
</tr>
<tr>
<td>合计</td>
<td>1888 s</td>
<td>1543 s</td>
<td><code>Prompt executed</code></td>
</tr>
</tbody>
</table>
<h3>9.2 并行效率</h3>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>指标</th>
<th>值</th>
</tr>
</thead>
<tbody>
<tr>
<td>P2P 拷贝带宽</td>
<td><strong>5.14 GB/s</strong>（256 MB × 20 次）</td>
</tr>
<tr>
<td>每步理想 / 实际</td>
<td>108.3 s / 123.1 s → <strong>并行效率 87.9%</strong></td>
</tr>
<tr>
<td>每步通信开销</td>
<td><strong>14.8 s（12%）</strong></td>
</tr>
<tr>
<td>采样加速 / 端到端加速</td>
<td><strong>1.76× / 1.21×</strong></td>
</tr>
<tr>
<td>Amdahl 上限</td>
<td>1.45×（采样占单卡 68.9%）</td>
</tr>
</tbody>
</table>
<h3>9.3 探针（改补丁后必跑）</h3>
<p dir="auto">832×480×56、4 步：<strong>406 s，5.37 s/it</strong>，抽帧人眼确认非噪声。</p>
<hr />
<h2>10. 复现步骤</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>步</th>
<th>动作</th>
<th>验收</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>装 ROCm 7.2 + ComfyUI <code>423cbd20</code>（含 H3 节点）+ <code>comfyui-tp2</code> 838 行版 + <code>ComfyUI-KJNodes</code>，并按 §5.0 打上 3 个核心补丁、按 §6 放模型</td>
<td><code>md5sum</code> 四行与 §5.0 一致；<code>/object_info</code> 能查到 <code>MiniMaxH3ReferenceToVideo</code></td>
</tr>
<tr>
<td>1</td>
<td>停 Strata / 腾内存（≥ 60 GiB 空闲）</td>
<td><code>gpu-mode.sh status</code> 显示工作态</td>
</tr>
<tr>
<td>2</td>
<td>起服务：单卡 <code>run_single.sh</code>；双卡 <code>COMFY=/home/jay/ComfyUI-AMD/ComfyUI PY=/home/jay/ComfyUI-AMD/venv/bin/python MIN_FREE_MIB=16384 bash /home/jay/tp2/run_tp.sh 2 8191 h3fix</code></td>
<td>日志出现 <code>ComfyUI Path: /home/jay/ComfyUI-AMD/ComfyUI</code>；双卡还要有 <code>[tp2] rank0 lora split keys=208/416</code> 与 <code>208 patches attached</code></td>
</tr>
<tr>
<td>3</td>
<td>探针：<code>chk.json</code>（832×480×56、4 步）</td>
<td>抽帧正常；GPU 双卡 100%</td>
</tr>
<tr>
<td>4</td>
<td>正式：<code>build_prompt.py --params s3d_tp2.json</code> 或 <code>s2d_tp2.json</code></td>
<td>采样 123 s/it 左右（单卡 216 s/it），无 CPU 退化</td>
</tr>
<tr>
<td>5</td>
<td>落盘兜底：<code>LTXVSeparateAVLatent</code> → <code>SaveLatent</code>×2 → 解码 → <code>SaveVideo</code></td>
<td>latent 存在即可重解，不必重跑采样</td>
</tr>
<tr>
<td>6</td>
<td>验收：<code>ffprobe</code> 核对 1344×768/294f/12.25s/有音轨；<code>make_assets.py</code> 抽帧</td>
<td>三条规格一致</td>
</tr>
<tr>
<td>7</td>
<td>归档：<code>make_ui_workflow.py</code> + <code>capture_ui.py</code> 出真机截图</td>
<td><code>assets/comfyui_workflow_*.png</code></td>
</tr>
</tbody>
</table>
<hr />
<h2>11. 陷阱</h2>
<ol>
<li><strong>LoRA 与基座必须配对</strong>，否则 <code>adaln_proj.linear.weight shape '[96768, 8]'</code>。</li>
<li><strong>TP 下</strong> <strong><code>save_latents</code></strong> <strong>不要直接喂</strong> <strong><code>SaveLatent</code></strong>：AV 合流是 NestedTensor，先 <code>LTXVSeparateAVLatent</code>。</li>
<li><strong>双卡内存按 2 倍算</strong>：每个 rank 一份 27 GB TE，两个 rank 都从 CPU 读。</li>
<li><strong>去掉 LoRA 若出现 GPU 0% / CPU 400%</strong>，是 fallback 到 CPU，不是慢。</li>
<li><strong>单步突然变快要警惕</strong>：87.6 s/it 那版是 head 双重切分未修的坏实现，输出全噪声。</li>
<li><strong><code>gpu-mode.sh acquire</code></strong> <strong>的 holder 必须是真</strong> <strong><code>main.py</code></strong> <strong>的 pid</strong>，否则 60 s 后被 watchdog release，出片被 Strata 挤掉。</li>
<li><strong>TP2 与单卡同 seed 画面不等价</strong>（归约顺序不同），交付必须同模式同 seed 出生，不能拼。</li>
<li><strong><code>COMFY_TP_AR_MODE=int8</code></strong> <strong>画质未验收</strong>，别用在交付片。</li>
</ol>
]]></description><link>https://lcz.me/topic/3072</link><generator>RSS for Node</generator><lastBuildDate>Thu, 19 Nov 2026 00:44:33 GMT</lastBuildDate><atom:link href="https://lcz.me/topic/3072.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 14 Nov 2026 15:41:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 【H3剑心比赛】2×7900XTX | TP=2 | P2P open | MiniMax H3主流生成2D、3D影像 on Sat, 14 Nov 2026 16:43:57 GMT]]></title><description><![CDATA[<p dir="auto">通过初审，正式参赛，20分奖励将在活动结束之后结算。</p>
]]></description><link>https://lcz.me/post/33339</link><guid isPermaLink="true">https://lcz.me/post/33339</guid><dc:creator><![CDATA[terry]]></dc:creator><pubDate>Sat, 14 Nov 2026 16:43:57 GMT</pubDate></item><item><title><![CDATA[Reply to 【H3剑心比赛】2×7900XTX | TP=2 | P2P open | MiniMax H3主流生成2D、3D影像 on Sat, 14 Nov 2026 16:43:24 GMT]]></title><description><![CDATA[<p dir="auto"><img src="https://lcz.me/assets/plugins/nodebb-plugin-emoji/emoji/android/2705.png?v=3c59dda5525" 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 分 · 编号 e3072-3256-1</p>
</blockquote>
]]></description><link>https://lcz.me/post/33338</link><guid isPermaLink="true">https://lcz.me/post/33338</guid><dc:creator><![CDATA[Xiaote]]></dc:creator><pubDate>Sat, 14 Nov 2026 16:43:24 GMT</pubDate></item></channel></rss>