Skip to content

CollectiveX: trim dead code, tests and stale docs before the hand rerun / CollectiveX:在手动重跑前清理无用代码、测试与过时文档 - #4114

Merged
Oseltamivir merged 4 commits into
mainfrom
cx-trim
Oct 15, 2026
Merged

Oseltamivir merged 4 commits into
mainfrom
cx-trim

Conversation

@Oseltamivir

Copy link
Copy Markdown
Collaborator

Summary

Before the hand rerun, this removes code, tests and doc text that #4054 (hand runs) and #4100, #4101 and #4105 (clocks, timing windows, engine contracts) left dead or stale. Nothing a backend runs, measures or publishes changes.

  • Shell (−6 lines):

    • an unreachable no-SKU branch in collx_load_operator_config;
    • the unread $RUNNER argument to collx_launcher_prologue;
    • the unused PRODUCT variable;
    • comments describing the sweep workflow.
  • Python (−31 lines):

    • EagerTiming.missed_samples, which only called super();
    • EPBackend.local_rank, which nothing read;
    • the unused seed parameter of routing.decode_source_ids;
    • an unused nargs slot in runtime/stage.py's parser (parsing and errors are unchanged);
    • comments about removed row generations and the CI sweep.

    bandwidth.py's comment no longer claims graphed rows publish p50 only.

  • Tests (264 → 243 tests, −436 lines):

    • Removed tests that pin checked-in config, inspect fakes or reimplement the code under test.
    • Folded duplicates into subTest tables.
    • Deleted fake members the suite never reaches.
    • Two torch-free tests no longer skip without torch, the clamped-ladder test now actually clamps a ladder, and the bandwidth expectation is worked by hand (375 GB/s).
  • Docs (about 3,700 fewer words):

    • The README now covers usage and the coverage tables. Its evidence moved into methodology.md (new Backends, Precision and Rank Alignment sections).
    • History that only told old row generations apart is gone, since every row will be re-measured from main.
    • Stale statements are fixed against the code; the docs commit message lists them.

Review

  • Each commit was checked separately:
    • The removed shell and Python code has no remaining readers.
    • stage.py parses the four commands common.sh sends exactly as before.
    • Every removed test is a duplicate, a config pin, or folded into a table; for example, the chain-output NaN and near-zero cases are now table rows.
  • A separate reviewer compared the old and new README and methodology against the code. Its findings are fixed in the docs commit:
    • A run under an account other than the registry squash_dir's owner needs its own squash_dir or storage_roots. The README example now uses storage_roots.
    • nccl-ep's -static is explained.
    • Execution Isolation now covers the inherited-selector wipe and single_node_rdma_devices.
    • UCCL-EP's FP8 is e4m3fnuz on gfx942.
    • The MoRI SDMA citation is corrected: this repo's FP4 recipes enable it on prefill roles only.
  • Locally:
    • 243 tests pass; the 12 torch-gated ones skip without torch, and CI runs them.
    • Every command in the README runs, and cases.json regenerates byte-identical.
    • bash -n passes on every script.
    • No added line carries an IP address or a private host name.

Kept on purpose

  • The GITHUB_* and COLLX_ATTEMPT_ID reads in run_ep.py, run_swap_blocks.py and ep_harness.py. Nothing sets them on hand runs, but they feed published result fields, which are null today. Removing them would change the result schema.
  • swap_sweep.json's h100 staged_image_dir, which still points at the retired pool's storage. The launcher logs "not staged" and imports normally. Changing that entry would also move h100's swap image off v0.27.1.
  • MoRI low-latency still runs with SDMA on. After the citation fix, that rests on MoRI's and SGLang's description of AsyncLL as a copy-engine kernel, not on a decode deployment in this repo. Whether to keep it is a separate decision.
AI model disclosure
  • Claude Opus 5.5 (claude-opus-5-5, run through Claude Code): integration, review of each commit, the review fixes and this description.
  • Delegated agents, also Claude Opus 5.5 (claude-opus-5-5): the shell, Python, test and docs trim passes, and the docs reviewer.
中文

摘要

在手动重跑之前,本 PR 删除 #4054(改为手动运行)以及 #4100、#4101、#4105(时钟、计时窗口、引擎约定)之后遗留的无用或过时的代码、测试和文档。任何后端的运行、测量和发布内容均不改变。

  • Shell(−6 行):

    • collx_load_operator_config 中不可达的无 SKU 分支;
    • collx_launcher_prologue 从不读取的 $RUNNER 参数;
    • 未使用的 PRODUCT 变量;
    • 描述 sweep workflow 的注释。
  • Python(−31 行):

    • 只调用 super() 的 EagerTiming.missed_samples;
    • 无人读取的 EPBackend.local_rank;
    • routing.decode_source_ids 未使用的 seed 参数;
    • runtime/stage.py 解析器中未使用的 nargs 位(解析结果和报错不变);
    • 关于已移除的结果行世代和 CI sweep 的注释。

    bandwidth.py 的注释不再声称 graph 行只公开 p50。

  • 测试(264 → 243 个,−436 行):

    • 删除固定已提交配置、检查测试替身或重新实现被测代码的测试。
    • 将重复测试合并为 subTest 表。
    • 删除测试套件从未执行到的替身成员。
    • 两个不依赖 torch 的测试在没有 torch 时不再跳过;截断 ladder 的测试现在真正截断 ladder;带宽期望值改为手算(375 GB/s)。
  • 文档(约少 3,700 词):

    • README 改为只写用法和覆盖表,其中的证据移入 methodology.md(新增 Backends、Precision 和 Rank Alignment 小节)。
    • 每一行都会基于 main 重新测量,因此删除只用于区分旧版结果行的历史说明。
    • 按代码修正过时的说法;修正清单见文档提交的说明。

评审

  • 每个提交分别检查:
    • 删除的 shell 和 Python 代码不再有读取者。
    • stage.py 对 common.sh 发送的四个命令的解析结果与之前完全相同。
    • 每个被删除的测试要么是重复测试,要么是固定配置的测试,要么已并入表格;例如链路输出的 NaN 和接近零的用例现在是表格中的行。
  • 另一位评审者对照代码逐行比较了新旧 README 和 methodology。 其发现已在文档提交中修正:
    • 以非 registry squash_dir 所属账户运行时,需要自己的 squash_dir 或 storage_roots,README 示例改用 storage_roots。
    • 解释 nccl-ep 的 -static。
    • Execution Isolation 补充了继承选择器的清除和 single_node_rdma_devices。
    • UCCL-EP 的 FP8 在 gfx942 上为 e4m3fnuz。
    • 更正 MoRI SDMA 的引用:本仓库的 FP4 配方只在 prefill 角色上开启它。
  • 本地验证:
    • 243 个测试通过;12 个依赖 torch 的测试在没有 torch 时跳过,由 CI 运行。
    • README 中的每条命令都能运行,cases.json 重新生成后逐字节一致。
    • 每个脚本都通过 bash -n。
    • 新增的行中没有 IP 地址或私有主机名。

有意保留

  • run_ep.py、run_swap_blocks.py 和 ep_harness.py 中读取的 GITHUB_* 和 COLLX_ATTEMPT_ID。 手动运行时没有任何地方设置它们,但它们会写入公开的结果字段(目前为 null),删除会改变结果 schema。
  • swap_sweep.json 中 h100 的 staged_image_dir,它仍指向已下线资源池的存储。launcher 会记录 "not staged" 并正常导入镜像。修改该条目还会让 h100 的 swap 镜像不再是 v0.27.1。
  • MoRI 低延迟仍开启 SDMA 运行。 引用修正后,这一选择的依据是 MoRI 和 SGLang 将 AsyncLL 描述为 copy-engine 内核,而不是本仓库中的 decode 部署。是否保留是另一个决定。

Removes shell code that the CI sweep's removal (#4054) left unreachable
or unread. Nothing that runs changes: no command line, Slurm flag, env
export, retry or staging step is touched.

- collx_load_operator_config: drop the early return for a "host-utility
  step (no SKU)". Its only caller is collx_launcher_prologue, and every
  launcher exits on an unknown SKU before calling it, so COLLX_RUNNER is
  never empty there.
- Launchers: stop passing "$RUNNER" to collx_launcher_prologue, which
  never reads its arguments. The only consumer was the CI-only
  collx_prepare_stage_dir, removed in #4054.
- launch_single-slurm.sh: drop PRODUCT. Nothing reads it, here or in the
  runtime it sources, and it is not exported; with the file-wide SC2034
  disable lifted, shellcheck -x reports it as the only unused variable
  in the three launchers.
- Drop comment text that still described the sweep workflow and Actions.

Checked: bash -n on every touched script; the unit tests are unchanged
(264 run, 14 skipped); shellcheck reports no new findings; and HEAD's
and this collx_load_operator_config export the same variables for all
nine SKUs when no operator document exists.

中文:
移除 CI sweep 删除(#4054)后遗留的、不可达或无人读取的 shell 代码。
实际执行的内容均未改变:没有触及任何命令行、Slurm 参数、环境变量导出、
重试或暂存步骤。

- collx_load_operator_config:删除针对"host-utility step(无 SKU)"的
  提前返回。它唯一的调用者是 collx_launcher_prologue,而每个 launcher
  在调用它之前都会因未知 SKU 退出,因此此处 COLLX_RUNNER 永远非空。
- Launchers:不再向从不读取参数的 collx_launcher_prologue 传递
  "$RUNNER"。唯一的使用者是仅用于 CI 的 collx_prepare_stage_dir,
  已在 #4054 中删除。
- launch_single-slurm.sh:删除 PRODUCT。无论是此文件还是它 source 的
  runtime 都不读取它,它也未被导出;解除文件级 SC2034 禁用后,
  shellcheck -x 报告它是三个 launcher 中唯一未使用的变量。
- 删除仍在描述 sweep workflow 和 Actions 的注释文字。

验证:所有改动的脚本通过 bash -n;单元测试结果不变(运行 264 个,
跳过 14 个);shellcheck 没有新增告警;在不存在 operator 文档时,
HEAD 与本次修改后的 collx_load_operator_config 为全部九个 SKU
导出相同的变量。
Remove code that nothing reaches and comments that describe removed
mechanisms or old row generations. No backend runs, measures or publishes
anything differently.

Code:
- EagerTiming.missed_samples only called super(); the base method serves
  both timing regimes.
- EPBackend no longer stores local_rank, which nothing reads. The
  constructor keeps the argument.
- routing.decode_source_ids drops its unused seed parameter, and its one
  caller (ep_oracle) is updated.
- MoRIBackend.stage loses a trailing `return None`.
- runtime/stage.py: SPECS entries carried an optional nargs slot that no
  subcommand used. The slot, the conditional that read it, and a default
  that never applies to a required positional are gone. Parsing, errors
  and help output are unchanged.

Comments: drop the history of earlier kernel_generation series (nccl-ep,
uccl-ep, deepep-v2, the legacy LL suffixes, the harness alignment suffix),
references to the deleted CI sweep, the durable store and operator
secrets, pointers to the removed StageContract and DeepEP pin-drift
tests, and a duplicate of the _MODE_SLUG comment at its use site.

The ten comment-only files have identical docstring-stripped ASTs. Unit
tests: 264 run, OK, 14 skipped, before and after.

中文:
删除没有任何代码路径会执行到的代码,以及描述已移除机制或旧数据行世代的注释。
任何后端运行、测量或发布的内容均不改变。

代码:
- EagerTiming.missed_samples 只调用 super();两种计时模式都直接使用基类方法。
- EPBackend 不再保存没有任何代码读取的 local_rank。构造函数仍保留该参数。
- routing.decode_source_ids 删除未使用的 seed 参数,并同步更新其唯一调用方
  (ep_oracle)。
- 删除 MoRIBackend.stage 末尾多余的 `return None`。
- runtime/stage.py:SPECS 条目中可选的 nargs 位从未被任何子命令使用。删除该位、
  读取它的条件分支,以及对必填位置参数永远不会生效的默认值。参数解析、报错和
  帮助输出均不变。

注释:删除早期 kernel_generation 系列的历史说明(nccl-ep、uccl-ep、deepep-v2、
legacy LL 后缀以及 harness 的对齐后缀),对已删除的 CI sweep、持久化存储和
operator 密钥的引用,指向已删除的 StageContract 测试和 DeepEP 版本漂移测试的
说明,以及 _MODE_SLUG 注释在使用处的重复副本。

十个仅改动注释的文件在去除 docstring 后 AST 完全相同。单元测试前后一致:
运行 264 个,通过,跳过 14 个。
Apply AGENTS.md's test-quality rules to collectivex/tests: delete tests that
inspect code or pin checked-in config instead of exercising behavior, merge
tests that reach the same branch, and remove dead fakes. 264 tests become 243
with no loss of behavioral coverage.

- Config and constant pins: runner labels, the flashinfer and nccl-ep matrix
  SKU and precision sets, run_ep backend names, _FP8_BLOCK, ll_recv_hook, the
  class-level kernel_generation, and the UCCL build flags and cache generation.
- Introspection and test-infrastructure checks: fake signatures, CPython
  byref, setUp and premise self-checks, import smoke.
- Reimplementations: DeepEP scale and epilogue reference specs, an in-test
  dequant copy (now a plumbing check on the real receive path), and probe
  marker regexes copied from common.sh (now exact output lines).
- Tautologies: the base implementation_details() == {}, the reloaded
  fp8_consume default, and a bandwidth expectation derived from the
  implementation (now 375 GB/s worked by hand).
- Duplicates folded into one test or a subTest table: alignment rows, chain
  host counts, runner filtering, chain output verdicts, budget gates,
  prepare_cache, mode and precision validation, nccl reduction selection,
  deepep-v2 capacity rounding, and nccl tests the contract file covers.

The clamped-ladder test now clamps a ladder and asserts the recorded values;
swap and codec tests use controlled platforms and profiles; two torch-free
checks no longer skip without torch; fakes lose the members a trace of the
suite never reached.

中文:
按 AGENTS.md 的测试质量规则清理 collectivex/tests:删除检查代码或固定已提交配置、
而非运行实际行为的测试,合并到达同一分支的测试,并移除无用的测试替身。测试数从
264 个减为 243 个,对真实行为的覆盖没有减少。

- 固定配置与常量:runner 标签、flashinfer 与 nccl-ep 矩阵的 SKU 与精度集合、
  run_ep 的后端名称、_FP8_BLOCK、ll_recv_hook、类级 kernel_generation,以及 UCCL
  的构建标志和缓存代号。
- 自省与测试基础设施检查:假对象的签名、CPython 的 byref、setUp 与前提自检、
  导入冒烟测试。
- 重新实现被测代码:DeepEP 的缩放与收尾参考实现、测试内的反量化副本(改为检查
  真实接收路径的衔接),以及从 common.sh 复制的探针标记正则(改为断言精确的输出行)。
- 同义反复:基类 implementation_details() == {}、重新加载后的 fp8_consume 默认值,
  以及由实现推导出的带宽期望值(改为手算的 375 GB/s)。
- 合并为单个测试或 subTest 表的重复测试:对齐行、链路的主机计数、runner 过滤、
  链路输出判定、预算门限、prepare_cache、模式与精度校验、nccl 归约选择、deepep-v2
  容量取整,以及契约文件已覆盖的 nccl 测试。

截断 ladder 的测试现在真正截断一个 ladder,并断言记录下的值;swap 与编解码测试改用
受控的平台与配置;两个不依赖 torch 的检查在没有 torch 时不再被跳过;测试替身中删除了
追踪整个测试套件时从未执行到的成员。
Bring README.md and docs/{methodology,methodology-summary,nccl-ep,swap-blocks}.md in line with
the code on main after the hand-run switch (#4054) and the GPU-clock, timing-window and
engine-contract merges (#4100, #4101, #4105). Every published row will be re-measured from main,
so notes that only told older row generations apart are removed; the evidence behind each
current rule stays.

- README holds usage and the coverage tables: what runs where per backend and mode, the
  cases.json counts (195 requested, 181 runnable, 14 unsupported), the variables that change a
  row without changing its case_id, the operator document format, and which pools need a stage
  directory (h100-dgxc, b300, gb300 and the AMD pools).
- methodology.md drops the store-generation discriminators, the skip-version-2 rule, the old
  kernel_generation names, the -cudagraph-in-graph-ar and unaligned eager families, the
  chain_regime_passed rename and the legacy-schema note. Per-backend evidence, including the
  README's DeepEP V2 pin, EFA and MoRI heap notes, moves into one Backends section, and a
  kernel_generation table lists the current families.
- Stale statements fixed: the bash -n check only read its first file; uccl-ep and MoRI
  low-latency also stop at 256 tokens; three host-gate limits were two; the default-route
  socket fallback contradicted Execution Isolation and now lists h100-dgxc; stage_dir
  permissions are not checked; no image-provided DeepEP path exists; DeepEP V2 low-latency on
  B300 is absent from the matrix, not an unsupported row; the MI300X/MI325X EP16 reason no
  longer names the retired tw pools; the MoRI heap guard covers scale-out only; GB/s is derived
  by bandwidth.py, not emitted; graphed FP8 rows report stage unavailable; the registry network
  block wins over an operator document.
- operatorx/CI.md no longer says CollectiveX stages b300 in the passwd home, and shared/README
  no longer says CollectiveX depends on inferencex-e2e helpers.
- From review: a hand run outside the account that owns the registry squash_dir needs its own
  squash_dir or storage_roots (the README example now uses storage_roots); nccl-ep.md explains
  -static; Execution Isolation says every shard clears inherited selectors, documents
  single_node_rdma_devices and DeepEP's EP_OVERRIDE_RDMA_SL; UCCL-EP's FP8 is e4m3fnuz on gfx942;
  the MoRI SDMA citation now says the FP4 recipes set it on prefill roles only, and the recipes'
  AUTO launch mode is noted; the FP8 per-call charge is credited to the measured graph cell only;
  imports are once per node where squash dirs are node-local; the unsupported 2-6% drift figure
  is gone; bandwidth.py's comment no longer says graphed rows publish p50 only.

中文:
在改为手动运行(#4054)以及合并 GPU 时钟、计时窗口和引擎约定(#4100、#4101、#4105)之后,使
README.md 和 docs/{methodology,methodology-summary,nccl-ep,swap-blocks}.md 与 main 上的代码一致。
所有公开的结果行都会基于 main 重新测量,因此只用于区分旧版结果行的说明被删除;每条现行规则背后的
证据予以保留。

- README 只保留用法和覆盖表:每个后端在各模式下的运行范围、cases.json 的数量(共 195 个请求、
  181 个可运行、14 个不支持)、会改变结果行但不改变 case_id 的环境变量、operator 文档格式,以及
  哪些资源池需要 stage 目录(h100-dgxc、b300、gb300 和 AMD 资源池)。
- methodology.md 删除了存储代际区分字段、跳过版本 2 的规则、旧的 kernel_generation 名称、
  -cudagraph-in-graph-ar 与未对齐的 eager 系列、chain_regime_passed 改名记录以及旧 schema 说明。
  各后端的证据(包括 README 中 DeepEP V2 的版本固定、EFA 和 MoRI 堆模式说明)集中到新的 Backends
  一节,并新增一张列出当前 kernel_generation 系列的表。
- 修正的过时说法:bash -n 检查只读取第一个文件;uccl-ep 和 MoRI 的低延迟模式同样止于 256 个
  token;主机门控的局限是两条而不是三条;默认路由的 socket 回退与 Execution Isolation 的描述
  矛盾,现已补上 h100-dgxc;stage_dir 的权限并不会被检查;不存在使用镜像自带 DeepEP 的路径;
  B300 上的 DeepEP V2 低延迟行不在矩阵中,而不是不支持行;MI300X/MI325X 的 EP16 原因不再引用已
  下线的 tw 资源池;MoRI 的堆模式保护只针对 scale-out;GB/s 由 bandwidth.py 推导而非结果中直接
  给出;graph 化的 FP8 行将 stage 报告为不可用;注册表的 network 块优先于 operator 文档。
- operatorx/CI.md 不再声称 CollectiveX 将 b300 的 stage 放在 passwd 主目录中,shared/README 不再
  声称 CollectiveX 依赖 inferencex-e2e 的辅助代码。
- 根据评审修正:以非 registry squash_dir 所属账户手动运行时,需要自己的 squash_dir 或
  storage_roots(README 示例改用 storage_roots);nccl-ep.md 解释 -static;Execution Isolation
  说明每个分片都会清除继承的选择器,并记录 single_node_rdma_devices 与 DeepEP 的
  EP_OVERRIDE_RDMA_SL;UCCL-EP 的 FP8 在 gfx942 上为 e4m3fnuz;MoRI SDMA 的引用改为说明 FP4 配方
  只在 prefill 角色上开启它,并注明配方使用 AUTO 启动模式;FP8 每次调用开销只归于实测的 graph
  用例;squash 目录为节点本地时按节点导入镜像;删除无依据的 2-6% 漂移数字;bandwidth.py 的注释
  不再声称 graph 行只公开 p50。

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good — this is a careful, well-scoped cleanup pass with no behavioral changes.

Extended reasoning...

Spot-checked the shell trims (confirmed collx_launcher_prologue never read its $RUNNER arg, and the removed collx_load_operator_config no-SKU branch is unreachable since every launcher sets COLLX_RUNNER before calling it), the Python removals (decode_source_ids' dropped seed param and stage.py's dropped nargs slot have no remaining callers/behavior change), and a sample of the heavily-rewritten test suite (e.g. the deleted NcclLowLatencyLadderSizing tests in test_backends.py, which built backends via hand-stubbed init, are superseded by more faithful full-construction coverage already in test_nccl_ep_contract.py, including the "-gum1" kernel_generation branch). The three cross-project doc edits (operatorx/CI.md, shared/README*.md) accurately drop a stale CollectiveX reference, confirmed by grep showing collectivex/ no longer imports anything from inferencex-e2e. No security-sensitive surface (auth, crypto, injection) is touched; this is internal benchmark tooling, docs, and tests.

@Oseltamivir
Oseltamivir merged commit 8b25006 into main Oct 15, 2026
9 checks passed
@Oseltamivir
Oseltamivir deleted the cx-trim branch October 15, 2026 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant