Skip to content

RFC-0043 Torch Native Runtime #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

zhxchen17
Copy link

No description provided.

@zhxchen17
Copy link
Author

cc @albanD @malfet @seemethere


### “Any performance regression from TorchScript?”

* Single digit percentage (<10%) improvement over TorchScript interpreter from improvements like static dispatch, memory planning, inter-op parallelism and overhead reduction.

Choose a reason for hiding this comment

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

Suggested change
* Single digit percentage (<10%) improvement over TorchScript interpreter from improvements like static dispatch, memory planning, inter-op parallelism and overhead reduction.
No, on the contrary we expect * single digit percentage (<10%) improvement over TorchScript interpreter from improvements like static dispatch, memory planning, inter-op parallelism and overhead reduction.

@zhxchen17 zhxchen17 requested a review from gmagogsfm April 28, 2025 16:17
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Apr 29, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
```
buck2 run mode/dev-nosan caffe2/test/cpp/nativert:nativert
```

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Apr 29, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
```
buck2 run mode/dev-nosan caffe2/test/cpp/nativert:nativert
```

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Apr 29, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
```
buck2 run mode/dev-nosan caffe2/test/cpp/nativert:nativert
```

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Apr 29, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
```
buck2 run mode/dev-nosan caffe2/test/cpp/nativert:nativert
```

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Apr 30, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
```
buck2 run mode/dev-nosan caffe2/test/cpp/nativert:nativert
```

Differential Revision: D73820548
pytorch-bot bot pushed a commit to pytorch/pytorch that referenced this pull request May 1, 2025
Summary:
Pull Request resolved: #152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request May 1, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request May 2, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request May 2, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request May 2, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request May 2, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request May 3, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
pytorch-bot bot pushed a commit to pytorch/pytorch that referenced this pull request May 5, 2025
Summary:
Pull Request resolved: #152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request May 5, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request May 5, 2025
Summary:
Pull Request resolved: pytorch#152475

Torch Native Runtime RFC: pytorch/rfcs#72

Thi diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core.

Test Plan:
Internal CI.
GitHub CI with newly added test under `test/cpp/nativert/test_tensor_meta.cpp`

Reviewed By: zhxchen17

Differential Revision: D73820548
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request May 6, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72

This diff moves `TensorMeta.cpp` and `TensorMeta.h` to PyTorch core under `torch/nativert/graph/`

Existing `torch::_export::TensorMeta` in `torch/csrc/utils/generated_serialization_types.h` is auto-generated from the export serde schema and therefore only containing the most basic serializable types. We need the newly added `TensorMeta.cpp` to deserialize the metadata into a in-memory class with c10 types so that it can be consumed by the runtime later.

Test Plan:

Added test under `test/cpp/nativert/test_tensor_meta.cpp`

Differential Revision: D73820548

Pull Request resolved: #152475
Approved by: https://github.com/albanD
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request May 7, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72
Port string utils functions join and split to c10/util

Test Plan:
Added tests in `string_util_test.cpp`
buck2 run mode/opt caffe2/c10/test:util_base_tests

Differential Revision: D74202473

Pull Request resolved: #152873
Approved by: https://github.com/cyyever, https://github.com/Skylion007
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request May 20, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72

Added an in-memory representation for input and output specs of a graph. The GraphSignature class models the input and output specs of an exported graph produced by torch.export, which holds the graph information deserialized from the pt2 archive package. Runtime relies on the GraphSignature for weight name lookup and weight loading.

The serialization schema is defined in torch/_export/serde/schema.py
See more at: https://docs.pytorch.org/docs/stable/export.html#torch.export.ExportGraphSignature

Test Plan: Added tests under `test/cpp/nativert/test_graph_signature.cpp`

Differential Revision: D73895378

Pull Request resolved: #152969
Approved by: https://github.com/swolchok
yiming0416 added a commit to pytorch/pytorch that referenced this pull request May 28, 2025
We split the large PR for adding Graph.h and Graph.cpp to `nativert` into 3 smaller PRs:
1. **Add header file**
2. Add source file
3. Add test and build rules.

Torch Native Runtime RFC: pytorch/rfcs#72

4 classes have been introduced: `Graph`, `Node`, `Value`, `Type`
- `Type` represents the kind of a `Value`
- `Value` represents a single symbolic value, it could be any kind that exists in `Type`. Values are inputs and outputs of a `Node`.
- `Node` represents a single unit of execution, typically a PyTorch op.
- `Graph` represents a model's computation graph, which is designed to facilitate transformation/analysis.

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

[ghstack-poisoned]
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Jun 19, 2025
Summary:
Pull Request resolved: pytorch#156196

Moves GraphExecutorBase class to PyTorch core.
GraphExecutorBase is a lightweight abstraction to execute a graph with  execution frames without actually owning the graph nor the weights. This is introduced to decouple the state management of the top level runtime from the kernel executions so that sub graphs from higher order ops can be supported.

Torch Native Runtime RFC: pytorch/rfcs#72

Test Plan:
This is a base class. So CI is sufficient

Rollback Plan:

Reviewed By: zhxchen17

Differential Revision: D76830436
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jun 19, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72

As part of the effort to open source TorchNativeRuntime (or what we call Sigmoid), we are moving the Pytree implementation to torch/:

fbcode/sigmoid/kernels -> fbcode/caffe2/torch/nativert/kernels

Test Plan:
```
buck run fbcode//mode/dev-nosan  //caffe2/test/cpp/nativert:c10_kernel_test
```

Differential Revision: D76825830

Pull Request resolved: #156208
Approved by: https://github.com/zhxchen17
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Jun 19, 2025
Summary:
Pull Request resolved: pytorch#156196

Moves GraphExecutorBase class to PyTorch core.
GraphExecutorBase is a lightweight abstraction to execute a graph with  execution frames without actually owning the graph nor the weights. This is introduced to decouple the state management of the top level runtime from the kernel executions so that sub graphs from higher order ops can be supported.

Torch Native Runtime RFC: pytorch/rfcs#72

Test Plan:
This is a base class. So CI is sufficient

Rollback Plan:

Reviewed By: zhxchen17

Differential Revision: D76830436
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jun 19, 2025
Summary:
Moves GraphExecutorBase class to PyTorch core.
GraphExecutorBase is a lightweight abstraction to execute a graph with  execution frames without actually owning the graph nor the weights. This is introduced to decouple the state management of the top level runtime from the kernel executions so that sub graphs from higher order ops can be supported.

Torch Native Runtime RFC: pytorch/rfcs#72

Test Plan:
CI

Rollback Plan:

Differential Revision: D76830436

Pull Request resolved: #156196
Approved by: https://github.com/zhxchen17
yushangdi added a commit to yushangdi/pytorch that referenced this pull request Jun 19, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72

As part of the effort to open source TorchNativeRuntime (or what we call Sigmoid), we are moving the Pytree implementation to torch/:

fbcode/sigmoid/kernels -> fbcode/caffe2/torch/nativert/kernels

Copied from original auto_functionalize Diff Summary D53776805:

This is a non-functional kernel implementation for auto_functionalize

In AutoFunctionalizeKernel, I directly call the underlying target without making a clone of mutating inputs.

This would mutates the input tensors inplace, which is unsafe in general.

However, Sigmoid is not doing any graph optimization, or node reordering at the moment, so it's ok do take this short cut.

In the proper functional implementation, it will

make a clone of the mutating input tensor

return these new instance of tensors as AutoFunctionalizeKernel output.

If the original exported program has some "bufferMutation" or "userInputMutation" fields, it will also need to honor such mutations in Sigmoid.

Test Plan: See internal for test plan

Differential Revision: D76926383
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Jun 20, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72
PrimKernelRegistry manages a small subset of kernel registry in NativeRT.
Including ListPack, ListUnpack, Input, Output, VarConcat, VarStack

Test Plan: Internal unittests

Differential Revision: D77034945
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jun 20, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72

As part of the effort to open source TorchNativeRuntime (or what we call Sigmoid), we are moving the Pytree implementation to torch/:

fbcode/sigmoid/kernels -> fbcode/caffe2/torch/nativert/kernels

Copied from original auto_functionalize Diff Summary D53776805:

This is a non-functional kernel implementation for auto_functionalize

In AutoFunctionalizeKernel, I directly call the underlying target without making a clone of mutating inputs.

This would mutates the input tensors inplace, which is unsafe in general.

However, Sigmoid is not doing any graph optimization, or node reordering at the moment, so it's ok do take this short cut.

In the proper functional implementation, it will

make a clone of the mutating input tensor

return these new instance of tensors as AutoFunctionalizeKernel output.

If the original exported program has some "bufferMutation" or "userInputMutation" fields, it will also need to honor such mutations in Sigmoid.

Test Plan: See internal for test plan

Differential Revision: D76926383

Pull Request resolved: #156454
Approved by: https://github.com/zhxchen17
yushangdi added a commit to yushangdi/pytorch that referenced this pull request Jun 20, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72
As part of the effort to open source TorchNativeRuntime (or what we call Sigmoid), we are moving the implementation to torch/:
fbcode/sigmoid/kernels -> fbcode/caffe2/torch/nativert/kernels

Test Plan: CI

Differential Revision: D77032074
yushangdi added a commit to yushangdi/pytorch that referenced this pull request Jun 20, 2025
Summary:
Pull Request resolved: pytorch#156507

Torch Native Runtime RFC: pytorch/rfcs#72
As part of the effort to open source TorchNativeRuntime (or what we call Sigmoid), we are moving the implementation to torch/:
fbcode/sigmoid/kernels -> fbcode/caffe2/torch/nativert/kernels

Test Plan: CI

Differential Revision: D77032074
yushangdi added a commit to yushangdi/pytorch that referenced this pull request Jun 20, 2025
Summary:
Pull Request resolved: pytorch#156507

Torch Native Runtime RFC: pytorch/rfcs#72
As part of the effort to open source TorchNativeRuntime (or what we call Sigmoid), we are moving the implementation to torch/:
fbcode/sigmoid/kernels -> fbcode/caffe2/torch/nativert/kernels

Test Plan: CI

Differential Revision: D77032074
yushangdi added a commit to yushangdi/pytorch that referenced this pull request Jun 20, 2025
Summary:
Pull Request resolved: pytorch#156507

Torch Native Runtime RFC: pytorch/rfcs#72
As part of the effort to open source TorchNativeRuntime (or what we call Sigmoid), we are moving the implementation to torch/:
fbcode/sigmoid/kernels -> fbcode/caffe2/torch/nativert/kernels

Test Plan: CI

Differential Revision: D77032074
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Jun 21, 2025
Summary:
Pull Request resolved: pytorch#156506

Torch Native Runtime RFC: pytorch/rfcs#72
PrimKernelRegistry manages a small subset of kernel registry in NativeRT.
Including ListPack, ListUnpack, Input, Output, VarConcat, VarStack

#buildall

Test Plan: Internal unittests

Differential Revision: D77034945
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/pytorch that referenced this pull request Jun 22, 2025
We split the large PR for adding Graph.h and Graph.cpp to `nativert` into 3 smaller PRs:
1. **Add header file**
2. Add source file
3. Add test and build rules.

Torch Native Runtime RFC: pytorch/rfcs#72

4 classes have been introduced: `Graph`, `Node`, `Value`, `Type`
- `Type` represents the kind of a `Value`
- `Value` represents a single symbolic value, it could be any kind that exists in `Type`. Values are inputs and outputs of a `Node`.
- `Node` represents a single unit of execution, typically a PyTorch op.
- `Graph` represents a model's computation graph, which is designed to facilitate transformation/analysis.

Differential Revision: [D75491860](https://our.internmc.facebook.com/intern/diff/D75491860/)
Pull Request resolved: pytorch#154530
Approved by: https://github.com/SherlockNoMad
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/pytorch that referenced this pull request Jun 22, 2025
We split the large PR for adding Graph.h and Graph.cpp to nativert into 3 smaller PRs:

1. Add header file
2. **Add source file**
3. Add test and build rules.

Torch Native Runtime RFC: pytorch/rfcs#72

4 classes have been introduced: `Graph`, `Node`, `Value`, `Type`
- `Type` represents the kind of a `Value`
- `Value` represents a single symbolic value, it could be any kind that exists in `Type`. Values are inputs and outputs of a `Node`.
- `Node` represents a single unit of execution, typically a PyTorch op.
- `Graph` represents a model's computation graph, which is designed to facilitate transformation/analysis.

Differential Revision: [D75492405](https://our.internmc.facebook.com/intern/diff/D75492405/)
Pull Request resolved: pytorch#154531
Approved by: https://github.com/SherlockNoMad
ghstack dependencies: pytorch#154530
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/pytorch that referenced this pull request Jun 22, 2025
We split the large PR for adding Graph.h and Graph.cpp to nativert into 3 smaller PRs:

1. Add header file
2. Add source file
3. **Add test and build rules**

Torch Native Runtime RFC: pytorch/rfcs#72

4 classes have been introduced: `Graph`, `Node`, `Value`, `Type`
- `Type` represents the kind of a `Value`
- `Value` represents a single symbolic value, it could be any kind that exists in `Type`. Values are inputs and outputs of a `Node`.
- `Node` represents a single unit of execution, typically a PyTorch op.
- `Graph` represents a model's computation graph, which is designed to facilitate transformation/analysis.

Differential Revision: [D75495273](https://our.internmc.facebook.com/intern/diff/D75495273/)
Pull Request resolved: pytorch#154532
Approved by: https://github.com/SherlockNoMad
ghstack dependencies: pytorch#154530, pytorch#154531
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/pytorch that referenced this pull request Jun 22, 2025
Summary:
Moves Weights class to PyTorch core
Torch Native Runtime RFC: pytorch/rfcs#72
 README: https://github.com/pytorch/pytorch/blob/main/torch/nativert/OVERVIEW.md

Test Plan: buck2 run mode/dev-nosan caffe2/test/cpp/nativert:weights_test

Differential Revision: D75973156

Pull Request resolved: pytorch#155156
Approved by: https://github.com/zhxchen17
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Jun 23, 2025
Summary:
Pull Request resolved: pytorch#156506

Torch Native Runtime RFC: pytorch/rfcs#72
PrimKernelRegistry manages a small subset of kernel registry in NativeRT.
Including ListPack, ListUnpack, Input, Output, VarConcat, VarStack.

Test Plan: Internal unittests

Differential Revision: D77034945
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Jun 23, 2025
Summary:
Pull Request resolved: pytorch#156506

Torch Native Runtime RFC: pytorch/rfcs#72
PrimKernelRegistry manages a small subset of kernel registry in NativeRT.
Including ListPack, ListUnpack, Input, Output, VarConcat, VarStack.

Test Plan: Internal unittests

Differential Revision: D77034945
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jun 23, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72
As part of the effort to open source TorchNativeRuntime (or what we call Sigmoid), we are moving the implementation to torch/:
fbcode/sigmoid/kernels -> fbcode/caffe2/torch/nativert/kernels

Test Plan: CI

Differential Revision: D77032074

Pull Request resolved: #156507
Approved by: https://github.com/zhxchen17
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Jun 23, 2025
Summary:
Pull Request resolved: pytorch#156506

Torch Native Runtime RFC: pytorch/rfcs#72
PrimKernelRegistry manages a small subset of kernel registry in NativeRT.
Including ListPack, ListUnpack, Input, Output, VarConcat, VarStack.

Test Plan: Internal unittests

Reviewed By: zhxchen17

Differential Revision: D77034945
yiming0416 added a commit to yiming0416/pytorch that referenced this pull request Jun 24, 2025
Summary:
Pull Request resolved: pytorch#156506

Torch Native Runtime RFC: pytorch/rfcs#72
PrimKernelRegistry manages a small subset of kernel registry in NativeRT.
Including ListPack, ListUnpack, Input, Output, VarConcat, VarStack.

Test Plan: Internal unittests

Reviewed By: zhxchen17

Differential Revision: D77034945
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jun 24, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72
PrimKernelRegistry manages a small subset of kernel registry in NativeRT.
Including ListPack, ListUnpack, Input, Output, VarConcat, VarStack

Test Plan: Internal unittests

Differential Revision: D77034945

Pull Request resolved: #156506
Approved by: https://github.com/zhxchen17
skarjala pushed a commit to skarjala/pytorch that referenced this pull request Jun 25, 2025
Summary:
Torch Native Runtime RFC: pytorch/rfcs#72
PrimKernelRegistry manages a small subset of kernel registry in NativeRT.
Including ListPack, ListUnpack, Input, Output, VarConcat, VarStack

Test Plan: Internal unittests

Differential Revision: D77034945

Pull Request resolved: pytorch#156506
Approved by: https://github.com/zhxchen17
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/pytorch that referenced this pull request Jul 14, 2025
We split the large PR for adding Graph.h and Graph.cpp to `nativert` into 3 smaller PRs:
1. **Add header file**
2. Add source file
3. Add test and build rules.

Torch Native Runtime RFC: pytorch/rfcs#72

4 classes have been introduced: `Graph`, `Node`, `Value`, `Type`
- `Type` represents the kind of a `Value`
- `Value` represents a single symbolic value, it could be any kind that exists in `Type`. Values are inputs and outputs of a `Node`.
- `Node` represents a single unit of execution, typically a PyTorch op.
- `Graph` represents a model's computation graph, which is designed to facilitate transformation/analysis.

Differential Revision: [D75491860](https://our.internmc.facebook.com/intern/diff/D75491860/)
Pull Request resolved: pytorch#154530
Approved by: https://github.com/SherlockNoMad
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/pytorch that referenced this pull request Jul 14, 2025
We split the large PR for adding Graph.h and Graph.cpp to nativert into 3 smaller PRs:

1. Add header file
2. **Add source file**
3. Add test and build rules.

Torch Native Runtime RFC: pytorch/rfcs#72

4 classes have been introduced: `Graph`, `Node`, `Value`, `Type`
- `Type` represents the kind of a `Value`
- `Value` represents a single symbolic value, it could be any kind that exists in `Type`. Values are inputs and outputs of a `Node`.
- `Node` represents a single unit of execution, typically a PyTorch op.
- `Graph` represents a model's computation graph, which is designed to facilitate transformation/analysis.

Differential Revision: [D75492405](https://our.internmc.facebook.com/intern/diff/D75492405/)
Pull Request resolved: pytorch#154531
Approved by: https://github.com/SherlockNoMad
ghstack dependencies: pytorch#154530
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/pytorch that referenced this pull request Jul 14, 2025
We split the large PR for adding Graph.h and Graph.cpp to nativert into 3 smaller PRs:

1. Add header file
2. Add source file
3. **Add test and build rules**

Torch Native Runtime RFC: pytorch/rfcs#72

4 classes have been introduced: `Graph`, `Node`, `Value`, `Type`
- `Type` represents the kind of a `Value`
- `Value` represents a single symbolic value, it could be any kind that exists in `Type`. Values are inputs and outputs of a `Node`.
- `Node` represents a single unit of execution, typically a PyTorch op.
- `Graph` represents a model's computation graph, which is designed to facilitate transformation/analysis.

Differential Revision: [D75495273](https://our.internmc.facebook.com/intern/diff/D75495273/)
Pull Request resolved: pytorch#154532
Approved by: https://github.com/SherlockNoMad
ghstack dependencies: pytorch#154530, pytorch#154531
vijayabhaskar-ev pushed a commit to vijayabhaskar-ev/pytorch that referenced this pull request Jul 14, 2025
Summary:
Moves Weights class to PyTorch core
Torch Native Runtime RFC: pytorch/rfcs#72
 README: https://github.com/pytorch/pytorch/blob/main/torch/nativert/OVERVIEW.md

Test Plan: buck2 run mode/dev-nosan caffe2/test/cpp/nativert:weights_test

Differential Revision: D75973156

Pull Request resolved: pytorch#155156
Approved by: https://github.com/zhxchen17
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.

3 participants