Skip to content

Conversation

@andyanwang
Copy link
Contributor

@andyanwang andyanwang commented Oct 21, 2025

Summary:
This diff is the binding and hook layer for MTIA Graph, including

  1. binding between Python and C++
  2. hook between Pytorch and mtia fbcode
image

Doc

Test Plan: Will be tested in the python implementation which will use the binding and hook

Differential Revision: D84457757

cc @egienvalue

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 21, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit 3b7017a with merge base f5543e3 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@meta-codesync
Copy link

meta-codesync bot commented Oct 21, 2025

@andyanwang has exported this pull request. If you are a Meta employee, you can view the originating Diff in D84457757.


_MTIAGraph(bool keep_graph = false)
: handle_(at::detail::getMTIAHooks().mtiagraphCreate(keep_graph)) {}
~_MTIAGraph() {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this equal default?

andyanwang added a commit to andyanwang/pytorch that referenced this pull request Oct 22, 2025
… Pytorch to Fbcode (pytorch#165963)

Summary:

This diff is the binding and hook layer for MTIA Graph, including
1. binding between Python and C++
2. hook between Pytorch and mtia fbcode

[Doc](https://docs.google.com/document/d/1Q3xdZAIqhBvuy2HxGDfJyXVmxYXUEeYSZSwsp7bcJF8/edit?tab=t.osb46a42t6wb#heading=h.ayp9tkk08x00)

Test Plan: Will be tested in the python implementation which will use the binding and hook

Reviewed By: chaos5958

Differential Revision: D84457757
andyanwang added a commit to andyanwang/pytorch that referenced this pull request Oct 22, 2025
… Pytorch to Fbcode (pytorch#165963)

Summary:

This diff is the binding and hook layer for MTIA Graph, including
1. binding between Python and C++
2. hook between Pytorch and mtia fbcode

 {F1982920659} 

[Doc](https://docs.google.com/document/d/1Q3xdZAIqhBvuy2HxGDfJyXVmxYXUEeYSZSwsp7bcJF8/edit?tab=t.osb46a42t6wb#heading=h.ayp9tkk08x00)

Test Plan: Will be tested in the python implementation which will use the binding and hook

Reviewed By: chaos5958

Differential Revision: D84457757
@andyanwang andyanwang requested review from albanD and malfet October 22, 2025 19:43
andyanwang added a commit to andyanwang/pytorch that referenced this pull request Oct 22, 2025
… Pytorch to Fbcode (pytorch#165963)

Summary:

This diff is the binding and hook layer for MTIA Graph, including
1. binding between Python and C++
2. hook between Pytorch and mtia fbcode

 {F1982920659} 

[Doc](https://docs.google.com/document/d/1Q3xdZAIqhBvuy2HxGDfJyXVmxYXUEeYSZSwsp7bcJF8/edit?tab=t.osb46a42t6wb#heading=h.ayp9tkk08x00)

Test Plan: Will be tested in the python implementation which will use the binding and hook

Reviewed By: chaos5958

Differential Revision: D84457757
@andyanwang andyanwang requested a review from Skylion007 October 28, 2025 17:29
Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

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

LGTM

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 28, 2025

#include <c10/util/python_stub.h>
#include <ATen/detail/AcceleratorHooksInterface.h>
#include <c10/util/python_stub.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change the header order here (and may be move all c10 headers to one block)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's done by lintrunner. I'll double check

}

virtual void setCurrentStream(const c10::Stream& /*stream*/ ) const {
virtual void setCurrentStream(const c10::Stream& /*stream*/) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like could be done by separate commit

pytorch-bot bot pushed a commit that referenced this pull request Oct 28, 2025
… Pytorch to Fbcode (#165963)

Summary:

This diff is the binding and hook layer for MTIA Graph, including
1. binding between Python and C++
2. hook between Pytorch and mtia fbcode

 {F1982920659} 

[Doc](https://docs.google.com/document/d/1Q3xdZAIqhBvuy2HxGDfJyXVmxYXUEeYSZSwsp7bcJF8/edit?tab=t.osb46a42t6wb#heading=h.ayp9tkk08x00)

Test Plan: Will be tested in the python implementation which will use the binding and hook

Reviewed By: chaos5958

Differential Revision: D84457757
pytorch-bot bot pushed a commit that referenced this pull request Oct 30, 2025
… Pytorch to Fbcode (#165963)

Summary:

This diff is the binding and hook layer for MTIA Graph, including
1. binding between Python and C++
2. hook between Pytorch and mtia fbcode

 {F1982920659} 

[Doc](https://docs.google.com/document/d/1Q3xdZAIqhBvuy2HxGDfJyXVmxYXUEeYSZSwsp7bcJF8/edit?tab=t.osb46a42t6wb#heading=h.ayp9tkk08x00)

Test Plan: Will be tested in the python implementation which will use the binding and hook

Reviewed By: chaos5958

Differential Revision: D84457757
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

SGTM

… Pytorch to Fbcode (pytorch#165963)

Summary:

This diff is the binding and hook layer for MTIA Graph, including
1. binding between Python and C++
2. hook between Pytorch and mtia fbcode

 {F1982920659} 

[Doc](https://docs.google.com/document/d/1Q3xdZAIqhBvuy2HxGDfJyXVmxYXUEeYSZSwsp7bcJF8/edit?tab=t.osb46a42t6wb#heading=h.ayp9tkk08x00)

Test Plan: Will be tested in the python implementation which will use the binding and hook

Reviewed By: chaos5958

Differential Revision: D84457757
@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

BoyuanFeng pushed a commit that referenced this pull request Oct 31, 2025
… Pytorch to Fbcode (#165963)

Summary:
This diff is the binding and hook layer for MTIA Graph, including
1. binding between Python and C++
2. hook between Pytorch and mtia fbcode
<img width="1780" height="754" alt="image" src="https://github.com/user-attachments/assets/31e24e5b-8324-42d8-8d3b-59536bc18340" />

[Doc](https://docs.google.com/document/d/1Q3xdZAIqhBvuy2HxGDfJyXVmxYXUEeYSZSwsp7bcJF8/edit?tab=t.osb46a42t6wb#heading=h.ayp9tkk08x00)

Test Plan: Will be tested in the python implementation which will use the binding and hook

Differential Revision: D84457757

Pull Request resolved: #165963
Approved by: https://github.com/malfet, https://github.com/albanD
andyanwang added a commit that referenced this pull request Nov 1, 2025
Per suggestion from the previous PR(#165963), separating clang-format changes.

Differential Revision: [D86031474](https://our.internmc.facebook.com/intern/diff/D86031474/)

[ghstack-poisoned]
andyanwang added a commit that referenced this pull request Nov 1, 2025
I missed this API for MTIAGraph in D84457757(#165963)

Differential Revision: [D86026706](https://our.internmc.facebook.com/intern/diff/D86026706/)

[ghstack-poisoned]
andyanwang added a commit that referenced this pull request Nov 1, 2025
I missed this API for MTIAGraph in D84457757(#165963)

Differential Revision: [D86026706](https://our.internmc.facebook.com/intern/diff/D86026706/)

ghstack-source-id: 320301565
Pull Request resolved: #166806
andyanwang added a commit that referenced this pull request Nov 3, 2025
Pull Request resolved: #166806

I missed this API for MTIAGraph in D84457757(#165963)

Differential Revision: [D86026706](https://our.internmc.facebook.com/intern/diff/D86026706/)
ghstack-source-id: 320385344
andyanwang added a commit that referenced this pull request Nov 3, 2025
…les"

Per suggestion from the previous PR(#165963), separating clang-format changes.

Differential Revision: [D86031474](https://our.internmc.facebook.com/intern/diff/D86031474/)

cc egienvalue

[ghstack-poisoned]
andyanwang added a commit that referenced this pull request Nov 3, 2025
Per suggestion from the previous PR(#165963), separating clang-format changes.

Differential Revision: [D86031474](https://our.internmc.facebook.com/intern/diff/D86031474/)

cc egienvalue

[ghstack-poisoned]
andyanwang added a commit that referenced this pull request Nov 3, 2025
…troy graph C++ instance"

I missed this API for MTIAGraph in D84457757(#165963)

Differential Revision: [D86026706](https://our.internmc.facebook.com/intern/diff/D86026706/)

cc egienvalue

[ghstack-poisoned]
andyanwang added a commit that referenced this pull request Nov 3, 2025
…nstance"

I missed this API for MTIAGraph in D84457757(#165963)

Differential Revision: [D86026706](https://our.internmc.facebook.com/intern/diff/D86026706/)

cc egienvalue

[ghstack-poisoned]
pytorchmergebot pushed a commit that referenced this pull request Nov 3, 2025
Per suggestion from the previous PR(#165963), separating clang-format changes.

Differential Revision: [D86031474](https://our.internmc.facebook.com/intern/diff/D86031474/)

Pull Request resolved: #166805
Approved by: https://github.com/Skylion007, https://github.com/albanD
pytorchmergebot pushed a commit that referenced this pull request Nov 3, 2025
…66806)

I missed this API for MTIAGraph in D84457757(#165963)

Differential Revision: [D86026706](https://our.internmc.facebook.com/intern/diff/D86026706/)

Pull Request resolved: #166806
Approved by: https://github.com/albanD
ghstack dependencies: #166805
etaf pushed a commit to etaf/pytorch-inductor-xpu that referenced this pull request Nov 4, 2025
… Pytorch to Fbcode (pytorch#165963)

Summary:
This diff is the binding and hook layer for MTIA Graph, including
1. binding between Python and C++
2. hook between Pytorch and mtia fbcode
<img width="1780" height="754" alt="image" src="https://github.com/user-attachments/assets/31e24e5b-8324-42d8-8d3b-59536bc18340" />

[Doc](https://docs.google.com/document/d/1Q3xdZAIqhBvuy2HxGDfJyXVmxYXUEeYSZSwsp7bcJF8/edit?tab=t.osb46a42t6wb#heading=h.ayp9tkk08x00)

Test Plan: Will be tested in the python implementation which will use the binding and hook

Differential Revision: D84457757

Pull Request resolved: pytorch#165963
Approved by: https://github.com/malfet, https://github.com/albanD
pytorch-bot bot pushed a commit that referenced this pull request Nov 4, 2025
Per suggestion from the previous PR(#165963), separating clang-format changes.

Differential Revision: [D86031474](https://our.internmc.facebook.com/intern/diff/D86031474/)

Pull Request resolved: #166805
Approved by: https://github.com/Skylion007, https://github.com/albanD
pytorch-bot bot pushed a commit that referenced this pull request Nov 4, 2025
…66806)

I missed this API for MTIAGraph in D84457757(#165963)

Differential Revision: [D86026706](https://our.internmc.facebook.com/intern/diff/D86026706/)

Pull Request resolved: #166806
Approved by: https://github.com/albanD
ghstack dependencies: #166805
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request fb-exported Merged meta-exported module: mtia Device MTIA related issues topic: not user facing topic category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants