Skip to content

refactor: move dynamo/TorchXLA bridge to pytorch/xla repo#92601

Closed
shunting314 wants to merge 1 commit intomasterfrom
dynamo-xla-refactor
Closed

refactor: move dynamo/TorchXLA bridge to pytorch/xla repo#92601
shunting314 wants to merge 1 commit intomasterfrom
dynamo-xla-refactor

Conversation

@shunting314
Copy link
Copy Markdown
Contributor

@shunting314 shunting314 commented Jan 19, 2023

This is a follow up from the previous PR: #88449 , to move the dynamo/TorchXLA bridge from pytorch repo to xla repo.

Overall the dynamo/TorchXLA integration has the following four layers of code

  • pybind layer: This is the bottom layer containing various pybind APIs as the foundation. This part resident in xla repo
  • bridge layer: build upon the pybind layer to implement the trace once functionality. This layer and it's corresponding unit test are in pytorch repro previously. This PR (and the corresponding xla pr refactor: move dynamo/TorchXLA bridge to pytorch/xla repo xla#4476 ) moves them to the xla repo.
  • dynamo backend registration: this a thin layer registers 4 dynamo backends (training/inference/trace_once/trace_everytime). It remains in pytorch repo.
  • benchmark script: the torchbench.py script in dynamo is adapted so it can be used in dynamo/TorchXLA integration. This one remains in pytorch repo.

We think the new code organization is cleaner.

I'll wait for the xla PR in first before trying to merge this one.

Tests

  1. run the unit tests moved to the xla repo
  2. Test for inference: GPU_NUM_DEVICES=1 python benchmarks/dynamo/torchbench.py --randomize-input --performance --trace-on-xla --backend=torchxla_trace_once --only resnet18
  3. Test for training: GPU_NUM_DEVICES=1 python benchmarks/dynamo/torchbench.py --randomize-input --performance --trace-on-xla --training --backend=aot_torchxla_trace_once --only resnet18 --collect-outputs

cc @mlazos @soumith @voznesenskym @yanboliang @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @chunyuan-w @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @desertfire

@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Jan 19, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/92601

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 3e60f3b:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

Copy link
Copy Markdown
Collaborator

@JackCaoG JackCaoG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I guess we can first try to merge the pytorch/xla pr and then merge this one? This way we don't need to deal with two way pin.

Copy link
Copy Markdown
Contributor

@wconstab wconstab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

is the main reason for leaving the dynamo integration layer in pytorch repo becuase we don't have a good backend reg api for out of tree currently? cc @SherlockNoMad i think he's working on this

@shunting314
Copy link
Copy Markdown
Contributor Author

@wconstab yea, also this is a very thin layer. Putting it in dynamo should still give us a clean code organization.

@shunting314
Copy link
Copy Markdown
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jan 25, 2023
@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions github-actions Bot deleted the dynamo-xla-refactor branch July 25, 2024 01:56
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 25, 2026
)

This is a follow up from the previous PR: pytorch#88449 , to move the dynamo/TorchXLA bridge from pytorch repo to xla repo.

Overall the dynamo/TorchXLA integration has the following four layers of code
- pybind layer: This is the bottom layer containing various pybind APIs as the foundation. This part resident in xla repo
- bridge layer: build upon the pybind layer to implement the trace once functionality. This layer and it's corresponding unit test are in pytorch repro previously. This PR (and the corresponding xla pr pytorch/xla#4476 ) moves them to the xla repo.
- dynamo backend registration: this a thin layer registers 4 dynamo backends (training/inference/trace_once/trace_everytime). It remains in pytorch repo.
- benchmark script: the torchbench.py script in dynamo is adapted so it can be used in dynamo/TorchXLA integration. This one remains in pytorch repo.

We think the new code organization is cleaner.

I'll wait for the xla PR in first before trying to merge this one.

Tests
1. run the unit tests moved to the xla repo
2. Test for inference:  `GPU_NUM_DEVICES=1 python benchmarks/dynamo/torchbench.py --randomize-input --performance --trace-on-xla --backend=torchxla_trace_once --only resnet18`
3. Test for training: `GPU_NUM_DEVICES=1 python benchmarks/dynamo/torchbench.py --randomize-input --performance --trace-on-xla --training --backend=aot_torchxla_trace_once --only resnet18 --collect-outputs`

Pull Request resolved: pytorch#92601
Approved by: https://github.com/wconstab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants