mindspore-ai / mindspore-ai/hyper-parallel
[Clean Code] 清理 Multicore 静态检查告警并收敛内部实现
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 53
- Forks
- 63
- Avg merge
- 23h 45m
- Merged PRs (30d)
- 63
Description
背景
HyperParallel 最新静态扫描报告在 Multicore 相关代码中记录了 347 条告警,其中 214 条建议修改、133 条建议按规则屏蔽。现有问题主要集中在 C++ 注释和命名空间、魔法数字、参数及局部变量过多、重复 device helper、SHMEM 类型与对象生命周期,以及 Python 复杂流程的可读性。
本任务对建议修改项进行逐条治理,并对必须保持 flat ABI 的场景采用仓库统一过滤机制,避免在业务代码中增加零散 suppression。
清理范围
- 清理 C++ 注释、include 顺序、命名空间、普通枚举和未使用代码。
- 将运行时协议常量与序列化布局显式化,通过结构大小和
static_assert约束 ABI。 - 合并前后向重复的 device kernel helper,减少重复实现。
- 修正 SHMEM size、alignment、溢出检查以及初始化对象生命周期。
- 使用私有数据类和内部参数结构封装 MegaMoE 图生成、调度、Torch wrapper 及 benchmark 状态,保持公开函数和算子 ABI 不变。
- 收敛 native vendor 合并校验流程,避免重复 ELF 解析。
- 对 flat
torch.libraryschema 导致且无法在不修改 ABI 的情况下消除的告警,使用集中式 pylint 过滤并说明原因。
约束
- 不修改 Multicore 对外 Python 接口和 Torch 算子 schema。
- 不改变 runtime tiling 序列化字段顺序和 C/C++ kernel 入口。
- 不新增与清理无关的功能、资料或测试用例。
- 不通过跳过代码路径或弱化校验规避告警。
验收条件
- 原扫描表中 214 条建议修改项均完成源码映射和处理。
- 建议屏蔽项有明确规则依据,并统一放入仓库过滤配置。
- Python 语法检查、仓库 pylint review、diff whitespace 检查通过。
- Multicore 默认双 SoC 原生编译和 wheel 打包通过。
- PR 静态检查门禁通过。
schema_version: 1
source: gitcode
gitcode_repo: mindspore/hyper-parallel
gitcode_issue: 392
source_url: https://gitcode.com/mindspore/hyper-parallel/issues/392
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the latest HyperParallel static-scan report and map its 214 suggested fixes to the Multicore C++ and Python areas, including MegaMoE, native vendor validation, SHMEM handling, and Torch wrappers. Review the repository’s existing filtering configuration before handling unavoidable flat torch.library schema warnings. Done means the listed checks pass, default dual-SoC compilation and wheel packaging succeed, and the PR static-analysis gate is green.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- backend, build-system, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100