pytorch avatar

Aoti Debug

Systematic diagnosis guide for AOTInductor segfaults, device mismatches, and CUDA illegal memory access errors.

skills.sh installs
3.1K
GitHub stars
105.8K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers a first-step checklist: matching compile and load device types, input devices, and input shapes before deeper debugging
  • Includes routing for Triton index-out-of-bounds errors and a table of debug env vars like AOTI_RUNTIME_CHECK_INPUTS and CUDA_LAUNCH_BLOCKING
  • Enforces that AOTI compile and load share a device type, since cross-device loading (GPU to CPU) is unsupported
  • Designed for PyTorch users hitting AOTI crashes through aot_compile, aot_load, or aoti_load_package on CPU or CUDA

Install

$ npx -y skills add pytorch/pytorch --skill aoti-debug -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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,))

Details

Repository
github.com/pytorch/pytorch
Categories
Debugging, Python
First seen
May 16, 2026

More from pytorch/pytorch

All 9

Similar to Aoti Debug

More Debugging