pypto-precision-compare

Diagnose PyPTO operator precision issues using tensor graph verification, Pass checks, and binary search.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, pandas, and includes scripts (resource) components.

What problem does it solve? When a PyPTO operator's output deviates from its PyTorch golden reference, developers struggle to locate which op, Pass, or codegen stage introduced the numerical error. This Skill provides a structured decision tree and three complementary comparison methods to pinpoint the exact source of precision divergence on Ascend NPU. ## Core Features & Use Cases - Tensor Graph Verification: Configures verify_options and set_verify_golden_data to detect frontend graph construction errors before deeper debugging. - Three Localization Methods: File-based checkpoint comparison (pypto.pass_verify_save + torch.save), Pass-level PreCheck/PostCheck validation with pass_compare.py, and on-device binary search using checkpoint tensors injected into kernel signatures. - Sync and VF Fusion Diagnosis: Includes scripts to bisect CCE files with pipe_barrier insertion and map failing lines back to frontend source code. - Use Case: An Add operator's NPU output mismatches torch.add results; the Skill walks through tensor_graph verification, then routes to the appropriate sub-method to find the first failing op. ## Quick Start Ask the assistant to debug a PyPTO operator precision issue using this skill, optionally specifying a mode such as file-save comparison, Pass verification, or on-device binary search.

Frequently Asked Questions about pypto-precision-compare

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

FAQPage Schema
How do I debug PyPTO operator precision issues on Ascend NPU?

Start by enabling tensor_graph verification with verify_options and set_verify_golden_data, then check interpreter.log. Based on the result, use file-based checkpoint comparison, Pass-level PreCheck/PostCheck validation, or on-device binary search to locate the first failing op.

What is the difference between pass_verify_save and binary search precision debugging?

pass_verify_save writes intermediate results to files compared against torch.save golden data without changing kernel signatures. Binary search adds checkpoint tensors as kernel input parameters for in-memory on-device comparison, used when tensor graph and Pass checks both pass.

How do I use pass_compare.py to find a failing op?

Run pass_compare.py with --p specifying the failed Pass and the previous passing golden Pass, plus --verify_path pointing to the verify data directory. It generates a CSV with per-op PASS/FAIL results identifying the problematic op.

Why is my PyPTO verify log empty after running the test?

Empty verify logs usually mean golden data was not set or the order was wrong. You must compute the golden on CPU, call pypto.set_verify_golden_data, and only then execute the PyPTO operator, with matching input and output counts.

What does error code 0xB4001U mean in PyPTO verification?

Error 0xB4001U indicates VERIFY_RESULT_MISMATCH, meaning a tensor graph or Pass verification failed. A tensor_graph failure points to frontend code issues, while a Pass-level failure requires PreCheck/PostCheck analysis with pass_compare.

When should I remove verify_options and golden data settings?

Remove verify_options from the @pypto.frontend.jit decorator and delete set_verify_golden_data calls immediately after obtaining tensor_graph results. Leaving diagnostic configuration in production code can interfere with subsequent debugging and normal execution.