How mindspore-ai/hyper-parallel works
HyperParallel is a distributed training and execution framework for Ascend supernodes. Its main user workflow is to configure a Hugging Face model and training run, apply model-specific parallelization and graph transformations, execute training using composed distributed and memory-management capabilities, and persist or restore distributed state. Separate subsystems support automatic parallel planning, pipeline balancing, checkpoint conversion, inference, and reinforcement-learning rollout. The README documents the major capabilities; sampled source and the SOURCE INDEX substantiate several internal calls, but do not expose the complete training runtime wiring.
Main entry points: base.py Training runtime · sapp_pipeline.py Pipeline balancing · filesystem_storage.py Distributed checkpoint · parser.py Trainer config
Components 25
Model training
- Trainer config
hyper_parallel/trainer/config/parser.py - Model codegen
hyper_parallel/codegen/manager.py - Inline patching
hyper_parallel/codegen/inline/pipeline.py - Graph compiler
hyper_parallel/compile/passes/pipeline.py - Training runtime
hyper_parallel/trainer/base.py
Parallel execution
- DeviceMesh and DTensor
hyper_parallel/core/dtensor/placement_types.py - FSDP / HSDP
hyper_parallel/core/fully_shard/api.py - Context parallel
hyper_parallel/core/context_parallel/context_parallel.py - Expert parallel
hyper_parallel/core/expert_parallel/expert_parallel.py - Pipeline parallel
hyper_parallel/core/pipeline_parallel/pipeline_swap.py - Multicore MoE
hyper_parallel/core/multicore/modules/mega_moe/module.py - Activation memory
hyper_parallel/core/activation_memory/api.py
Automatic planning
- ND auto parallel
hyper_parallel/auto_parallel/sapp_nd/nd/parallelize.py - Memory estimation
hyper_parallel/auto_parallel/sapp_nd/memory_estimation/_context.py - Pipeline balancing
hyper_parallel/auto_parallel/sapp_ppb/sapp/sapp_pipeline.py - Balance solver
hyper_parallel/auto_parallel/sapp_ppb/sapp/sapp_solver.py - Pipeline simulator
hyper_parallel/auto_parallel/sapp_ppb/simulator/sim_block.py
State and integration
- Distributed checkpoint
hyper_parallel/core/distributed_checkpoint/filesystem_storage.py - Checkpoint conversion
hyper_parallel/components/checkpoint/weight_conversion.py - Optimizer components
hyper_parallel/components/optim/builders.py
Model runtime
- Generation and KV cache
hyper_parallel/infer/generation.py - RL rollout worker
hyper_parallel/rl/rl/roles/rollout/worker.py - Rollout weight sync
hyper_parallel/rl/rl/weight_sync/vllm_worker.py
Other components
- Training user
- vLLM service
Connections 25
- Training user → Trainer config: configures
README.md - Trainer config → Training runtime: starts training
- Training runtime → Model codegen: prepares model
- Model codegen → Inline patching: renders patches
hyper_parallel/codegen/manager.py - Training runtime → Graph compiler: transforms graph
- Training runtime → Optimizer components: uses optimizer
README.md - Training runtime → Distributed checkpoint: saves state
README.md - Training runtime → DeviceMesh and DTensor: distributes tensors
README.md - DeviceMesh and DTensor → FSDP / HSDP: defines layouts
README.md - Training runtime → Context parallel: applies parallelism
README.md - Training runtime → Expert parallel: applies parallelism
README.md - Training runtime → Pipeline parallel: schedules stages
README.md - Training runtime → Multicore MoE: dispatches MoE
README.md - Training runtime → Activation memory: manages activations
README.md - Training user → ND auto parallel: requests planning
README.md - ND auto parallel → Memory estimation: estimates memory
- Training user → Pipeline balancing: requests balancing
- Pipeline balancing → Balance solver: solves balance
hyper_parallel/auto_parallel/sapp_ppb/sapp/sapp_pipeline.py - Pipeline balancing → Pipeline simulator: simulates schedule
hyper_parallel/auto_parallel/sapp_ppb/sapp/sapp_pipeline.py - Pipeline balancing → Distributed checkpoint: persists state
- Training user → Generation and KV cache: requests generation
- Training user → RL rollout worker: starts rollout
- RL rollout worker → Rollout weight sync: synchronizes weights
- Rollout weight sync → vLLM service: updates parameters
- Distributed checkpoint → Checkpoint conversion: converts weights