MCPInstall

huawei-cloud-ascendc-operator-performance-optim

Develop and optimize custom operators using AscendC programming language. Analyze operator performance bottlenecks and conduct optimization validation. Based on AscendC and CANN toolkit Use this skill when the user wants to: (1) optimize performance-critical operators on Ascend NPU, (2) develop custom operators for specific workloads, (3) improve model inference performance through operator optimization Trigger: user mentions "AscendC", "operator optimization", "custom operator", "performance", "NPU optimization", "Ascend operator", "算子优化", "自定义算子", "算子开发", "AscendC算子", "性能优化"

Installs
212
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-ascendc-operator-performance-optim
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads huawei-cloud-ascendc-operator-performance-optim automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Huawei Cloud AscendC Operator Performance Optimization

Overview

This skill provides guidance for developing and optimizing custom operators using AscendC programming language.

Architecture: Performance Analysis → Bottleneck Identification → Operator Development → Optimization → Validation

Related Skills:

  • huawei-cloud-ascend-profiler-db-explorer - Performance data analysis and bottleneck identification
  • huawei-cloud-ascend-small-model-migrate - Migration workflow that may require operator optimization

Architecture Components

This skill involves the following cloud services and components:

  • AscendC: Programming language for custom operator development
  • CANN: Huawei Cloud AI Computing Platform for NPU
  • Ascend 910B: Target NPU hardware for operator deployment
  • Ascend Profiler: Performance analysis tool for validation

Architecture Diagram:

┌─────────────────────────────────────────────────────────────┐
│            AscendC Operator Optimization Skill             │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐ │
│  │  Performance │───▶│  Bottleneck  │───▶│  Operator    │ │
│  │  Analysis    │    │  Identification│   │  Development │ │
│  └──────────────┘    └──────────────┘    └──────────────┘ │
│         │                   │                   │          │
│         ▼                   ▼                   ▼          │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐ │
│  │  Profiling   │    │  Optimization│    │  Validation │ │
│  │  Data        │    │  Techniques  │    │  & Testing  │ │
│  └──────────────┘    └──────────────┘    └──────────────┘ │
└─────────────────────────────────────────────────────────────┘

Use Cases

Typical Problem Scenarios:

  • Optimizing performance-critical operators on Ascend NPU
  • Developing custom operators for specific workloads
  • Improving model inference performance through operator optimization
  • Fixing operator bottlenecks identified during profiling
  • Implementing missing operators for NPU deployment

Typical User Phrases:

  • "Optimize my custom operator for Ascend"
  • "Develop AscendC operator for GEMM"
  • "Improve inference performance on NPU"
  • "Fix bottleneck operator"
  • "Implement custom operator using AscendC"
  • "AscendCOperator"
  • "OptimizationAscendOperatorPerformance"
  • "OperatorPerformance"

Scope

Supported:

  • Custom operator development in AscendC
  • Performance optimization for existing operators
  • Operator validation and testing

Not supported:

  • Non-AscendC operator development
  • Framework-level optimizations

Core Workflow

1. Performance Analysis

  • Use profiling tools to identify performance bottlenecks
  • Analyze operator execution time and resource utilization

2. Bottleneck Identification

  • Identify operators with high execution time
  • Determine optimization opportunities

3. Operator Development

  • Implement custom operators using AscendC
  • Follow AscendC best practices

4. Optimization Techniques

  • Memory optimization
  • Compute optimization
  • Data layout optimization

5. Validation

  • Verify functional correctness
  • Validate performance improvement

Reference Documents

DocumentDescription
Acceptance CriteriaFunctional acceptance criteria
Verification MethodVerification approach
TroubleshootingCommon issues and solutions

Prerequisites

  • CANN >= 7.0.0 installed
  • AscendC >= 1.0.0 installed
  • Ascend NPU driver installed and working properly
  • Operator code or performance data to be optimized

Core Commands

# Analyze operator performance bottlenecks
msprof --output=/path/to/output ./my_operator

# Optimize operator using AscendC
# Refer to CANN development guide for operator development

Parameter Confirmation

ParameterDescriptionRequired
Operator code pathOperator source code to be optimizedYes
Output directoryPerformance analysis result output pathYes
Optimization strategyPerformance optimization scheme selectionNo

Output Format

Performance analysis results are saved in the specified output directory:

output/
├── summary.json           # Performance summary
├── operator_stats.csv     # Operator execution statistics
├── timeline.json          # Execution timeline data
└── recommendations.md     # Optimization recommendations

Summary JSON Structure:

{
  "total_time_ms": 1234.56,
  "operator_count": 42,
  "top_operators": [
    {"name": "CustomGEMM", "time_ms": 456.78, "percentage": 37.0},
    {"name": "VectorAdd", "time_ms": 123.45, "percentage": 10.0}
  ],
  "optimization_candidates": ["CustomGEMM", "DataTransfer"]
}

Validation Method

Functional Validation

  1. Run operator with test inputs
  2. Compare outputs with reference implementation
  3. Verify numerical accuracy (tolerance: 1e-5 for FP32, 1e-3 for FP16)

Performance Validation

  1. Benchmark operator before optimization
  2. Apply optimization changes
  3. Benchmark operator after optimization
  4. Calculate speedup ratio: speedup = time_before / time_after

Acceptance Criteria

  • Functional correctness: Output matches reference within tolerance
  • Performance improvement: Speedup >= 1.2x (20% improvement)
  • No regression: Other operators not affected

Best Practices

Memory Optimization

  • Use GM (Global Memory) for large tensors
  • Use L1/L0A/L0B for intermediate results in matrix operations
  • Align memory access to 32-byte boundaries
  • Reuse memory buffers when possible

Compute Optimization

  • Vectorize operations using AscendC intrinsics
  • Use MMA (Matrix Multiply Accumulate) for matrix operations
  • Parallelize independent operations
  • Minimize synchronization points

Data Layout Optimization

  • Use NZ format for matrix operations
  • Use ND format for vector operations
  • Avoid unnecessary format conversions
  • Consider memory coalescing for data access

Code Structure

  • Separate compute logic from memory operations
  • Use template metaprogramming for flexibility
  • Document optimization assumptions
  • Profile before and after each optimization

Notes

Common Pitfalls

  • Memory bank conflicts: Ensure data is distributed across memory banks
  • Unaligned access: Check 32-byte alignment for all buffers
  • Excessive synchronization: Minimize barrier usage between kernels
  • Wrong data format: Match format to operation type (NZ for matmul, ND for vector)

Performance Tips

  1. Profile first to identify real bottlenecks
  2. Focus on hot paths (operators with >10% total time)
  3. Consider algorithmic changes before micro-optimizations
  4. Test with realistic input sizes
  5. Validate correctness after each optimization

Debugging Tips

  • Use ASCENDC_DEBUG=1 for verbose logging
  • Check CANN log files in /var/log/npu/
  • Compare with CPU reference implementation
  • Use msprof for detailed performance breakdown

Limitations

  • AscendC operators are hardware-specific (910B)
  • Not all PyTorch operators have AscendC equivalents
  • Custom operators require CANN recompilation for deployment

FAQ

What does the huawei-cloud-ascendc-operator-performance-optim skill do?

Develop and optimize custom operators using AscendC programming language. Analyze operator performance bottlenecks and conduct optimization validation. Based on AscendC and CANN toolkit Use this skill when the user wants to: (1) optimize performance-critical operators on Ascend NPU, (2) develop custom operators for specific workloads, (3) improve model inference performance through operator optimization Trigger: user mentions "AscendC", "operator optimization", "custom operator", "performance", "NPU optimization", "Ascend operator", "算子优化", "自定义算子", "算子开发", "AscendC算子", "性能优化"

How do I install huawei-cloud-ascendc-operator-performance-optim?

Run npx skills add https://github.com/huaweicloud/huaweicloud-skills --skill huawei-cloud-ascendc-operator-performance-optim in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/huawei-cloud-ascendc-operator-performance-optim/ (personal) or .claude/skills/huawei-cloud-ascendc-operator-performance-optim/ (project).

Which AI agents can use huawei-cloud-ascendc-operator-performance-optim?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is huawei-cloud-ascendc-operator-performance-optim safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains huawei-cloud-ascendc-operator-performance-optim?

It is published by huaweicloud in huaweicloud/huaweicloud-skills. It has 212 recorded installs.

More from huaweicloud/huaweicloud-skills

View all →

huawei-cloud-terraform-installer

huaweicloud/huaweicloud-skills

Installs Terraform CLI cross-platform with Huawei Cloud mirror support. Use this skill whenever the user mentions installing Terraform, setting up Terraform environment, or when IaC tasks detect missing Terraform. Trigger: install terraform, setup terraform, terraform environment, huaweicloud provider.

DevOps & Cloud17.5K installs

huawei-cloud-find-skills

huaweicloud/huaweicloud-skills

Invoke this skill to search, list, query, discover, browse, find and install any Huawei Cloud (华为云) agent skill. Triggers include: "华为云", "华为云有什么skill", "华为云相关skill", "华为云agent skill 市场", "华为云skill类目", "explore Huawei Cloud skills", "show Huawei Cloud skill categories", "does a Huawei Cloud skill exist for...", "which Huawei Cloud skills exist", "搜索华为云技能", "查询华为云skill列表", "有没有管理ECS/OBS/RDS的skill", "帮我找 XX 华为云skill", "介绍 XX Skill 内容", "华为云 XX Skill 具体做什么", "安装华为云Skill".

17.3K installs

huawei-cloud-billing-scout

huaweicloud/huaweicloud-skills

Huawei Cloud BSS billing (not AWS/Azure/other clouds; refuses pricing quotes, real-name review, and any non-billing scope): balance, spend, attribution, reconciliation, coupons, stored-value cards, enterprise/partner billing. One-page briefing via hcloud. Use only when the user explicitly mentions 华为云 / Huawei Cloud / BSS and 余额/账单/对账/资源包/代金券/储值卡/企业或伙伴账务; refuses pay, renew, refund, delete.

DevOps & Cloud17.2K installs

huawei-cloud-computing-query

huaweicloud/huaweicloud-skills

Queries Huawei Cloud computing resources (ECS/BMS/IMS/AS), Covers ECS instances, flavors, keypairs, quotas, server groups, block devices, NICs, VNC console, BMS bare metal servers/flavors/quotas, IMS images/OS versions/members/quotas, and AS scaling groups/configs/policies/activity logs/lifecycle hooks/warm pools/quotas. No write operations. Use this skill when the user needs to query ECS instance details, list flavors, check BMS availability, browse images, or view auto-scaling group/policy status. Triggers: 弹性云服务器, ECS, 裸金属, BMS, 镜像, IMS, 弹性伸缩, AS, 伸缩组, 伸缩策略, 规格查询, flavor, instance, image, scaling.

Media & Creative17.1K installs

huawei-cloud-obs-upload

huaweicloud/huaweicloud-skills

Upload local files or directories to Huawei Cloud OBS (Object Storage Service) buckets, list OBS buckets with capacity and object count, and schedule periodic uploads via crontab. Use this skill when the user wants to: (1) upload a local file or directory to an OBS bucket, (2) list OBS buckets and check their storage capacity and object count, (3) set up a scheduled/periodic upload task to automatically sync a local directory to an OBS bucket. Triggers include: user mentions "OBS", "object storage", "bucket list", "bucket capacity", "upload to OBS", "upload file", "upload directory", "scheduled upload", "periodic upload", "sync to bucket", "对象存储", "桶列表", "桶容量", "上传文件", "上传目录", "定时上传", "OBS管理"

huawei-cloud-terraform-generator

huaweicloud/huaweicloud-skills

Generate Huawei Cloud Terraform configurations and execute deployment with user-guided approval. Use this skill when users want to create Huawei Cloud infrastructure as Terraform, whether they ask explicitly for Terraform or describe goals such as deploying a website, launching an application, or creating network, compute, database, load balancing, or storage resources. Trigger when users mention 创建/create、生成/generate、部署/deploy、配置/configure、使用/use、管理/manage、华为云/Huawei Cloud、Terraform、ECS、VPC、资源/resource、云服务器/ECS、虚拟机/VM、实例/instance、网络/network、负载均衡/ELB、数据库/database、RDS、存储/storage、OBS、桶/bucket、域名/domain、DNS、证书/certificate、SSL、监控/monitoring、日志/log、备份/backup、容器/container、CCE、函数工作流/FunctionGraph

DevOps & Cloud17.1K installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.