docs(h20): the FlagTree image runs the model end to end, token for token

Eight ranks, `--ep 8 --max_tokens 32`, both prompts, on the FlagTree image: exit 0, every
prompt's token-id sequence identical across all eight ranks, decoded text correct. The same
run on the reference image produces byte-identical token ids, so the port is not merely
"some output comes out" on the vendor image -- it agrees with the image we have been
validating against all along.

The fallbacks are the known P1/P2 leftovers and are identical on both images: MTP's four
kernels, the sampler's rejection-sampling variant, and the 20 optional-path kernels. One
benign difference is recorded too -- torch 2.11 has no `ProcessGroupNCCL.memory_stats`, so
a stats line reports itself unavailable.

Also writes down the dependency work an end-to-end run needs but the A/B harness does not:
tilelang 0.1.15 with tile_kernels 2.1.0 and tvm_ffi 0.1.11, plus the 19 packages from
requirements.txt. pip stalls on this host, so the practical route is copying site-packages
out of the reference image; pillow is the exception and must come from the image, because
11.3 sits beside a pillow.libs the image does not have.
This commit is contained in:
loopyt 2026-10-22 12:29:47 +08:00
parent 9f95599767
commit 28015cba81

55
TODO.md
View File

@ -404,8 +404,54 @@ gather kernel: exact
全量 A/B --compare di-h20(3.7.1) 的 dump: AB_OK —— 逐元素一致
```
**所以「vendor 镜像里跑 Triton 版」这条路已经通了。** 唯一没做的是 8 卡端到端,因为
GPU 0/6/7 被同事的 ernie 容器占着(每卡 130~138 GiB)。
**所以「vendor 镜像里跑 Triton 版」这条路已经通了。**
### 4.4c 8 卡端到端:跑通了,且与参考镜像逐 token 相同 ✅(2026-10-22 12:25)
在 flagtree 镜像里 `--ep 8 --max_tokens 32`,两个 prompt:
```
=== continuation: '。\n问题:法国的首都是哪里?\n答案:巴黎。\n问题:请介绍一下中国的首都。\n
答案:北京是中国的首都,是中国的政治、文化和国际'
=== continuation: '北京。\n问题:中国的首都是哪里?\n答案:北京。\n问题:中国的首都是哪里?\n
答案:北京。\n问题:中国的首都是哪里?\n答案'
```
| 检查项 | flagtree 镜像 | di-h20 参考镜像 |
|---|---|---|
| exit code | 0 | 0 |
| 每个 prompt 的 token 序列出现次数 | **8**(8 rank 全一致) | **8** |
| distinct token 序列 | 2(= 2 个 prompt) | 2 |
| token ids 逐位对比 | **完全一致**(`diff` 无输出) | 基线 |
回退情况与 di-h20 完全相同,符合已知的 P1/P2 遗留:
```
[ops] backend 'triton' lacks 20 kernel(s), falling back to 'cuda' (first: apply_token_bitmask_by_step_inplace_tl)
[ops] kernel 'remap_draft_topk_tl' used from 'cuda' ← MTP
[ops] kernel 'get_accept_result_tl' used from 'cuda' ← MTP
[ops] kernel 'finalize_verification_tl' used from 'cuda' ← MTP
[ops] kernel 'get_fused_dflash_get_input_tl' used from 'cuda' ← MTP
[ops] fused_sample: rejection sampling (MTP verify) is not implemented in the triton backend
```
良性差异(非 Triton、与 torch 版本有关):
```
stats_logger: nccl_memory stats_unavailable=AttributeError(
"'ProcessGroupNCCL' object has no attribute 'memory_stats'")
```
torch 2.11 没有 `ProcessGroupNCCL.memory_stats`(2.13 才有),只影响一行统计日志。
**跑端到端还需要的额外依赖**(A/B 单测不需要,引擎 import 链需要):
`tilelang 0.1.15` + `tile_kernels 2.1.0` + `tvm_ffi 0.1.11`(后者被前者依赖,镜像自带 0.1.9
缺 `tvm_ffi.dataclasses.Enum`),以及 `requirements.txt` 里的 19 个包。
⚠️ **这个机器上 pip 装大包会卡死**(`posix_ipc` 的 wheel 12 分钟没下来)。可行的办法是
`docker cp` 从已装好的参考镜像拷 site-packages 再挑包复制(脚本见
`/data/ftbuild/copy_deps.py`)。pillow 反而要用镜像自带的(12.2),拷 di-h20 的 11.3 会缺
`pillow.libs` 里的 `libtiff-*.so`。
### 4.5 本轮为「Triton-only 环境」修掉的东西
@ -444,6 +490,7 @@ import 路径上。修完之后 `import deepinfer` 在纯 Triton 环境不再需
- **Triton 版**:非 MTP 路径已经是纯 Triton 且 token 逐位一致,**卡在 MTP 4 个 kernel + 采样器 verify 变体 + 0 个 pytest**。
- **FlagTree / FlagOS 镜像**:**FlagTree 就是 Triton 的 fork,编 Triton kernel 从来没失败过**
(7/7 特性、19 kernel、125 用例跨 3.5.1/3.6.0/3.7.1 逐元素一致)。原先跑不起来的是
`_C` + vendor 的 C++/CUDA 扩展,**已在 flagtree 镜像里全部重编成功**(`_C` 34 符号、
deep_gemm 2.8.2、deep_ep 2.5.0、deep_select 1.0.0),只差 8 卡端到端(GPU 被同事占用)。
`_C` + vendor 的 C++/CUDA 扩展,**已在 flagtree 镜像里全部重编成功**,并且
**8 卡端到端已跑通,输出与参考镜像逐 token 相同**。剩下的回退就是 P1/P2 那几条遗留,
在两个镜像上一模一样。
- 两边共同的硬骨头只有 **C1(engram gather 不可 capture)**,其余都是收尾工作。