一键导入
ascendc-registry-to-direct-invoke
把注册式 AscendC 算子迁移为 direct-invoke 工程的保真原则:kernel 算法和 tiling 公式不乱改,只替换注册框架胶水、入口 ABI、host launch 与 PyTorch extension。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
把注册式 AscendC 算子迁移为 direct-invoke 工程的保真原则:kernel 算法和 tiling 公式不乱改,只替换注册框架胶水、入口 ABI、host launch 与 PyTorch extension。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
AscendC direct-invoke 崩溃/挂起修复索引:Kernel timeout、hang、Segmentation Fault、aic error、buffer 死锁、plog/memcheck 调试。
AscendC direct-invoke 精度失败修复索引:输出全 0/随机值、DataCopy 对齐、EnQue/DeQue 同步、FP16/FP32 精度、Cast RoundMode、DumpTensor 分段定位。
AscendC direct-invoke 工程契约:WA 使用 kernel.py + ascendc_op/,ModelNew 调用 torch.ops.npu.*,adapter 负责复制工程、CMake 构建和 npu-arch patch。适用于 dsl=ascendc 的 autoresearch 任务。
CATLASS TileShape 与 on-chip 缓存容量约束:L1/L0A/L0B/L0C 预算公式、fp16/fp32 Pingpong 双缓冲、512B 对齐与排布对 Tile 选型的影响。调参前必读。
CATLASS Gemm 性能调优:DispatchPolicy、Tile 与分核负载均衡、Swizzle、何时用 padding/Split-K/Preload。面向 AR 修改 catlass_kernel.asc 中的类型别名。
CPU C++ 算子核心概念、标准结构模式、KernelBench 代码规范和内嵌扩展方法
| name | ascendc-registry-to-direct-invoke |
| description | 把注册式 AscendC 算子迁移为 direct-invoke 工程的保真原则:kernel 算法和 tiling 公式不乱改,只替换注册框架胶水、入口 ABI、host launch 与 PyTorch extension。 |
Use this when an existing AscendC custom-operator or registry-invoke project
must be converted into the WA kernel.py + ascendc_op/ direct-invoke layout.
Only replace the registry framework glue. Preserve the kernel algorithm and tiling math unless the user explicitly asks for an algorithmic rewrite.
Do not "simplify" these while porting:
CopyIn, Compute, CopyOut, Process orderingAllowed changes are mechanical integration changes:
Preserve all formulas and branches:
Never merge "similar" branches just to reduce code. Tiling drift can compile cleanly and silently corrupt results.
The required direct-invoke glue is:
__global__ launcher with explicit argumentstorch.ops.npu.<op> and implement Meta functionkernel.py: lazy-load .so and call the registered op from ModelNew.forward()Registry macros such as these do not belong in direct-invoke WA seeds:
IMPL_OP_OPTILINGREGISTER_TILING_DATA_CLASSGET_TILING_DATA dispatch paths that depend on registry glueOP_LOG* macros that are not available in the direct projectReplace logging with throw std::runtime_error(...), printf, or Python-side
exceptions as appropriate.
For current-operator source files, copy whole files. For external shared helpers, copy the minimal symbol closure:
ascendc_op/After migration, rg '#include "\\.\\.' ascendc_op should be empty unless the
relative include stays inside the copied project tree by design.
AscendC .asc and -xasc style compilation may compile the same source in a
host pass and a device pass. If a kernel implementation header uses device-only
MicroAPI or RegBase types, guard the implementation body:
#if !defined(__NPU_HOST__)
// device-only kernel implementation
#endif
Do not guard pure POD tiling headers that are required by both host and device.
GM_ADDR / uint8_t* according to the launcher.kernel.py does not compile, mutate source, or choose a device at import time.--kernel points to ascendc_op/, with sibling kernel.py.