SuperAPI AI Directory

external-cannbot-ops-ascendc-docs-search

Coding & development

View repository

Updated 10-15 17:19

About this skill

Ascend C Development Resources

Overview

This skill provides a "local-first, online-fallback" documentation search capability:

  • Local resources: 1022 API documents, 587 example code samples, implementation references
  • Online search: Huawei Ascend Community documentation search (used only when local resources are insufficient)

Official Resource Paths

Resource Type Path Description
API documentation asc-devkit/docs/api/context/ 1022 API documents
High-performance templates asc-devkit/examples/00_introduction/01_add/basic_api_memory_allocator_add/ Double buffering + pipeline standard implementation
Various examples asc-devkit/examples/00_introduction/ Addition, subtraction, multi-input, etc.
Complete documentation asc-devkit/docs/ Complete development documentation
Tiling implementation asc-devkit/impl/adv_api/tiling/ Tiling parameter configuration reference
Vector computation asc-devkit/examples/00_introduction/11_vectoradd/ Vector API usage
Debugging examples asc-devkit/examples/01_utilities/00_printf/printf.asc printf debugging methods

Material Search Priority

1. asc-devkit/docs/api/context/ (本地 API 文档 - 1022 个)
         ↓ 找不到
2. asc-devkit/examples/ (示例代码 - 587 个)
         ↓ 找不到
3. asc-devkit/impl/ (实现代码)
         ↓ 找不到
4. 在线搜索(华为昇腾社区)
   使用 scripts/ 中的 Python 脚本
   推荐版本:8.5.0(与当前环境一致)

⚠️ API Variant Search Guide (Important)

Problem: Ascend C has 240+ API variants with numeric suffixes(such as Add-25.md), and different variants of the same-named API may have completely different functions.

Typical cases:

  • Add.md - Base version
  • Add-25.md - Variant version (supports more features)

Mandatory search steps

  1. List all variants:

    # 搜索某个 API 的所有变体(将 APIName 替换为实际 API 名称)
    ls asc-devkit/docs/api/context/ | grep -iE "^APIName"
    
    # 示例:
    # APIName.md        ← 基础版本
    # APIName-25.md     ← 变体版本
    # APIName-91.md     ← 变体版本
    
  2. Confirm functions one by one: Each variant's function signature, parameters, and functionality may be completely different

Variant naming patterns

Suffix Meaning Example
No suffix Base version Add.md
-数字 Variant version (numbers have no semantics; functionality may be completely different) Add-25.md

Variant detection command

# 查找某个 API 的所有变体(强制,将 APIName 替换为实际名称)
ls asc-devkit/docs/api/context/ | grep -iE "^APIName"

# 在所有变体中搜索特定关键词
grep -l "关键词" asc-devkit/docs/api/context/APIName*.md

Environment Compatibility

Current environment: A3 server, CANN 8.5.0

When consulting materials, you must confirm that the API/method is applicable to the current environment.

Using Explore Agent

When to use:

  1. Looking up API documentation or implementation examples
  2. Understanding how a certain technical point is implemented
  3. Searching for reference implementations of similar operators
  4. Looking up relevant solutions when encountering errors
  5. Exploring better implementations after a solution works

How to use:

使用 Task 工具,subagent_type=Explore
提供明确的搜索目标和范围

Example prompts:

  • "Search for usage examples of the Exp API in asc-devkit"
  • "Find implementation references for double buffering"
  • "Search for similar trigonometric function operator implementations"

Example Code Index

Example Name Path Purpose
High-performance templates asc-devkit/examples/00_introduction/01_add/basic_api_memory_allocator_add/ Double buffering + pipeline
Multi-input addition asc-devkit/examples/00_introduction/04_addn/addn.asc Multi-input processing
Subtraction operator asc-devkit/examples/00_introduction/07_sub/sub_custom.asc Subtraction implementation
Debug printing asc-devkit/examples/01_utilities/00_printf/printf.asc printf debugging
Assertion usage asc-devkit/examples/01_utilities/01_assert/assert.asc Assertion example
Library functions asc-devkit/examples/03_libraries/00_addcdivcustom/addcdiv_custom.asc Library function usage
Vector computation asc-devkit/examples/00_introduction/11_vectoradd/vector_add_custom.asc Vector API

Online search

Applicable cases:

  • No relevant API can be found in the local context directory
  • More detailed official documentation or latest version information is needed
  • The local documentation version is too old or incomplete

Quick search:

# 基础搜索(推荐使用中文关键词)
python skills/ascendc-docs-search/scripts/ascend_search_client.py "Ascend C 临时内存申请" --max_results 5

# 搜索 API 文档
python skills/ascendc-docs-search/scripts/ascend_search_client.py "AscendC::Add 接口原型" --max_results 8

# 带版本过滤(推荐使用 8.5.0)
python skills/ascendc-docs-search/scripts/ascend_search_client.py "Ascend C API" --version "8.5.0"

Get detailed content:

python skills/ascendc-docs-search/scripts/ascend_content_fetcher.py <URL>

Parameter description:

  • keyword: Search keyword (required), Chinese is recommended
  • --max_results: Number of returned results (1-10, default 10)
  • --lang: Language setting (zh/en, default zh)
  • --version: Version filter string (e.g. "8.5.0")
  • --doc_type: Document type (DOC/API, default DOC)

Dependency installation:

pip install -r skills/ascendc-docs-search/requirements.txt

Reference materials