pypto-op-review

Reviews PyPTO custom operator kernels against layout requirements and extracts pypto call sites.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? When writing or debugging custom Ascend NPU operators with PyPTO, reviewers need a consistent checklist of structural rules and a fast way to enumerate every pypto.* call site for op-by-op debugging. This Skill provides both: the layout/structure requirements every custom/<operator>/ directory must satisfy, and a script that lists all PyPTO call sites by line number. ## Core Features & Use Cases - Structure checklist: Enforces rules such as the three-piece set (impl + golden + test_<op>.py), mandatory use of assert_allclose or detailed_tensor_compare, staged _module<k>_impl.py naming, no Python loops driving kernels from the host wrapper, pypto.view rank consistency, and set_cube_tile_shapes [L0, L1] validity with L1 % L0 == 0. - Call-site extraction: scripts/extract_pypto_calls.py parses a kernel file with the Python ast module and outputs every pypto. call (including aliased imports and from-imports) ordered by line number, with an optional --json mode. - Use Case: While debugging a failing custom operator kernel, run the extractor to get an ordered list of pypto calls, then step through them one by one against the API documentation and the structure checklist to locate the defect. ## Quick Start Ask the assistant to review the custom/<operator>/ directory against the PyPTO layout requirements and list all pypto call sites in the kernel file for op-by-op debugging.

Frequently Asked Questions about pypto-op-review

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

FAQPage Schema
How do I list all pypto call sites in a kernel file?

Run scripts/extract_pypto_calls.py with the kernel file path to get every pypto.* call ordered by line number, including aliased imports and from-imports. Add --json for machine-readable output suitable for op-by-op debugging logs.

What structure requirements must a custom operator directory satisfy?

Each custom/<operator>/ directory needs the impl, golden, and test_<op>.py trio, staged *_module<k>_impl.py naming, assertions via assert_allclose or detailed_tensor_compare, no Python loops driving the kernel from the host wrapper, and consistent pypto.view ranks.

What are valid set_cube_tile_shapes arguments in PyPTO?

Each of m, k, and n must be passed as [L0, L1] with 0 < L0 <= L1 and L1 % L0 == 0. Tile arguments must be compile-time integer literals, not computed expressions; for example m=[64,96] is invalid because 96 % 64 != 0.

Does the call extractor verify PyPTO API compliance?

No, the extractor only produces an ordered factual list of pypto.* call sites by line number. You must still check each call against the API documentation and the layout requirements for dtype, shape, tile, and write-back correctness.

Can pypto.view be used as a reshape with mismatched ranks?

No, pypto.view is not a reshape. The shape, offsets, and valid_shape arguments must all have matching ranks; matching total element counts does not satisfy the rank contract and counts as a structural defect.