ascendc-code-review

Reviews Ascend C operator code against coding standards, API rules, and red-line checks.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill ascendc-code-review-wangwindow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ascendc-code-review
Source: https://github.com/WangWindow/CANN-BatchMatMulMaxsum/tree/main/.agents/skills/ascendc-code-review
Command: npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill ascendc-code-review-wangwindow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Ascend C operator development on Ascend NPU hardware involves strict coding conventions, API alignment rules, synchronization pairing, and memory safety constraints that are easy to violate and hard to catch manually. This Skill automates structured code review of Ascend C kernels, Tiling code, and Host registration code against curated rule sets. ## Core Features & Use Cases - Multi-mode review workflows: Supports full file review, PR review, quick targeted checks, and design-consistency checks against DESIGN.md, routed through dedicated workflow definitions. - Rule-based inspection: Applies clause libraries covering API best practices (DataCopy alignment, AllocTensor/FreeTensor pairing, CrossCoreSetFlag symmetry), performance rules (double buffering, UB/L1 capacity limits, tail-block handling), red-line issues (division by zero, integer overflow, GM offset int64), and TOPK高频 problems. - Static analysis tooling: Ships a bounds-checking script that uses interval propagation to detect overflow, wraparound, and division-by-zero risks with counter-example generation. - Use Case: When submitting a PR to an Ascend operator repository (ops-transformer, ops-math, ops-nn, ops-cv), run a full PR review to automatically identify side (Kernel/Tiling/Host), extract applicable clauses, and verify each rule with hypothesis-driven evidence collection. ## Quick Start Ask the assistant to review your Ascend C operator code or a specific PR, for example by saying: review this Ascend C kernel file for correctness and performance issues.

Frequently Asked Questions about ascendc-code-review

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review Ascend C kernel code for common errors?

Invoke the skill with a file review request and it routes to the file-review workflow, which identifies the code side (Kernel, Tiling, or Host), extracts applicable clauses from the reference rule libraries, and checks each rule with evidence collection. Findings are reported with severity levels.

What coding rules does Ascend C code review check?

It checks API best practices (DataCopy 32-byte alignment, AllocTensor/FreeTensor pairing, CrossCoreSetFlag symmetry), performance rules (double buffering, UB/L1 capacity, tail-block handling), red-line issues (division by zero, integer overflow, int64 GM offsets), and TOPK高频 problems like unchecked return values.

Can it review a pull request in an Ascend operator repository?

Yes, PR review is a dedicated workflow triggered by PR references. It supports repositories such as ops-transformer, ops-math, ops-nn, and ops-cv, infers the repo from the PR URL, and automatically switches strategy for large PRs.

How does it detect integer overflow or division by zero in kernel code?

It uses a bundled static analysis script that performs interval propagation on arithmetic expressions. You provide the expression and variable ranges, and it reports overflow, wraparound, or division-by-zero risks with boundary counter-examples and sensitivity analysis.

Does the review cover deprecated CANN APIs?

Yes, the SUNSET clauses check for deprecated aclrt, aclnn, and acl.op APIs plus deprecated header paths and libraries. A script dynamically parses official deprecation documentation to generate the current sunset symbol list.

What are the limitations of this code review approach?

The bounds-checking script only analyzes arithmetic expressions for overflow, wraparound, and division by zero; it does not cover type conversion truncation or signed/unsigned comparison semantics. Rule checks also require consulting the latest Ascend C API documentation when clauses may be outdated.