Skip to content

【训练营】Pipeline 并行自定义布局 - #223

Open
CuiLingyunCrispy wants to merge 5 commits into
InfiniTensor:masterfrom
CuiLingyunCrispy:feat/pipeline-custom-layout
Open

CuiLingyunCrispy wants to merge 5 commits into
InfiniTensor:masterfrom
CuiLingyunCrispy:feat/pipeline-custom-layout

Conversation

@CuiLingyunCrispy

Copy link
Copy Markdown

背景

为 InfiniTrain 增加统一的 Pipeline 并行自定义布局(Pipeline Layout)能力:用户可通过命令行显式配置各 Pipeline Stage 的 Transformer 层范围及 Embedding / FinalNorm / LMHead 的归属,并支持自动负载均衡布局建议与 Pipeline 负载分析。

主要改动

统一 PipelineLayout 数据结构,按用户提供的每层计算代价或按每层参数量等自动建议布局;对布局合法性进行校验以及分析Pipeline 负载分析

对标标准

  • 全部通过标准
  • 支持根据各层参数量、Profiler 统计或用户提供的计算代价,自动生成近似负载均衡的布局建议。
  • 给出默认均匀布局和自定义布局的 Pipeline bubble、各 Stage 执行时间及吞吐对比,证明自定义布局能够改善负载不均衡场景。

测试

(1)单元测试:tests/distributed/test_pipeline_layout.cc(12 用例)+ test_pipeline_layout_suggest.cc(22 用例),全部通过
(2)端到端:scripts/verify_pipeline_layout_correctness.sh(PP=1 单卡 vs PP=2 7,5,逐 step loss 对比)

文档

  • 使用指导:docs/pipeline_layout_guide.md
  • 离线对比演示:docs/pipeline_layout_demo.cc

@JYMiracle305
JYMiracle305 self-requested a review September 20, 2026 01:47
@@ -0,0 +1,114 @@
// Demonstration for excellent-standard #4: compare the default uniform pipeline

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.

docs下面不要放置代码文件

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

好的,已修改

Comment on lines +118 to +121
const double efficiency = bottleneck > 0.0 ? average / bottleneck : 0.0;
const double imbalance_bubble = 1.0 - efficiency;

// Use LOG(ERROR) so the summary reaches stderr even when glog's stderrthreshold

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.

出于什么考虑,性能打印要设置LOG(ERROR) 级别打印

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

一是main.cc里用的也是log(error),二是根据我的理解, glog 默认 stderrthreshold=2,只有 ERROR 及以上级别才会打到 stderr,INFO 只会进日志文件。如果这里有需要改动的话,我也可以进行修改。

Comment thread README.md Outdated
> Both options are optional and can be disabled for CPU-only builds.

## ✨ InfiniTrain Overview
## ✨ InfiniTrain Overview

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.

请恢复 README.md 没有实际改动的修改

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

好的,已修改

@@ -0,0 +1,111 @@
#!/usr/bin/env bash

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.

不建议设置一个脚本验证 pipeline 非均匀切分,可以单独添加测例的配置到 test_config.json,同时能验证到 GPT2 和 LLaMA3

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

好的,已修改

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants