pytorch avatar

Aoti Debug

When you're wrestling with AOTInductor segfaults or device mismatch errors, this skill walks you through the debugging process systematically. It covers the critical first check (compile device must match load device, input shapes and devices must align), then routes you through common failure modes like CUDA illegal memory access and Triton index issues. The environment variable reference table is legitimately useful. You get concrete flags like AOTI_RUNTIME_CHECK_INPUTS and PYTORCH_NO_CUDA_MEMORY_CACHING with clear explanations of when they take effect. This is the kind of reference you want open in a terminal while debugging a production AOTI crash at 2am, not general advice about compilation.

skills.sh installs
3.1K
GitHub stars
105.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add pytorch/pytorch --skill aoti-debug --agent claude-code

Installs into .claude/skills of the current project.

Files

AOTI Debugging Guide

This skill helps diagnose and fix common AOTInductor issues.

Error Pattern Routing

Check the error message and route to the appropriate sub-guide:

Triton Index Out of Bounds

If the error matches this pattern:

Assertion `index out of bounds: 0 <= tmpN < ksM` failed

→ Follow the guide in triton-index-out-of-bounds.md

All Other Errors

Continue with the sections below.


First Step: Always Check Device and Shape Matching

For ANY AOTI error (segfault, exception, crash, wrong output), ALWAYS check these first:

  1. Compile device == Load device: The model must be loaded on the same device type it was compiled on
  2. Input devices match: Runtime inputs must be on the same device as the compiled model
  3. Input shapes match: Runtime input shapes must match the shapes used during compilation (or satisfy dynamic shape constraints)
# During compilation - note the device and shapes
model = MyModel().eval()           # What device? CPU or .cuda()?
inp = torch.randn(2, 10)           # What device? What shape?
compiled_so = torch._inductor.aot_compile(model, (inp,))

Sponsors

Details

Repository
github.com/pytorch/pytorch
Categories
Data Science & ML, Debugging
First seen
May 16, 2026

More from pytorch/pytorch

All 10
1lignertys avatarreddapilignertys/reddit-research-skillreddapi2.8Kskills.sh installs
2antvis avatarinfographic-creatorantvis/chart-visualization-skillsCreate beautiful infographics based on given text content. Use when users request to create infographics.2.3Kskills.sh installs
3lingzhi227 avatarbackward-traceabilitylingzhi227/agent-research-skillsMake every number in the final PDF traceable to the exact code line that produced it. Uses \hypertarget/\hyperlink LaTeX commands and \num{formula} evaluated at2.3Kskills.sh installs
4lingzhi227 avatarcitation-managementlingzhi227/agent-research-skillsManage BibTeX citations for LaTeX papers. Harvest missing citations from a draft using Semantic Scholar, validate cite keys against .bib files, deduplicate entr2.2Kskills.sh installs
5lingzhi227 avatardata-analysislingzhi227/agent-research-skillsGenerate statistical analysis code with 4-round review. Select appropriate statistical tests, interpret results, and produce analysis reports with p-values, eff2Kskills.sh installs
6lingzhi227 avataridea-generationlingzhi227/agent-research-skillsGenerate novel research ideas with iterative refinement and novelty checking against literature. Score ideas on Interestingness, Feasibility, and Novelty. Use w1.9Kskills.sh installs