Atb Aclnn Operator Migration logo

Atb Aclnn Operator Migration

Organization
Ascend
atb-aclnn-operator-migration

自动执行 ATB 算子到 ACLNN 的迁移操作,在 910B/950 设备上启用 ACLNN 加速。 支持参数映射、ACLNN Runner 实现、设备检测切换和功能/性能验证全流程。

Overview

PublisherAscend
Repositoryagent-skills
Skill nameatb-aclnn-operator-migration
Stars
54
Forks
4
Bundled files
Instructions only
LicenseMulanPSL-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Ascend on GitHub. Read the source before you install it.

Installation

Install the Atb Aclnn Operator Migration AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Ascend/agent-skills/tree/master/skills/ascend-transformer-boost/skills/atb-aclnn-operator-migration
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Ascend/agent-skills.git /tmp/agent-skills
mkdir -p .claude/skills
cp -r /tmp/agent-skills/skills/ascend-transformer-boost/skills/atb-aclnn-operator-migration .claude/skills/atb-aclnn-operator-migration
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Atb Aclnn Operator Migration in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Atb Aclnn Operator Migration on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Atb Aclnn Operator Migration is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

ATB到ACLNN算子迁移工具

功能概述

该工具帮助开发者将ATB中的算子迁移到ACLNN实现,特别是在 910B/950 设备上获得更好的兼容性优化。

调用时机

在以下情况下调用此技能:

  • 用户需要将 ATB 算子迁移到 ACLNN 实现以提升 910B/950 设备性能
  • 用户已生成算子替换设计文档(建议先运行 atb-aclnn-operator-replacement-designer)
  • 用户需要在 ATB 源码上应用 ACLNN Runner 改造

⚠️ 路径约束(必须执行)

执行此技能前,必须从用户处获取以下路径:

  • <CANN_PATH>: CANN 安装路径(如 /usr/local/Ascend/ascend-toolkit/latest)
  • <ATB_REPO_PATH>: ATB 仓库路径(如 {your working path}ascend-transformer-boost)

若用户未提供或路径无效,立即停止并报错。


前置条件

  • CANN 环境已安装(ASCEND_TOOLKIT_HOME 已设置)
  • ATB 源码仓库已克隆至本地
  • 算子对应的 ATB 接口文档和 ACLNN 接口文档已获取
  • 建议已完成 atb-aclnn-operator-replacement-designer 生成设计文档

每个操作步骤末尾的 检查点 标记了验证标准。执行完成后请在 执行结果 章节填写实际状态。

检查点 ID描述验证命令
Step0-ENVCANN 环境 sourcedecho $ASCEND_TOOLKIT_HOME
Step0-DIRATB 源码目录存在[ -d <ATB_REPO_PATH> ]
Step1-DIR原有 Operation 源文件定位ls <op>_operation.cpp
Step1-DIR现有 ACLNN runner 参考定位ls softmax_aclnn_runner.cpp
Step2-FILE<op>_aclnn_runner.h 创建[ -f <op>_aclnn_runner.h ]
Step2-FILE<op>_aclnn_runner.cpp 创建[ -f <op>_aclnn_runner.cpp ]
Step2-CODEBuildAclnnVariantPack 实现grep "BuildAclnnVariantPack" <op>_aclnn_runner.cpp
Step2-CODESetAclNNWorkspaceExecutor 实现grep "SetAclNNWorkspaceExecutor" <op>_aclnn_runner.cpp
Step2-CODELaunchAclnnKernel 实现grep "LaunchAclnnKernel" <op>_aclnn_runner.cpp
Step2-CODELoadMethod 实现grep "LoadMethod" <op>_aclnn_runner.cpp
Step3-MODCreateRunner 包含 910B/950 分支grep "Is910B|Is950|910B|950" <op>_operation.cpp
Step4-BUILD编译成功无错误make ... 2>&1
Step5-TEST非 910B/950 设备功能正常./apitest ...

迁移步骤

步骤1: 分析ATB算子实现

  1. 理解ATB算子参数结构

    • 查看 infer_op_params.h 中的参数结构
    • 确认参数类型和约束
  2. 分析现有实现

    • 查看 <operator>_operation.cpp 了解操作逻辑
    • 分析 <operator>_ops_runner.cpp 了解现有runner实现
  3. 研究ACLNN接口

    • 了解对应ACLNN算子的接口
    • 分析参数映射关系

步骤2: 创建ACLNN Runner

  1. 创建头文件 (<operator>_aclnn_runner.h)

    • 继承自 AclnnRunner 基类
    • 定义必要的成员变量和方法
    • 声明ACLNN函数指针
  2. 实现源文件 (<operator>_aclnn_runner.cpp)

    • 实现 BuildAclnnVariantPack 方法处理张量转换
    • 实现 SetAclNNWorkspaceExecutor 方法配置工作空间
    • 实现 LaunchAclnnKernel 方法执行计算
    • 实现 LoadMethod 方法动态加载ACLNN函数

步骤3: 修改Operation实现

  1. 更新头文件包含

    • 添加 #include "<operator>_aclnn_runner.h"
  2. 修改CreateRunner方法

    • 添加设备检测逻辑
    • 在910B/950设备上使用 <Operator>AclnnRunner
    • 在其他设备上保持原有 <Operator>OpsRunner
  3. 更新设备支持

    • 修改 CreateOperation 函数
    • 支持910B/950训练设备
    • 保持对其他设备的支持

步骤4: 构建和验证

  1. 编译验证

    • 确保代码通过编译
    • 检查是否有编译错误或警告
  2. 功能验证

    • 在910B/950设备上验证ACLNN实现
    • 在其他设备上验证原有实现
    • 确保功能正确性
  3. 性能验证

    • 对比ATB和ACLNN实现的性能
    • 确保在910B/950设备上获得性能提升

核心实现

  1. 参数映射

    • ATB参数到ACLNN参数的映射
    • 处理输入输出张量的转换
  2. 设备检测

    • 使用 GetSingleton<Config>().Is910B() 检测 910B 设备类型
    • 使用 GetSingleton<Config>().Is950() 检测 950 设备类型
    • 根据设备类型选择合适的 runner
  3. 内存管理

    • 自动管理ACLNN工作空间
    • 合理处理张量数据指针
  4. 错误处理

    • 完善的日志记录
    • 错误码处理和返回

性能优化

  1. ACLNN加速

    • 利用ACLNN的硬件优化
    • 减少内存访问开销
  2. 条件编译

    • 根据设备类型选择最优实现
    • 保持代码兼容性

注意事项

  1. 设备兼容性

    • 确保在不同设备上的正确运行
    • 处理设备特定的参数和约束
  2. 接口一致性

    • 保持原有ATB接口不变
    • 确保上层应用无需修改
  3. 测试覆盖

    • 编写针对不同设备的测试用例
    • 验证性能和功能正确性
  4. 错误处理

    • 完善的错误处理机制
    • 详细的日志记录

示例使用

步骤1: 准备环境

bash
# 确保CANN环境正确配置
# 确保ATB代码库已更新

步骤2: 应用迁移

bash
# 在ATB代码库中应用迁移
git apply <operator>_aclnn_migration.patch

步骤3: 编译验证

bash
# 编译ATB代码
cd ascend-transformer-boost
mkdir build && cd build
cmake ..
make -j

步骤4: 功能测试

bash
# 运行算子测试
./tests/apitest/opstest/python/operations/<operator>/test_<operator>.py

步骤5: 性能测试

bash
# 对比ATB和ACLNN实现的性能
python performance_benchmark.py

Q: 编译失败怎么办?

A: 检查CANN版本是否兼容,确保ACLNN接口可用。

Q: 910B/950设备上性能没有提升?

A: 检查ACLNN函数是否正确加载,验证工作空间配置。

Q: 其他设备上功能异常?

A: 确保设备检测逻辑正确,验证原有实现未受影响。

总结

通过该工具,开发者可以轻松将ATB算子迁移到ACLNN实现,在910B/950设备上获得更好的性能,同时保持对其他设备的兼容性。该实现遵循项目代码规范,与现有ACLNN runner实现保持一致,确保代码质量和可维护性。

执行结果

⚠️ 执行后填写:技能执行完成后,参照下方格式填写实际执行结果。

检查点检查表

步骤检查点描述状态
1ATB 源码目录存在✅ PASS / ❌ FAIL / ⏭️ SKIP
1原有 Operation 源文件定位✅ PASS / ❌ FAIL / ⏭️ SKIP
1现有 ACLNN runner 参考定位✅ PASS / ❌ FAIL / ⏭️ SKIP
2<op>_aclnn_runner.h 创建✅ PASS / ❌ FAIL / ⏭️ SKIP
2<op>_aclnn_runner.cpp 创建✅ PASS / ❌ FAIL / ⏭️ SKIP
2BuildAclnnVariantPack 实现✅ PASS / ❌ FAIL / ⏭️ SKIP
2SetAclNNWorkspaceExecutor 实现✅ PASS / ❌ FAIL / ⏭️ SKIP
2LaunchAclnnKernel 实现✅ PASS / ❌ FAIL / ⏭️ SKIP
2LoadMethod 实现✅ PASS / ❌ FAIL / ⏭️ SKIP
3CreateRunner 包含 910B/950 分支✅ PASS / ❌ FAIL / ⏭️ SKIP
4编译成功✅ PASS / ❌ FAIL / ⏭️ SKIP
5非 910B/950 设备功能正常✅ PASS / ❌ FAIL / ⏭️ SKIP
5910B 设备 ACLNN 路径正常✅ PASS / ❌ FAIL / ⏭️ SKIP
5950 设备 ACLNN 路径正常✅ PASS / ❌ FAIL / ⏭️ SKIP

VERDICT: ✅ SUCCESS / ⚠️ PARTIAL / ❌ FAILED / ⏭️ SKIPPED

问题列表(若有)

等级检查点问题描述建议
🔴 CRITICAL---
🟡 WARNING---

执行摘要

  • 执行时间:
  • 执行环境:
  • 算子名称:
  • 持续时间:
  • 通过率:

Frequently asked questions

What does the Atb Aclnn Operator Migration AI skill do?

自动执行 ATB 算子到 ACLNN 的迁移操作,在 910B/950 设备上启用 ACLNN 加速。 支持参数映射、ACLNN Runner 实现、设备检测切换和功能/性能验证全流程。

Why use Atb Aclnn Operator Migration on TypingMind?

Because you install it once and use it with any model. Atb Aclnn Operator Migration is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Atb Aclnn Operator Migration in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Ascend/agent-skills/tree/master/skills/ascend-transformer-boost/skills/atb-aclnn-operator-migration. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Atb Aclnn Operator Migration?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Atb Aclnn Operator Migration?

As many as you like. As long as a model supports skills, you can use Atb Aclnn Operator Migration with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Atb Aclnn Operator Migration AI skill free?

Yes. It is published on GitHub by Ascend under the MulanPSL-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇