[issue4] AllReduce/Reduce-Scatter bitwise 复现性诊断工具 - #29
Open
shsaihdsaiudh wants to merge 1 commit into
Open
Conversation
shsaihdsaiudh
force-pushed
the
issue4-bitwise-repro
branch
from
July 26, 2026 09:08
d77f432 to
7101396
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue
#4
提交内容
src/code/issue4/reproducibility_diagnoser.py:集合通信 bitwise 可复现性诊断工具。对完全相同的输入张量重复执行 AllReduce 或 Reduce-Scatter,按run / call / rank三级粒度记录逐位摘要并互相比对。发现差异时报告给出:
设计上的两个要点:
--env可在进程内固定NCCL_ALGO/NCCL_PROTO/NCCL_NVLS_ENABLE等,从而逐项定位是哪个算法/协议配置引入了不确定性。验证
不需要 GPU 的自检(演示 FP32 归约顺序为何改变结果位模式):
python src/code/issue4/reproducibility_diagnoser.py --self-test --output reports/order-demo.json python -m pytest src/code/issue4/test_reproducibility_diagnoser.py -q # 3 passed单卡真实 NCCL 冒烟测试(本机 RTX 5060 Ti,PyTorch 2.13.0+cu130,NCCL 2.29.7):
AllReduce 与 Reduce-Scatter 两种原语均跑通,结果见
results/single_gpu_all_reduce.json、results/single_gpu_reduce_scatter.json。定位链路验证——在 run 1 / call 3 / rank 0 注入 1 ULP:
工具准确定位到
run=1, call=3, rank=0,mismatched_elements=1,max_rel_diff≈9.44e-08(FP32 1 ULP 量级),见results/single_gpu_injection.json。当前边界
本 PR 提交的是验收要求 1 的诊断工具本身,并已在真实 NCCL 上验证采集与定位链路可用。
--inject-difference是工具自检手段,不是 NCCL 不确定性的证据,报告与 README 中均已标注。验收要求 2(给出至少一个可复现的真实 non-determinism 案例,并定位到具体算法/协议配置)需要 ≥2 GPU:
world_size=1时不存在跨 rank 归约顺序变化,原理上无法暴露该类问题,报告的limitations字段会显式声明这一点。提交者当前为单卡环境。多卡验收命令已写入README-2026.md,在多卡机器上可直接执行。