-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Enhance "from_node" node meta to track source recursively #142066
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/142066
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ You can merge normally! (2 Unrelated Failures)As of commit 448eb8d with merge base 960a81f ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
3b92358 to
08fccb6
Compare
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
08fccb6 to
9f12b9e
Compare
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
9f12b9e to
cb90c54
Compare
…2066) Summary: Change the "from_node" node meta format to be able to track the provenance of nodes recursively. The new "from_node" format is a a list node NodeSource. The old "from_node" is a list of tuples `(node.name, node.target)` ``` class NodeSource: self.node_name: str self.target: str self.graph_id: int self.pass_name: str self.action: str self.from_node: List[NodeSource] ``` We also add a "pass_name" field to indicate which pass created the node from the source. For now the "pass_name" is only used in fx.Interpreter. These changes will be used for the inductor provenance tracking. Test Plan: ``` buck2 run 'fbcode//mode/dev-nosan' fbcode//caffe2/test:test_export -- -r test_unflatten_multiple_graphs_state buck run mode/dev-nosan caffe2/test:fx -- -r node_source ``` Differential Revision: D66737916
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
cb90c54 to
7776e43
Compare
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
7776e43 to
c00aa20
Compare
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
c00aa20 to
4c02815
Compare
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
torch/fx/traceback.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to have an enum here for action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now!
torch/fx/traceback.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just
name?
@avikchaudhuri I could also just make it name. Just there's also a "pass_name". So I thought it might be good to specify that there are two types of names explicitly, node_name and pass_name.
Also node_name might not be available. In inductor (will be added in follow-up Diffs), sometimes we don't have a specific node source, but only pass_name. For example, in some graph pass (not an Interpreter pass, but a pre_grad or post_grad inductor graph pass), we made some changes. We might not know what is the specific source node, but at least we know which pass added this node. So node_name might be empty.
Do you think just name is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Also if the node specific info is missing I wonder if it would be better to add another level of indirection instead of filling in defaults like -1, "", etc .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the node specific info is missing I wonder if it would be better to add another level of indirection instead of filling in defaults like
-1,"", etc .
@avikchaudhuri Do you mean, something like this?
class NodeInfo:
def __init__(self, name: str, target: str, graph_id: int):
self.name = name
self.target = target
self.graph_id = graph_id
class NodeSource:
pass_name: str
action: Optional["NodeSourceAction"]
from_node: List["NodeSource"]
node_info: Optional[NodeInfo]
torch/fx/traceback.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of letting node be optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above. Sometimes we don't know the source node, we just know a source pass.
torch/fx/traceback.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a bit arbitrary? In any case I'd probably keep indent = 0, 1, ... and multiply by 4 when creating the string so that you can guard on the level instead of 4 x level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed now!
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
fd875e6 to
24b8fc1
Compare
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
24b8fc1 to
924e6f2
Compare
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits
…2066) Summary: Change the "from_node" node meta format to be able to track the provenance of nodes recursively. The new "from_node" format is a a list node NodeSource. The old "from_node" is a list of tuples `(node.name, node.target)` ``` class NodeSource: class NodeInfo: def __init__(self, name: str, target: str, graph_id: int): self.name = name self.target = target self.graph_id = graph_id pass_name: str action: Optional["NodeSourceAction"] from_node: List["NodeSource"] node_info: Optional["NodeInfo"] ``` We also add a "pass_name" field to indicate which pass created the node from the source. For now the "pass_name" is only used in fx.Interpreter. These changes will be used for the inductor provenance tracking. Test Plan: ``` buck2 run 'fbcode//mode/dev-nosan' fbcode//caffe2/test:test_export -- -r test_unflatten_multiple_graphs_state buck run mode/dev-nosan fbcode//caffe2/test:fx -- -r node_source buck run mode/dev-nosan fbcode//caffe2/test:fx -- -r graph_provenance buck run mode/dev-nosan fbcode//caffe2/test/quantization:test_quantization -- -r test_simple_metadata_porting ``` Reviewed By: avikchaudhuri Differential Revision: D66737916
924e6f2 to
448eb8d
Compare
|
This pull request was exported from Phabricator. Differential Revision: D66737916 |
|
@pytorchbot merge -i |
Merge startedYour change will be merged while ignoring the following 2 checks: inductor-rocm / rocm6.2-py3.10-inductor / test (inductor, 1, 2, linux.rocm.gpu.2), inductor-rocm / rocm6.2-py3.10-inductor / test (inductor, 2, 2, linux.rocm.gpu.2) Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
|
The merge job was canceled or timed out. This most often happen if two merge requests were issued for the same PR, or if merge job was waiting for more than 6 hours for tests to finish. In later case, please do not hesitate to reissue the merge command |
Merge startedYour 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 |
…2066) Summary: Change the "from_node" node meta format to be able to track the provenance of nodes recursively. The new "from_node" format is a a list node NodeSource: ``` class NodeSource: self.node_name: str self.target: str self.graph_id: int self.pass_name: str self.action: str self.from_node: List[NoedSource] ``` This is in preparation for the inductor provenance tracking. For background, the inductor provenance tracking doc: https://docs.google.com/document/d/1dGh9myqNhywmbfP0Quzx_f04bghDFlj8cawj8MopiO8/edit?fbclid=IwZXh0bgNhZW0CMTEAAR0jUQ0Tf4ROLDED8Y_eIzrU0KVZVdRmyIQLp-avt-kGRPI_VgYVNyjH_q0_aem_HCQ_pxHDiwOkO9mQyWB2-g&tab=t.0 (internal only), Test Plan: ``` buck2 run 'fbcode//mode/dev-nosan' fbcode//caffe2/test:test_export -- -r test_unflatten_multiple_graphs_state buck run mode/dev-nosan caffe2/test:fx -- -r node_source ``` Differential Revision: D66737916 Pull Request resolved: pytorch#142066 Approved by: https://github.com/avikchaudhuri
Summary:
Change the "from_node" node meta format to be able to track the provenance of nodes recursively.
The new "from_node" format is a a list node NodeSource:
This is in preparation for the inductor provenance tracking. For background, the inductor provenance tracking doc: https://docs.google.com/document/d/1dGh9myqNhywmbfP0Quzx_f04bghDFlj8cawj8MopiO8/edit?fbclid=IwZXh0bgNhZW0CMTEAAR0jUQ0Tf4ROLDED8Y_eIzrU0KVZVdRmyIQLp-avt-kGRPI_VgYVNyjH_q0_aem_HCQ_pxHDiwOkO9mQyWB2-g&tab=t.0 (internal only),
Test Plan:
Differential Revision: D66737916
cc @ezyang @SherlockNoMad @EikanWang @jgong5 @wenzhe-nrv @voznesenskym @penguinwu @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @desertfire @chauhang @aakhundov