Logo: Huawei Cloud Ascendc Operator Performance Optim

Huawei Cloud Ascendc Operator Performance Optim

Organisatioun
huaweicloud
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算子", "性能优化"

Iwwersiicht

Editeurhuaweicloud
Repositoryhuaweicloud-skills
Skill-Nummhuawei-cloud-ascendc-operator-performance-optim
Stären
59
Forks
24
Matgeliwwert Dateien
20
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 20 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    huaweicloud huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Huawei Cloud Ascendc Operator Performance Optim an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/ai/modelarts/huawei-cloud-ascendc-operator-performance-optim
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/huaweicloud/huaweicloud-skills.git /tmp/huaweicloud-skills
mkdir -p .claude/skills
cp -r /tmp/huaweicloud-skills/skills/ai/modelarts/huawei-cloud-ascendc-operator-performance-optim .claude/skills/huawei-cloud-ascendc-operator-performance-optim
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Huawei Cloud Ascendc Operator Performance Optim an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Huawei Cloud Ascendc Operator Performance Optim automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Huawei Cloud Ascendc Operator Performance Optim net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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

bash
# 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:

json
{
  "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

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill 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算子", "性能优化"

Firwat Huawei Cloud Ascendc Operator Performance Optim op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Huawei Cloud Ascendc Operator Performance Optim besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Huawei Cloud Ascendc Operator Performance Optim an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/huaweicloud/huaweicloud-skills/tree/master/skills/ai/modelarts/huawei-cloud-ascendc-operator-performance-optim an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Huawei Cloud Ascendc Operator Performance Optim benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Huawei Cloud Ascendc Operator Performance Optim benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Huawei Cloud Ascendc Operator Performance Optim domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Huawei Cloud Ascendc Operator Performance Optim gratis?

Jo. huaweicloud huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇