pytorch-aot

Guide PyTorch functorch and AOT Autograd implementation and extension workflows.

6|8|Updated May 7, 2026
One-click install
npx skills add https://github.com/TorchedHat/ai-marketplace --skill pytorch-aot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pytorch-aot
Source: https://github.com/TorchedHat/ai-marketplace/tree/main/torch-compile/skills/pytorch-aot
Command: npx skills add https://github.com/TorchedHat/ai-marketplace --skill pytorch-aot

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps PyTorch developers understand and extend the complex functorch and AOT Autograd compilation pipeline without navigating its architecture and implementation patterns alone.

Core Features & Use Cases

  • AOT Architecture Guidance: Explains functionalization, joint graph creation, partitioning, activation saving, post-grad passes, and runtime compilation.
  • Functorch Development Support: Covers vmap, batching rules, gradient transforms, functional modules, decompositions, and Core ATen IR transformations.
  • Implementation Patterns: Provides practical guidance for adding mutation support, custom batching rules, post-grad FX passes, functionalization extensions, and partitioning policies.
  • Use Case: When implementing support for a new in-place operation or custom vmap operator, use the Skill to identify the relevant PyTorch files, follow an implementation pattern, and select appropriate tests.

Quick Start

Use the pytorch-aot skill to explain how to implement a new functionalization handler for a custom in-place PyTorch operation.

Frequently Asked Questions about pytorch-aot

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

FAQPage Schema
How do I implement a functionalization handler for an in-place PyTorch operation?

PyTorch AOT Autograd works by tracing the forward pass to create a joint graph, partitioning it into forward and backward passes, and applying post-grad optimizations. This pipeline ensures autograd correctness while enabling ahead-of-time graph transformations.

How do I add custom batching rules for vmap in functorch?

Adding custom batching rules for vmap in functorch requires defining how your specific operator handles batched dimensions. You must implement the rule within the functorch batching framework to ensure correct gradient transforms and Core ATen IR transformations.

What is the role of joint graph construction and partitioning in PyTorch AOT Autograd?

Joint graph construction in PyTorch AOT Autograd fuses forward and backward computation to capture full gradient transforms. Partitioning then splits this joint graph to save activations and apply post-grad FX passes for optimized runtime compilation.

Does PyTorch AOT Autograd support custom post-grad optimization passes?

Yes, PyTorch AOT Autograd supports custom post-grad optimization passes. You can extend the pipeline by adding FX passes that run after the joint graph is partitioned, enabling targeted optimizations for training and inference paths.

Why does my custom vmap operator fail autograd correctness checks in PyTorch?

A custom vmap operator fails autograd correctness checks when mutation tracking or GraphSignature consistency is broken. You must verify that your functorch batching rules and decompositions align with Core ATen IR expectations across training paths.

When do I need Core ATen IR transformations for PyTorch functional modules?

You need Core ATen IR transformations for PyTorch functional modules when implementing decompositions or extending functionalization. This ensures the operations remain compatible with the AOT Autograd compilation pipeline and vmap gradient transforms.