mindspore-ai / mindspore-ai/hyper-parallel

[Clean Code] 整改 Linear Attention GDN/KDA 代码扫描告警

Open
#886 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
53
Forks
63
Avg merge
23h 45m
Merged PRs (30d)
63

Description

背景

代码扫描表中分配给作者的 Linear Attention GDN/KDA 告警,需要在不改变融合算子算法、Context Parallel 通信和训练数值的前提下完成低风险整改。GitCode PR #1477 与 #1393 尚未在 GitHub 主仓形成原生 PR,本 Issue 用于跟踪迁移后的独立整改。

范围

  • GDN/KDA 模块和 Context Parallel host 侧低风险扫描整改。
  • 修正 __all__、编码声明、显式异常、普通 Python 临时变量命名及可独立抽取的 shape/ShortConv helper。
  • 在 KDA P2P backward 中及时释放最后消费者之后的重计算临时张量,使后续 backward 分配可以复用 storage。
  • 保留 Triton JIT 参数、tile 符号、kernel 数量、launch shape、autograd 返回槽位和 CP 消息顺序。

本批不包含 FLA runtime adapter、第三方依赖切换、Triton-Ascend 编译器修复、kernel 算法重构或大 CP 实验代码;无法安全修改的 kernel 告警继续走精确豁免或后续独立整改。

验收

  • git diff --check、改动文件 compile/Pylint 和相关 CPU UT 通过。
  • GDN/KDA 的 P2P Triton、FSDP、activation checkpoint 多卡训练精度回归通过。
  • KDA backward 临时张量释放完成相同 shape 的显存 A/B,且不引入稳定性能回退。
  • PR 相对最新 master 保持单一、可审核的业务 commit。

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GDN/KDA modules and Context Parallel host-side code described in the issue, then review the existing GDN/KDA P2P backward and shape/ShortConv helper paths. Run git diff --check, compile/Pylint and related CPU unit tests first; completion requires the listed Triton, FSDP, activation-checkpoint multi-card accuracy regressions and the KDA temporary-tensor memory A/B without a stable performance regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, machine-learning, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.