pypto-general-debug

Routes opaque PyPTO kernel failures to focused debug references and sub-skills.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? PyPTO kernel development on Ascend NPU often hits opaque errors (FFFFF, UNKNOWN, F21004), tile-shape violations, or silent precision failures that are hard to localize. This Skill provides a structured routing playbook so an agent converges on the root cause instead of randomly editing code. ## Core Features & Use Cases - Symptom-based routing: Maps failure situations (opaque error codes, L0/L1 budget overflows, tile alignment, set_cube_tile_shapes validation, SIM mode issues) through DEBUG_GUIDEBOOK.md to exactly one focused leaf reference file. - Op-by-op check protocol: Enumerates every pypto call with extract_pypto_calls.py, verifies each call site against official API docs, and uses checkpoint bisection for wrong-result bugs instead of commenting out code. - Sub-skill dispatch policy: Loads exactly one sub-skill at a time (pypto-precision-debug for accuracy mismatches, pypto-precision-compare for checkpoint bisection) with mandatory failure-history logging to MEMORY.md. - Use Case: A kernel fails with 'Errcode: F21004 tile shape not set' — the Skill routes to error-codes.md §4, which identifies the missing set_vec_tile_shapes call before vector ops. ## Quick Start Ask the agent to debug a stuck or failing PyPTO kernel and it will route the symptom through the debug guidebook to the matching reference.

Frequently Asked Questions about pypto-general-debug

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

FAQPage Schema
How do I debug a PyPTO kernel that fails with an opaque error code?

Capture the full device log by setting ASCEND_GLOBAL_LOG_LEVEL=0 and ASCEND_SLOG_PRINT_TO_STDOUT=1, then search result.log for ERROR blocks with context. Route the error code through the troubleshooting docs and the DEBUG_GUIDEBOOK symptom map to the matching leaf reference.

How to fix F21004 tile shape not set errors in PyPTO?

F21004 on REGISTER_COPY means no valid vector tile was set when the op was created. Call pypto.set_vec_tile_shapes with all positive integers at the start of the JIT function body, before any vector ops, and also set cube tile shapes when using matmul.

Should I comment out half the kernel to locate a wrong-result bug?

No. Disabling arbitrary pypto lines inside one fused JIT graph usually invalidates the graph or hides the real bug. Instead, stub whole modules, or insert intermediate checkpoints between call sites and binary-search the first diverging checkpoint.

Why does PyPTO SIM mode produce garbage values but NPU works?

SIM mode has fundamental limitations with dynamic shapes, cube tile configuration, and memory operations, so it cannot validate precision. Use SIM only for structural checks and always validate numerical correctness on real NPU hardware.

What causes L0A or L1 size exceeded errors in PyPTO matmul?

These occur when cube tile shapes violate buffer budgets: L0A holds mL0*kL0 elements, L0C holds mL0*nL0 in FP32, and L1 holds both A and B tiles at L1 granularity. Halve kL1 first for L1 overflows, or shrink the offending L0 axis while keeping L1 divisible by L0.

When should precision-debug versus precision-compare sub-skills be loaded?

Load pypto-precision-debug first when tensor comparison fails but the build succeeds, applying code-level workarounds. Only if precision still fails or the diverging checkpoint is unlocalized, unload it and load pypto-precision-compare for checkpoint bisection.