Skip to content

Conversation

@yushangdi
Copy link
Contributor

@yushangdi yushangdi commented Mar 21, 2025

Summary:
Implement torchbind support in OSSProxyExecutor.

Exactly the same as the implementation in FbProxyExecutor.

D69693697 - fbProxyExecutor
D69887230 - fbProxyExecutor but for torchbind method

Other changes:

  • When generating the schema of the CallTrochBind HOP, the arg name of the torchbind object arg should be the same as the torchbind method's torchbind object arg (instead of obj).

  • In AOTIModelPackageLoader, we extract everything in data/constants to tmp_dir/data/aot_inductor/<model>/ folder, so the torchbind objs exist in the same folder as the rest of the files (e.g. cpp, so). This is to be consistent of how files are packaged internally

Test Plan:

buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r torchbind_aoti

buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r aot_compile

Differential Revision: D69500038

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov

@yushangdi yushangdi requested a review from zou3519 as a code owner March 21, 2025 17:37
@pytorch-bot
Copy link

pytorch-bot bot commented Mar 21, 2025

🔗 Helpful Links

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

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

❌ 5 New Failures, 5 Unrelated Failures

As of commit 4ee3e67 with merge base 01cb351 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

UNSTABLE - The following jobs are marked as unstable, possibly due to flakiness on trunk:

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

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69500038

Copy link
Collaborator

@Skylion007 Skylion007 Mar 21, 2025

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Arg name should be moved into the initializer std::move

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69500038

yushangdi added a commit to yushangdi/pytorch that referenced this pull request Mar 21, 2025
Summary:

Implement torchbind support in OSSProxyExecutor.

Exactly the same as the implementation in FbProxyExecutor.

D69693697 - fbProxyExecutor
D69887230 - fbProxyExecutor but for torchbind method


Other changes:

- When generating the schema of the CallTrochBind HOP, the arg name of the torchbind object arg should be the same as the torchbind method's torchbind object arg (instead of `obj`).

- In `AOTIModelPackageLoader`, we extract everything in `data/constants` to `tmp_dir/data/aot_inductor/<model>/` folder, so the torchbind objs exist in the same folder as the rest of the files (e.g. cpp, so). This is to be consistent of how files are packaged internally


Note:

Seems like there'll be issues with using`filesystem` header in linux: pytorch#137209

So here I use string manipulation instead of `filesystem::path`

Test Plan:
```
buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r torchbind_aoti

buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r aot_compile

buck2 build --flagfile fbsource//arvr/mode/win/dev fbsource//arvr/libraries/audio/AudioSDK/Research/Source/BSI/UnitTests:meridian_bsi_tests

buck2 build --flagfile fbsource//arvr/mode/embedded/linux/clang-aarch64-release fbsource//arvr/third-party/signalarity/latest-release/src/shaker/ha:signalarity_realtime_libtorch_pipeline_
```

Differential Revision: D69500038
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69500038

Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

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

_higher_order_ops change LGTM, someone else who knows the AOTI code should take a look at that

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69500038

yushangdi added a commit to yushangdi/pytorch that referenced this pull request Mar 25, 2025
Summary:
Pull Request resolved: pytorch#149747

Implement torchbind support in OSSProxyExecutor.

Exactly the same as the implementation in FbProxyExecutor.

D69693697 - fbProxyExecutor
D69887230 - fbProxyExecutor but for torchbind method

Other changes:

- When generating the schema of the CallTrochBind HOP, the arg name of the torchbind object arg should be the same as the torchbind method's torchbind object arg (instead of `obj`).

- In `AOTIModelPackageLoader`, we extract everything in `data/constants` to `tmp_dir/data/aot_inductor/<model>/` folder, so the torchbind objs exist in the same folder as the rest of the files (e.g. cpp, so). This is to be consistent of how files are packaged internally

Note:

Seems like there'll be issues with using`filesystem` header in linux: pytorch#137209

So here I use string manipulation instead of `filesystem::path`

Test Plan:
```
buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r torchbind_aoti

buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r aot_compile

buck2 build --flagfile fbsource//arvr/mode/win/dev fbsource//arvr/libraries/audio/AudioSDK/Research/Source/BSI/UnitTests:meridian_bsi_tests

buck2 build --flagfile fbsource//arvr/mode/embedded/linux/clang-aarch64-release fbsource//arvr/third-party/signalarity/latest-release/src/shaker/ha:signalarity_realtime_libtorch_pipeline_
```

Differential Revision: D69500038
OSSOpKernel& op_kernel) {
auto& stack = op_kernel.stack_;
auto& dynamic_args = op_kernel.dynamic_args_;
OSSOpKernel* op_kernel,
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why this refernce to pointer change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Never mind. I see your created child classes later.

} else { // startsWith(filename_str, const_directory)
// Extract constants to the same directory as the rest of the files
// to be consistent with internal implementation
size_t lastSlash = filename_str.find_last_of("/\\");
Copy link
Contributor

Choose a reason for hiding this comment

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

You can just use k_separator here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can just use k_separator here.

changed to use k_separator now

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Mar 27, 2025
Summary:

Implement torchbind support in OSSProxyExecutor.

Exactly the same as the implementation in FbProxyExecutor.

D69693697 - fbProxyExecutor
D69887230 - fbProxyExecutor but for torchbind method
D70746626 - Support None output type

Other changes:

- When generating the schema of the CallTrochBind HOP, the arg name of the torchbind object arg should be the same as the torchbind method's torchbind object arg (instead of `obj`).

- In `AOTIModelPackageLoader`, we extract everything in `data/constants` to `tmp_dir/data/aot_inductor/<model>/` folder, so the torchbind objs exist in the same folder as the rest of the files (e.g. cpp, so). This is to be consistent of how files are packaged internally (more details in internal Diff summary).


Note on using `filesystem`:

Seems like there'll be [issues](pytorch#137209) with using`filesystem` header in linux, so here I use string manipulation instead of `filesystem::path`.

Test Plan:
```
buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r torchbind_aoti

buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r aot_compile

buck2 build --flagfile fbsource//arvr/mode/win/dev fbsource//arvr/libraries/audio/AudioSDK/Research/Source/BSI/UnitTests:meridian_bsi_tests

buck2 build --flagfile fbsource//arvr/mode/embedded/linux/clang-aarch64-release fbsource//arvr/third-party/signalarity/latest-release/src/shaker/ha:signalarity_realtime_libtorch_pipeline_
```

Reviewed By: desertfire

Differential Revision: D69500038
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D69500038

@facebook-github-bot
Copy link
Contributor

@pytorchbot merge

(Initiating merge automatically since Phabricator Diff has merged)

@pytorchmergebot
Copy link
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

@facebook-github-bot
Copy link
Contributor

@pytorchbot revert -m="Diff reverted internally" -c="ghfirst"

This Pull Request has been reverted by a revert inside Meta. To re-land this change, please open another pull request, assign the same reviewers, fix the CI failures that caused the revert and make sure that the failing CI runs on the PR by applying the proper ciflow label (e.g., ciflow/trunk).)

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a revert job. Check the current status here.
Questions? Feedback? Please reach out to the PyTorch DevX Team

@pytorchmergebot
Copy link
Collaborator

@yushangdi your PR has been successfully reverted.

@pytorchmergebot pytorchmergebot added Reverted ci-no-td Do not run TD on this PR labels Mar 28, 2025
@facebook-github-bot
Copy link
Contributor

@pytorchbot merge -i

(Initiating merge automatically since Phabricator Diff has merged, merging with -i because oss signals were bypassed internally)

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged while ignoring the following 0 checks:

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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: 1 jobs have failed, first few of them are: Meta Internal-Only Changes Check

Details for Dev Infra team Raised by workflow job

@yangw-dev
Copy link
Contributor

@pytorchbot merge -i

@yushangdi
Copy link
Contributor Author

relanding in #150196

@yushangdi yushangdi closed this Mar 28, 2025
amathewc pushed a commit to amathewc/pytorch that referenced this pull request Apr 17, 2025
Summary:
Implement torchbind support in OSSProxyExecutor.

Exactly the same as the implementation in FbProxyExecutor.

D69693697 - fbProxyExecutor
D69887230 - fbProxyExecutor but for torchbind method

Other changes:

- When generating the schema of the CallTrochBind HOP, the arg name of the torchbind object arg should be the same as the torchbind method's torchbind object arg (instead of `obj`).

- In `AOTIModelPackageLoader`, we extract everything in `data/constants` to `tmp_dir/data/aot_inductor/<model>/` folder, so the torchbind objs exist in the same folder as the rest of the files (e.g. cpp, so). This is to be consistent of how files are packaged internally

Test Plan:
```
buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r torchbind_aoti

buck run fbcode//mode/dev-nosan //caffe2/test/inductor:torchbind -- -r aot_compile
```

Differential Revision: D69500038

Pull Request resolved: pytorch#149747
Approved by: https://github.com/desertfire
amathewc pushed a commit to amathewc/pytorch that referenced this pull request Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants