mindspore-ai / mindspore-ai/hyper-parallel
补充 core/shard 与 custom_ops/experimental 的 UT 覆盖率
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 53
- Forks
- 63
- Avg merge
- 23h 45m
- Merged PRs (30d)
- 63
Description
背景
HyperParallel 对单文件 UT 覆盖率有 ≥70% 的要求。当前以下文件覆盖率不达标:
| 文件 | 当前覆盖率 |
|---|---|
hyper_parallel/core/shard/api.py |
8% |
hyper_parallel/core/shard/custom_shard.py |
18% |
hyper_parallel/core/shard/_op_dispatch.py |
31% |
hyper_parallel/core/shard/ops/parallel_flash_attention_score.py |
0% |
hyper_parallel/core/shard/ops/parallel_scaled_dot_product_attention.py |
18% |
hyper_parallel/core/shard/ops/parallel_tuple_elementwise.py |
50% |
hyper_parallel/core/shard/ops/parallel_ops.py |
52% |
hyper_parallel/core/shard/ops/parallel_one_hot_ext.py |
54% |
hyper_parallel/core/shard/ops/parallel_embedding.py |
65% |
hyper_parallel/core/shard/ops/parallel_conv3d.py |
69% |
hyper_parallel/custom_ops/experimental/ |
0%(无 UT 文件) |
此外,custom_ops/experimental/__init__.py 将实现与导出混写在同一文件,不符合模块分离约定。
目标
-
重构
custom_ops/experimental:将 5 个 wrapper 函数的实现从__init__.py提取到experimental_ops.py,__init__.py保持纯 re-export,对外接口不变。 -
补充 UT,使所有文件达到 ≥70% 覆盖率:
core/shard/api.py:新建test_api.py,覆盖 hook 注册、layout 转换、DTensor 重分布路径core/shard/custom_shard.py:新建test_custom_shard.py,覆盖所有分支core/shard/_op_dispatch.py:补充test_op_dispatch.py,覆盖 LayoutCacheManager、_pack_infer_output、_with_layout_infer、dispatch 流程ops/parallel_flash_attention_score.py:新建,覆盖 ParallelFlashAttention 各 layout 模式ops/parallel_ops.py:新建,覆盖基类逻辑ops/parallel_tuple_elementwise.py:新建,覆盖 layout 一致性推断ops/parallel_scaled_dot_product_attention.py:补充,覆盖 get_expand_impl、causal maskops/parallel_embedding.py、ops/parallel_conv3d.py、ops/parallel_one_hot_ext.py:补充 get_expand_impl 路径custom_ops/experimental/experimental_ops.py:新建test_experimental_ops.py,100% 覆盖
所有 UT 使用 mock 平台,无 GPU/NPU 硬件依赖。
相关 PR
!665
schema_version: 1
source: gitcode
gitcode_repo: mindspore/hyper-parallel
gitcode_issue: 159
source_url: https://gitcode.com/mindspore/hyper-parallel/issues/159
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
Read the listed files under hyper_parallel/core/shard, core/shard/ops, and custom_ops/experimental, starting with custom_ops/experimental/init.py and the named UT entry points. Run the existing mock-platform tests and coverage checks to identify uncovered branches. Done means experimental_ops.py is covered at 100%, every listed file reaches at least 70%, and init.py preserves the public re-exports without hardware dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100