mindspore-ai / mindspore-ai/hyper-parallel

[RFC]: 删除platform

Open
#614 2 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

动机(Motivation).

1. 背景与现状

hyper_parallel/platform/ 当前的架构是 双实现 + 单一分发器

  • platform/platform.py(约 67KB)定义抽象的 Platform 基类,契约面高达 100+ 个属性(collective、differentiable_* 异步族、tensor 工厂、checkpoint/swap、stream/random、param 自省、custom_ops 等)。
  • platform/mindspore/platform.py(约 83KB)与 platform/torch/platform.py(约 64KB)是两套各自独立、平行实现的具体平台类。
  • 分发逻辑 get_platform()platform/platform.py:99-126)返回全局单例,默认 MindSpore,可被环境变量 HYPER_PARALLEL_PLATFORM 覆盖,失败时 ImportError 回退 torch:
# platform.py
try:
    return get_mindspore_platform()
except ImportError:
    return get_torch_platform()
  • 整个代码库(core/trainer/models/collectives/integration/dmodule/)几乎全部通过 from hyper_parallel import get_platform 拿到单例,再在模块顶层绑定 Tensor = platform.Tensorplatform.get_rank() 等使用。core/ 层不直接 import torchimport mindspore,而是通过接缝与框架解耦。

2. 本次任务目标

删除platform,代码直接使用torch进行实现。

目标设计.

删除platform,代码直接使用torch进行实现。

需要设计评审DFX建议.

NA

相关的RFCs和API

NA

完整的反馈期限.
CC List.
其他补充说明.

Thanks for contributing 🎉! The hyper-parallel core team hosts a biweekly RFC review session, while most RFCs can be discussed online, you can optionally sign up for a slot to discuss your RFC online.

Before submitting a new issue...
  • Make sure you already searched for previous RFCs.

schema_version: 1
source: gitcode
gitcode_repo: mindspore/hyper-parallel
gitcode_issue: 377
source_url: https://gitcode.com/mindspore/hyper-parallel/issues/377

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 platform/platform.py and the parallel implementations under platform/mindspore/ and platform/torch/, then trace get_platform usage across core/, trainer/, models/, collectives/, integration/, and dmodule/. Done means the platform abstraction and dispatcher are removed, callers use torch directly, and the affected functionality remains covered by the repository's existing checks.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.