Implements model inference parallelization on Ascend NPU with PyTorch, including parallel linear layer replacement, MoE parallel adaptation, communication group creation, Embedding/LMHead parallelism, YAML config generation, and weight conversion. Supports both framework and standalone deployment modes.
Ships in model-infer-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
按已确认的 parallel_config 实施模型并行化改造,覆盖并行层替换、通信组接入、YAML 配置生成、权重处理与验证。
框架部署模式:模型类构造接受 infer_config + comm_manager,在 __init__ 调 init_parallel_comm_group() 按需 comm_manager.register_group() 注册通信组(框架自动判断 HCCL 物理组复用),启动通过 cann-recipes-infer/executor/scripts/function.sh::launch。
独立部署模式:Runner 自管推理循环(含进程组初始化、通信组建立、ForwardMetaData 构造、prefill / decode 调度),通过 torchrun 启动。
| 优先级 | 判定来源 | 说明 |
|---|---|---|
| 1 | dispatch prompt 显式指定 | prompt 含 部署模式: 框架部署 或 部署模式: 独立部署 → 直接采用 |
| 2 | 用户对话指定 | 仅独立调用(用户直接 invoke skill)时适用 |
| 3 | migrator 阶段产物自检 | 模型注册到 cann-recipes-infer/executor/core/support_models.py → 框架部署;模型目录有 runner_*.py 不继承 framework 基类、自管推理循环 → 独立部署;不确定时默认框架部署 |
判定后跳转:
两模式共通流程(配置参数速查 / YAML 配置生成 / 权重处理 / 验证)见后续公共章节。
根据 parallel_config 中各参数值,确定需要执行哪些步骤:
| 参数条件 | 需要的通信组 | 需要的代码改造 |
|---|---|---|
attn_tp_size > 1 | attn_tp_group | Attention QKV/O 替换为 ParallelLinear |
attn_tp_size = 1 且 world_size > 1 | 无 Attention TP 组(走 DP) | Attention 不需要 TP 替换 |
dense_tp_size > 1 | dense_tp_group | Dense FFN Gate/Up/Down 替换 |
moe_tp_size > 1 | moe_tp_group | MoE 专家 FFN 做 TP 切分 |
moe_tp_size = 1 且有 MoE | moe_ep_group + moe_ep_group_mc2(均需 HCCL group name;MC2 组须 allow_physical_reuse=False 区分独立物理组) | MoE EP dispatch/combine 实现 |
o_proj_tp_size ≠ attn_tp_size | oproj_tp_group(独立组) | O_proj 使用独立通信组 |
embed_tp_size > 1 | embed_tp_group | Embedding 替换为 VocabParallelEmbedding |
lmhead_tp_size > 1 | lmhead_tp_group | LMHead 替换为 ColumnParallelLinear |
| 相邻模块 TP 度不同 | — | 模块间插入 AllGather/ReduceScatter 重排 |
tp_size = 1的模块不需要 TP 替换和对应通信组。先扫一遍 parallel_config,标注哪些模块需要改,再逐步执行。
接入 cann-recipes-infer/executor/core/ 框架,模型类构造接受 comm_manager,启动走 cann-recipes-infer/executor/scripts/function.sh::launch。
第一步:确认输入 + 选择参考模型
↓
第二步:通信组创建
↓
第三步:逐模块并行层替换
↓
第四步:Embedding / LMHead 并行
↓
后续 YAML / 权重 / 验证 走公共章节
禁止:跳过第二步直接替换层。
从编排层(主 agent prompt 或用户输入)获取已确认的配置:
parallel_config:
attn_tp_size: {value} # attn_dp_size = world_size // attn_tp_size
dense_tp_size: {value}
moe_tp_size: {value} # moe_ep_size = world_size // moe_tp_size
embed_tp_size: {value}
lmhead_tp_size: {value}
o_proj_tp_size: {value} # MLA 模型需要,非 MLA 可省略
根据目标代码实现模式,选择仓库中最接近的已适配模型阅读其 modeling 代码:
| 实现模式 | 参考模型 | 关注点 |
|---|---|---|
| 标准 GQA + 纯 TP | GPT-OSS | QKVParallelLinear 基础用法 |
| 标准 GQA + MoE EP | Qwen3-MoE | MoE routing + npu_swiglu 融合 |
| MLA + 模块差异化 TP + EP | DeepSeek-R1 / V3.2 | MLA 投影切分、oproj 独立 group、EP dispatch/combine |
必须:读取参考模型的 modeling_*.py,了解并行层替换和通信组使用方式。框架的通信组由 CommManager 在 ModelWorker 初始化时统一创建,模型类内通过 comm_manager.get_group("attn_tp_group") 等接口获取。
并行层替换前,必须先在模型初始化中创建通信组。
CommManager 提供 register_group() API,模型在 __init__ 调用 init_parallel_comm_group() 按需注册自己用到的所有通信组,框架按 (group_num, group_size, group_stride) 形状自动判断 HCCL 物理通信组复用,需要独立物理组(MC2 fullmesh_v2、multi-stream 副本组)时显式 allow_physical_reuse=False。
from executor.core.config import InferenceConfig, CommManager
class XxxForCausalLM(nn.Module):
def __init__(self, config, infer_config: InferenceConfig,
comm_manager: CommManager = None, prefix: str = ""):
self.comm_manager = comm_manager
self.world_size = infer_config.parallel_config.world_size
self.attn_tp_size = infer_config.parallel_config.attn_tp_size
self.moe_ep_size = infer_config.parallel_config.moe_ep_size
# ... 其他 *_size
self.init_parallel_comm_group() # 在子模块构造前完成注册
init_parallel_comm_group 内部调 self.comm_manager.register_group(name, group_num, group_size, ...) 注册三类组:
attn_tp_group / embed_tp_group / lmhead_tp_group*_size > 1 时启用):moe_tp_group / moe_ep_group / dense_tp_group / oproj_tp_group;其中 moe_ep_group 需传 group_stride 和 return_name=Trueallow_physical_reuse=False):moe_ep_group_mc2(MC2 fullmesh_v2 通信)、*_stream1 副本组(multi-stream micro-batch)等;MC2 组的 hccl_buffer_size 通过 calc_moe_hccl_buffer_size 算出模板代码、参数表与上游 qwen3_moe / deepseek_r1 参考实现见 references/framework_moe_parallel.md 的"通信组注意事项"段。
取通信组:模型内部用 comm_manager.get_group(name) 取 ProcessGroup,comm_manager.get_group_name(name) 取 HCCL name(NPU dispatch / combine 算子要求),comm_manager.get_rank(name) 取组内 rank。
当 attn_tp ≠ dense_tp ≠ moe_tp 时,各模块从 comm_manager 取不同的通信组(attn_tp_group / dense_tp_group / moe_ep_group 等)。模型在 init_parallel_comm_group() 里只需按 YAML 配置 *_size > 1 的模块注册对应组即可,框架会自动判断物理组复用。
attn_dp_size = world_size // attn_tp_size
moe_dp_size = world_size // moe_tp_size
moe_ep_size = moe_dp_size # EP size = DP size
embed_dp_size = world_size // embed_tp_size
parallel_config 各 *_tp_size 字段已按目标策略配置comm_manager.get_group(...) 正确取用每个模块的通信组并行层替换同时支持了权重在线切分:ParallelLinear 内置
weight_loader(),按tp_rank自动加载切片。权重处理详见公共章节「## 权重处理」。
通用规则:所有线性 / Embedding 层(Attention QKV/O、Dense MLP、Embedding、LMHead)一律用对应 ParallelLinear 包装,不论 tp_size 取值(含 =1)。tp_size=1 时不引入通信开销,保留统一 weight_loader、quant_method dispatch 与 comm_manager 联动。
QKV → QKVParallelLinear,O → RowParallelLinear,均使用 attn_tp_group。MLA 模型 O_proj 可能使用独立的 oproj_tp_group。
forward 签名约定:设计文档
executor_design.md§6.1 要求模型类 forward 接收slot_mapping/block_table;参考模型统一通过**kwargs透传,不显式列参数(见cann-recipes-infer/models/qwen/models/modeling_qwen.py::forward),照此写法即可。
paged 模式联动:若模型已通过 kvcache skill 改造为 paged 模式(实现
get_cache_info()+ 构造cache_entries),attn_tp_size 改动后必须同步更新cache_entries的num_head字段为num_key_value_heads_per_rank = max(num_kv_heads // attn_tp_size, 1),否则 KV 按错误的 head 数预分配。
TP+DP 通信模式(
attn_tp_size > 1且attn_dp_size > 1):注册模型 attention 层用all_gather_into_tensor+reduce_scatter_tensor配对attn_tp_group(不用all_reduce):layer 间 hidden 维持[T/tp, H]切分以省 tp_size 倍激活内存,attention 入口 AllGather 还原全 T,出口 ReduceScatter 切回。通信原语要求各 rank 等长,因此 model 顶层 forward 必须做:
packed T pad 到
attn_tp_size倍数按 rank 切 input_ids
[rank * T/tp : (rank+1) * T/tp](建议 position_ids / cos/sin 不切,每 rank 保留 T_real,简化 attention 内部对齐)attention 内部 QKV 前 AllGather,O 投影后 ReduceScatter
备注:framework metadata(
slot_mapping/actual_seq_lengths_kv)按 T_real 构造,cache write 和 FA 必须 T_real。AllGather 出[T_padded, H]后用prompt_tokensslice 回 T_real 再算,O 投影后 cat-zeros 补回[T_padded, H]给 ReduceScatter。Prefill 末尾选末 token:AllGather hidden →
index_select(cu_seq_q - 1)→ lm_head(原 BSND 路径是本地取末位 → lm_head → gather logits,TND 顺序倒置)参考
cann-recipes-infer/models/qwen3_moe/models/modeling_qwen3_moe.py::Qwen3MoeModel.forward和Qwen3MoeAttention.forward。
Gate/Up → MergedColumnParallelLinear,Down → RowParallelLinear,激活用 torch_npu.npu_swiglu,均使用 dense_tp_group。
moe_tp_size > 1:专家 FFN 做 TP 切分 + AllReducemoe_tp_size = 1:EP 模式,Prefill 用 re_routing + AllToAll,Decode 用 dispatch/combine + AllToAllMoE 并行与融合算子紧密耦合,详见
references/framework_moe_parallel.md(含完整代码和算子说明)。
MoE 模型必填属性:config 暴露
num_experts_per_tok/n_routed_experts(hccl_utils 计算 MC2 buffer 用),ForCausalLM 实例暴露self.num_experts/self.num_experts_per_tok(EPLB hook 校验)。HF 上游若用其他命名(如moe_topk)加@propertyalias。
边界处需要 AllGather/ReduceScatter 做数据重排。
上述 1-4 项的代码示例(Attention / Dense FFN / Embed / LMHead / 数据重排)见
references/framework_code_examples.md。
VocabParallelEmbedding,按词表维度切,tp_rank=comm_manager.get_rank("embed_tp_group")ColumnParallelLinear,tp_rank=comm_manager.get_rank("lmhead_tp_group")完整代码示例见 references/framework_code_examples.md「Embedding / LMHead」节。
Runner 自管 dist.init_process_group + ParallelContext 构造,启动通过 torchrun。modeling 代码 import 路径与框架部署一致,仅构造签名一处差异(comm_manager → parallel_ctx)。
完整 ParallelContext 骨架、Runner 改造、modeling 改造、启动模板见 references/standalone_parallel.md。
按功能边界划分:
ParallelContext,对外接口对齐 CommManager)、通信组建立工厂、推理循环(Runner.model_generate,命名与签名与仓库 framework 模式 ModelRunner.model_generate 对齐,独立部署 inline 实现,不继承基类)、ForwardMetaData 构造、YAML 解析、启动脚本(torchrun)、入口(infer.py)。所有自管逻辑 inline 在 runner_{model_name}.py 内。cann-recipes-infer/module/linear.py(ParallelLinear)、cann-recipes-infer/module/fuse_moe_gmm.py(FusedMoEGMM)、cann-recipes-infer/module/quantization/*、cann-recipes-infer/executor/utils/hccl_utils.py(init_comm_group / get_group_name)、cann-recipes-infer/executor/utils/forward_metadata.py、cann-recipes-infer/executor/model_loader/*。这些与 torch_npu / numpy 同性质,import 不引入控制流约束。modeling 代码与框架部署的差异仅在构造签名(comm_manager → parallel_ctx,接口对齐 get_group(name) / get_group_name(name) / get_rank(name)),forward 计算逻辑、ParallelLinear 用法、MoE EP 算子链、所有 cann-recipes-infer/module/* import 路径完全一致。运行时配置(如 scheduler_config.batch_size)通过 parallel_ctx.runtime_cfg["..."] 访问。
第一步:Runner 改造(dist 初始化 + ParallelContext inline + 注入 modeling)
↓
第二步:modeling 代码改造(构造签名 + 并行层替换;并行层替换引用框架部署第三/四步)
↓
第三步:启动脚本(torchrun + infer.sh + infer.py)
↓
后续 YAML / 权重 / 验证 走公共章节
runner_{model_name}.py 顶部 inline ParallelContext + build_parallel_context(约 80 行),__init__ 内做 dist 初始化、构造 ParallelContext、把 parallel_ctx 注入 modeling。
class {ModelName}Runner:
def __init__(self, yaml_file_path):
with open(yaml_file_path) as f:
cfg = yaml.safe_load(f)
local_rank = int(os.environ["LOCAL_RANK"])
rank = int(os.environ["RANK"])
world_size = int(os.environ["WORLD_SIZE"])
torch.npu.set_device(local_rank)
dist.init_process_group(backend="hccl", rank=rank, world_size=world_size)
self.parallel_ctx = build_parallel_context(cfg)
self.model = {ModelName}ForCausalLM(
config=..., parallel_ctx=self.parallel_ctx, prefix="").to(f"npu:{local_rank}")
self._load_weights(...)
self._init_kvcache()
完整 ParallelContext dataclass 与 build_parallel_context 工厂见 references/standalone_parallel.md §1。
ParallelContext + build_parallel_context__init__ 内完成 dist 初始化(读 torchrun 注入的 RANK / WORLD_SIZE / LOCAL_RANK)parallel_ctx 注入 modeling 类构造构造签名从 (config, prefix) 改为 (config, parallel_ctx, prefix),属性访问通过 parallel_ctx.get_group(name) / get_group_name(name) / get_rank(name)。
ParallelLinear 替换、Embedding/LMHead 并行、模块间数据重排、MoE EP 算子链与框架部署完全一致,引用框架部署「第三步」「第四步」与 references/framework_code_examples.md / references/framework_moe_parallel.md。差异仅在 group 取用从 comm_manager.xxx 改为 parallel_ctx.xxx,group_ep 参数从 parallel_ctx.get_group_name("moe_ep_group") 取。
(config, parallel_ctx, prefix)parallel_ctx.get_rank(name) 取 tp_rankparallel_ctx.get_group_name("moe_ep_group") 取 group nameinfer.sh 用 torchrun 拉起,从 yaml 读 world_size 决定 --nproc_per_node,HCCL 环境变量在脚本内 export。完整 infer.sh / infer.py 模板见 references/standalone_parallel.md §4。
infer.sh 用 torchrun 拉起,--nproc_per_node 从 yaml.world_size 推导infer.py argparse 接 --yaml_file_path,实例化 Runner,先 model_generate(prompts, warm_up=True) 预热再 warm_up=False 正式跑HCCL_BUFFSIZE / HCCL_OP_EXPANSION_MODE / HCCL_CONNECT_TIMEOUT)已在 infer.sh exportYAML schema 完整字段、命名规范、粒度判定、保留策略见 model-infer-migrator skill references/yaml_template.md(两模式共用),本段只补多卡场景填值。
根据 model-infer-parallel-analysis 决策结果填入 parallel_config 段:
world_size 与 parallel_config.world_size 双写一致(前者供启动脚本读,后者供业务代码读)attn_tp_size / dense_tp_size / moe_tp_size / embed_tp_size / lmhead_tp_size / o_proj_tp_size:按 parallel-analysis 推导值填moe_ep_size / attn_dp_size:框架自动推导(world_size // *_tp_size),不需手填custom_params:多卡特性开关(enable_multi_streams / moe_chunk_max_len / perfect_eplb 等)scheduler_config.batch_size:全局 batch,按 attn_dp_size 推导每 rank batch(框架部署 ExecutionEngine 自动;独立部署 Runner 自管)scheduler_config.block_size:Paged 块粒度,128 起步yaml_template.md 命名维度 + 粒度判定)并行层替换后,需要确保权重能正确加载到各卡。两模式都直接 import 仓内 cann-recipes-infer/module/linear.py、cann-recipes-infer/module/fuse_moe_gmm.py 等,weight_loader 行为完全一致。
框架/Runner 在运行时通过各模块的 weight_loader() 自动按 rank 加载对应切片(新框架默认行为,无需 YAML 开关)。所有 rank 读同一份完整 checkpoint,各自只保留本卡需要的部分。
TP 权重加载:ColumnParallelLinear / RowParallelLinear 的 weight_loader 按 tp_rank 取对应列/行切片。
EP 权重加载(MoE 模型):FusedMoEGMM 的 weight_loader 按 ep_rank 过滤专家——只保留 [ep_rank * experts_per_rank, (ep_rank+1) * experts_per_rank) 范围内的专家权重,丢弃其他。load_weights() 中需通过 make_expert_params_mapping(num_experts=...) 生成全局专家映射,逐个传入 weight_loader(expert_id=...)。
适配要点:
load_weights() 方法,遍历权重文件并匹配到各模块的 weight_loader()make_expert_params_mapping 生成专家权重映射MergedColumnParallelLinear(如 gate+up 合并)需要特殊的 weight_loader 处理 slice 顺序process_weights_after_loading(),加载完成后遍历子模块触发权重后处理(量化 scale 处理、NZ 格式转换等):def process_weights_after_loading(self):
for _, module in self.named_modules():
qm = getattr(module, "quant_method", None)
if qm is not None and hasattr(qm, "process_weights_after_loading"):
qm.process_weights_after_loading(module)
参考实现:cann-recipes-infer/models/qwen3_moe/models/modeling_qwen3_moe.py::process_weights_after_loading、cann-recipes-infer/models/deepseek_r1/models/modeling_deepseek.py::process_weights_after_loading。
上述示例适用于 gpt_oss / qwen3_moe 等标准模型;MLA + 量化模型(如 deepseek_r1)通常需要扩展(KV-B split、scales dtype cast、跨 EP smooth_scale all_gather 等),照搬
modeling_deepseek.py::process_weights_after_loading而非示例。
若模型未实现 online split,或需要预切权重用于离线部署:
bash utils/weight_convert.sh \
--input_path /path/to/origin \
--output_path /path/to/output \
--world_size {W} \
--quant_mode {w8a8/w8a8c8/...}
输出为 rank_0/ ~ rank_N/ 目录结构,每个 rank 只包含该卡需要的权重切片。
注意:offline 预切的权重与 parallel_config 绑定。改了配置必须重新转换。
参考实现:cann-recipes-infer/models/deepseek_r1/utils/convert_model.py、cann-recipes-infer/models/deepseek_r1/utils/weight_convert.sh。独立部署可复制此对到模型目录改造。
load_weights() 和 weight_loader() 已实现框架的 InferenceConfig._validate() 在 from_dict 时自动校验 world_size 与各 *_tp_size 的整除性。下面是常见的额外语义校验,可放在模型自身的初始化或独立校验函数里(独立部署模式 Runner 不走 InferenceConfig,需自行调用此校验):
assert world_size % attn_tp_size == 0
assert world_size % moe_tp_size == 0
assert world_size % embed_tp_size == 0
assert world_size % lmhead_tp_size == 0
assert num_attention_heads % attn_tp_size == 0
assert num_key_value_heads % attn_tp_size == 0 # GQA
assert num_experts % ep_size == 0 # MoE
assert embed_tp_size >= attn_tp_size
assert embed_tp_size % attn_tp_size == 0
infer.sh 中 YAML 变量指向目标配置(两模式都用 YAML,框架部署的 function.sh::launch 与独立部署的 torchrun 启动都从此变量读路径)bash infer.sh每种配置独立验证,通过后再验下一个。
加载权重验证时,在 YAML 中设置 with_ckpt: True + model_path,确认各 rank 权重加载无报错。
enable_profiler: True 运行一次,生成 profiler 数据供后续策略校准| 错误模式 | 根因 | 预防 |
|---|---|---|
| 跳过通信组创建直接替换层 | 运行时找不到 group | 框架部署第二步必须先于第三步完成;独立部署 ParallelContext 必须先 build 再注入 modeling |
| 所有模块用同一个 tp_group | 未区分 attn_tp / dense_tp / moe_tp | 「配置参数 → 实施步骤速查」表逐项检查 group 来源 |
| EP 模式下 Prefill/Decode 用同一套代码 | 两阶段的 routing 算子不同 | 参考 framework_moe_parallel.md 中 Prefill/Decode 分支 |
| 模块间 TP 度不同但缺少数据重排 | 相邻模块 tensor shape 不匹配 | 速查表"相邻模块 TP 度不同"行提示了此步骤 |
| embed_tp_size < attn_tp_size | 框架约束:embed 输出需能被 attn 消费 | 「## 验证」配置校验脚本检查 |
| 权重加载 shape 不匹配 | 改了 parallel_config 但未重新处理权重 | 「## 权重处理」确认权重处理方式 |
| 实现模式 | 参考文件 | 搜索关键词 |
|---|---|---|
| TP 线性层替换 | cann-recipes-infer/models/gpt_oss/models/modeling_gpt_oss.py | QKVParallelLinear |
| 通信组取用 | cann-recipes-infer/models/qwen3_moe/models/modeling_qwen3_moe.py、cann-recipes-infer/models/deepseek_r1/models/modeling_deepseek.py | comm_manager.get_group |
| 通信组创建实现 | cann-recipes-infer/executor/core/config/comm_manager.py | CommManager.initialize |
| MoE EP Prefill | cann-recipes-infer/models/deepseek_r1/models/modeling_deepseek.py | npu_moe_re_routing |
| MoE EP Decode | cann-recipes-infer/models/deepseek_r1/models/modeling_deepseek.py | npu_moe_distribute_dispatch |
| Embed/LMHead 并行 | cann-recipes-infer/models/kimi-k2-thinking/models/modeling_deepseek.py | VocabParallelEmbedding |
| oproj_tp 独立配置 | cann-recipes-infer/models/longcat-flash/models/modeling_longcat_flash.py | oproj_tp |
| 权重转换脚本 | cann-recipes-infer/models/deepseek_r1/utils/ | weight_convert |
| YAML 多场景配置 | cann-recipes-infer/models/deepseek_r1/config/ | decode / prefill 分离 |
What SKILL.md sets; muted values are Claude Code's defaults
/model-infer-skills:model-infer-parallel-implfrom model-infer-skills
npx claudepluginhub catman626/cannbot-skills --plugin model-infer-skills14 skills in this plugin
/model-infer-fusion基于 PyTorch 框架的昇腾 NPU 模型推理融合算子优化技能。分析模型代码,识别可替换为 torch_npu 融合算子的计算模式,生成替换方案。触发场景:torch_npu 融合算子替换、MoE/Attention/FFN/Norm 等模块的推理算子适配、torch_npu API 使用咨询。基于仓库已有模型的融合算子经验,按计算语义推荐最佳方案。/model-infer-graph-mode基于 PyTorch 框架的昇腾 NPU 模型推理图模式适配技能。将模型适配到 torch.compile 图模式以加速推理性能。触发场景:npugraph_ex 或 GE 图模式适配、torch.compile 在昇腾 NPU 上的使用、图中断(Graph Break)修复、aclgraph 图编译问题。LLM 模型的图模式适配优先阅读 LLM 模型改造指南。/model-infer-kvcache基于 PyTorch 框架的昇腾 NPU 模型推理 KVCache 优化技能。分析并改造 LLM 推理模型的 KVCache 实现,覆盖 Legacy 连续缓存与分页注意力(Paged Attention)配 FA 融合算子、MLA 压缩缓存、SlidingWindow / 多 attn_type 混合。触发场景:KVCache 管理实现、分页注意力接入、KV 压缩、FA 融合算子、OOM / 性能问题、block_table / slot_mapping 构造。支持框架部署与独立部署两种模式。/model-infer-migrator基于 PyTorch 框架的昇腾 NPU 模型推理适配与部署基线技能。支持两种部署模式:框架部署模式(接入 cann-recipes-infer 的 executor/core/)和独立部署模式(自管 Runner 不依赖框架)。从 HF 链接或本地代码适配为可运行的标准模型目录,并采集性能基线。触发场景:新模型适配到昇腾 NPU 推理框架、已有模型的部署基线采集、模型迁移和初始跑通验证。/model-infer-multi-streamNPU 多流技术知识技能。提供整网模块 / 算子 DAG 拆解、模块间与模块内并行性判断、多流候选编排派生、TorchAir(Ascend IR/GE) 与 npugraph_ex/aclgraph 的多流 API 路由、切流 / 同步 / 控核实现,以及假并行(overlap_pct)排查与 Profile 验证等技术规则。供两类工作引用:形成多流优化候选 plan,以及实施 / review 多流改造。触发场景包括:多流、双流、stream overlap、控核、limit_core_num、整网 DAG、模块拆解、npu_stream_switch、npu_wait_tensor、TorchAir 多流、record_stream、多流假并行排查。本技能只提供多流技术规则,不做 Plan / round 编排。/model-infer-parallel-analysis基于 PyTorch 框架的昇腾 NPU 模型推理并行策略分析技能。分析模型架构参数和昇腾硬件规格,推荐最优的 TP/EP/DP 并行配置(parallel_config)。触发场景:新模型需要确定并行策略、现有配置需要优化、部署卡数或硬件变更后需要重新评估。输出为结构化的 parallel_config 推荐及定量依据。2 plugins ship this exact skill · first indexed Oct 20, 2026
Other plugins' skills for the same job