aclgraph-dev

Develops and tunes NPUGraph static capture and replay for batched NPU inference dispatch.

14|5|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Ascend/MindIE-SD --skill aclgraph-dev-ascend
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: aclgraph-dev
Source: https://github.com/Ascend/MindIE-SD/tree/main/.agents/skills/aclgraph-dev
Command: npx skills add https://github.com/Ascend/MindIE-SD --skill aclgraph-dev-ascend

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch_npu, mindiesd.

What problem does it solve? Host-side operator launch overhead slows down static-shape NPU inference, and developers struggle to correctly configure, combine, and debug NPUGraph-based batched graph dispatch in the mindiesd compilation stack. ## Core Features & Use Cases - NPUGraph Static Capture & Replay: Guides use of torch.npu.NPUGraph, graph pools, lazy capture, and a dedicated copy stream with event pipeline to eliminate per-step host launch overhead. - Configuration Routing: Explains CompilationConfig switches (aclgraph_only, aclgraph_with_compile, aclgraph_lazy_capture, aclgraph_max_entries, safe_output_mode) and how they interact with pattern/Inductor compilation. - Mismatch Debugging: Diagnoses replay-time input shape/dtype validation errors, address drift warnings, and FIFO entry eviction behavior. - Use Case: A team running fixed-resolution, large-batch image generation on Ascend NPUs enables aclgraph_with_compile to stack pattern fusion gains with graph replay, then resolves an "ACLGraph input mismatch" error by stabilizing input shapes. ## Quick Start Ask the assistant to enable NPUGraph batched dispatch for a static-shape model by setting CompilationConfig.aclgraph_with_compile and compiling with MindieSDBackend.

Frequently Asked Questions about aclgraph-dev

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

FAQPage Schema
How do I reduce host launch overhead for NPU inference with torch_npu?

Use NPUGraph static capture and replay through the mindiesd aclgraph backend. Set CompilationConfig.aclgraph_only or aclgraph_with_compile to True and compile the model with MindieSDBackend, which captures the operator sequence once and replays it without per-step host launches.

How do I combine pattern fusion with NPUGraph capture in mindiesd?

Set CompilationConfig.aclgraph_with_compile to True so MindieSDBackend.compile() runs pattern fusion first, then NPUGraph capture wraps the compiled graph. If aclgraph_only is set instead, compilation is skipped and capture applies to the original graph.

Why does NPUGraph replay fail with ACLGraph input mismatch?

The mismatch error means a replay input's shape or dtype differs from what was captured, since entries are cached per input shape. Keep input shapes stable, allow a new capture for the new shape, or disable aclgraph for dynamic-shape models.

Does aclgraph work with dynamic shape models?

No, aclgraph requires static input shapes and dtypes. Shape changes trigger a costly new capture or a validation failure at replay, so dynamic sequence length or resolution workloads should use the default Inductor backend instead.

What happens when torch_npu NPUGraph APIs are unavailable?

The backend checks npu_graph_available by verifying torch.npu.NPUGraph and torch.npu.graph both exist. If either is missing, the aclgraph switches are automatically disabled and execution falls back to the default aot_autograd plus Inductor path.

What is the difference between aclgraph-dev and pattern-dev skills?

aclgraph-dev covers NPUGraph batched dispatch: capture, graph pools, replay, and input validation. pattern-dev covers pattern matcher registration and Inductor codegen in the default backend. They connect through the aclgraph_only and aclgraph_with_compile switches.