Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Migration to PyTorch core #1588

@jansel

Description

@jansel

We have merged github.com/pytorch/torchdynamo into github.com/pytorch/pytorch. Being in a separate repo has allowed us to move fast, but it creates some installation roadblocks for users and version pinning has been a growing headache as the project scales.

  • import torchdynamo is now import torch._dynamo
  • import torchinductor is now import torch._inductor
  • The standalone C extensions are added to torch._C
  • torchdynamo/benchmarks is now pytorch/benchmarks/dynamo
  • torchdynamo/test/dynamo is now pytorch/test/dynamo
  • torchdynamo/test/inductor is now pytorch/test/inductor

Instructions for migrating your PR from pytorch/torchdynamo to pytorch/pytorch

  1. Merge/rebase your PR to the correct hash of TorchDynamo: 6380959
cd ../torchdynamo
git pull origin 6380959be21851bfda99424392cc08fda29d073d
  1. Checkout a new branch with the correct version of PyTorch: pytorch/pytorch@054a2fd
    (the two versions must match so only your changes are copied over):
cd ../pytorch
git fetch origin master 
git checkout -b <your_new_branch_name> 054a2fd6c2fc361796663eed4772368c287d6c83
  1. Run the rsync+auto-format script
bash ../torchdynamo/copy_to_core.sh
  1. Commit your changes, rebase to the latest version of PyTorch, and create a pull request as normal for the PyTorch repo.

If you are copying files by hand, make sure to run make setup_lint && lintrunner -a to switch to the new auto-formatting.

The Plan

Phase 1 (complete)

In the first phase we will move the code over to core, which consists of these two PRs:
#1538
pytorch/pytorch#86461

In this phase (now complete), the dynamo source of truth remained pytorch/torchdynamo. Any changes will be copied over by the copy_to_core.sh script which we will rerun at the end of phase one.

After these initial PRs land, dynamo will be working in core -- but most of the testing will be disabled. The initial PR will have testing disable, but then we will enable tests in smaller followup PRs.

Phase 2 (going on now)

At this switchover point, the source of truth will become PyTorch core. All open PR's will be closed and asked to resubmit to pytorch/pytorch. We will replace torchdynamo in this repo with from torch._dynamo import *, and same for torchinductor.

The criteria for reaching this point is the PRs above land in core, sync to fbcode (to check for reverts), and basic testing infra is setup.

We will continue using this project for github issues.

Followup Tasks

  • Land initial migration in core (this blocks most other items) @jansel
  • Land dynamo size of that migration with copy_to_core.sh script @jansel
  • Enable all unit tests in core @jansel
  • Add smaller deps such as Sympy/Filelock and to PyTorch CI
  • test_recompile_ux.py has a bug where it only works in pytest and not using PyTorch's test infra @wconstab
  • Add Triton to PyTorch CI Add triton to CI pytorch#86988
  • Update torchdynamo tests in core to use torch._dynamo and stop installing torchdynamo Migrate dynamo CI test shards to torch._dynamo pytorch#87039
  • Figure out how to include triton/etc properly for end users installing nightlies. Perhaps vend our own version of it in the short term. @malfet
  • Update performance dashboards to use the new system. @anijain2305
  • Move docs over to pytorch core (these won't be covered in the initial move)
  • Update internal fbcode buck target and internal users to use the new packages, remove the old one
  • Port over our circleci integration tests, we may need to convert these to github actions in the process. Since these are expensive, we may want to gate them on a tag. @desertfire
  • Fix followup issues uncovered by @albanD, @voznesenskym

I am sure there are other things I am forgetting. Please edit this or comment with suggestions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions