Skip to content

Add addTypedMetadata to GenericTraceActivity - #1485

Closed
ryanzhang22 wants to merge 1 commit into
pytorch:mainfrom
ryanzhang22:export-D112555947
Closed

Add addTypedMetadata to GenericTraceActivity#1485
ryanzhang22 wants to merge 1 commit into
pytorch:mainfrom
ryanzhang22:export-D112555947

Conversation

@ryanzhang22

Copy link
Copy Markdown
Contributor

Summary:
One of the nice things about the old string-only JSON approach was that you could super easily add a new metadata field on the PyTorch side without doing additional work to reflect the change in Kineto. Since GenericTraceActivity ultimately stores a string key and TypedValue, we should support adding typed metadata dynamically by key.

Note -- the catalog is still valuable and should remain the contract for fields Kineto explicitly reads or interprets. For example, NCCL metadata fields that are written on the PyTorch side and explicitly fetched via getMetadataValue in output_json.cpp. Right now we rely on strings happening to match between PyTorch and Kineto; using the catalog is a more official way of matching the two. For GenericTraceActivity metadata that is only access through a visitor class though (which NCCL metadata should eventually migrate to), it's not strictly necessary to go through the catalog.

Differential Revision: D112555947

Summary:
One of the nice things about the old string-only JSON approach was that you could super easily add a new metadata field on the PyTorch side without doing additional work to reflect the change in Kineto. Since `GenericTraceActivity` ultimately stores a string key and `TypedValue`, we should support adding typed metadata dynamically by key.

Note -- the catalog is still valuable and should remain the contract for fields Kineto explicitly reads or interprets. For example, NCCL metadata fields that are written on the PyTorch side and explicitly fetched via `getMetadataValue` in `output_json.cpp`. Right now we rely on strings happening to match between PyTorch and Kineto; using the catalog is a more official way of matching the two. For `GenericTraceActivity` metadata that is only access through a visitor class though (which NCCL metadata should eventually migrate to), it's not strictly necessary to go through the catalog.

Differential Revision: D112555947
@meta-cla meta-cla Bot added the cla signed label Jul 17, 2026
@meta-codesync

meta-codesync Bot commented Jul 17, 2026

Copy link
Copy Markdown

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

@meta-codesync

meta-codesync Bot commented Jul 20, 2026

Copy link
Copy Markdown

This pull request has been merged in 29ab453.

pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Jul 23, 2026
Includes the following commits:

- Add XPU toggleCollectionDynamic mechanism (pytorch/kineto#1410) cb29370
- Explicitly wrap NCCL strings in output json (pytorch/kineto#1482) d62c7f5
- emit GPU_USER_ANNOTATION for user record_function ranges (pytorch/kineto#1393) a8fd013
- Re-select test_basic_chrome_trace_cpu on XPU (pytorch/kineto#1484) f451dfc
- Fix CQS signal readability-avoid-const-params-in-decls in fbcode/kineto/libkineto (pytorch/kineto#1486) c4e1538
- Add NCCL collective metadata fields to the catalog (pytorch/kineto#1483) a31870c
- Add addTypedMetadata to GenericTraceActivity (pytorch/kineto#1485) 29ab453
- Centralize MetadataField definitions (pytorch/kineto#1481) 9c49dca
- Add XCCL collective communication activity tracing to XPU plugin (pytorch/kineto#1396) a97543e
- Fix CQS signal modernize-use-scoped-lock in fbcode/kineto/libkineto (pytorch/kineto#1480) e804b8f
- Un-deselect some profiler tests after fixing them (pytorch/kineto#1432) 446ac67
- Test controller async request arbitration (pytorch/kineto#1477) d579d88
- Annotation fixups (pytorch/kineto#1476) 994e6c5
Pull Request resolved: #190687
Approved by: https://github.com/Skylion007, https://github.com/scotts
youlituao pushed a commit to youlituao/pytorch that referenced this pull request Jul 28, 2026
Includes the following commits:

- Add XPU toggleCollectionDynamic mechanism (pytorch/kineto#1410) cb29370
- Explicitly wrap NCCL strings in output json (pytorch/kineto#1482) d62c7f5
- emit GPU_USER_ANNOTATION for user record_function ranges (pytorch/kineto#1393) a8fd013
- Re-select test_basic_chrome_trace_cpu on XPU (pytorch/kineto#1484) f451dfc
- Fix CQS signal readability-avoid-const-params-in-decls in fbcode/kineto/libkineto (pytorch/kineto#1486) c4e1538
- Add NCCL collective metadata fields to the catalog (pytorch/kineto#1483) a31870c
- Add addTypedMetadata to GenericTraceActivity (pytorch/kineto#1485) 29ab453
- Centralize MetadataField definitions (pytorch/kineto#1481) 9c49dca
- Add XCCL collective communication activity tracing to XPU plugin (pytorch/kineto#1396) a97543e
- Fix CQS signal modernize-use-scoped-lock in fbcode/kineto/libkineto (pytorch/kineto#1480) e804b8f
- Un-deselect some profiler tests after fixing them (pytorch/kineto#1432) 446ac67
- Test controller async request arbitration (pytorch/kineto#1477) d579d88
- Annotation fixups (pytorch/kineto#1476) 994e6c5
Pull Request resolved: pytorch#190687
Approved by: https://github.com/Skylion007, https://github.com/scotts
youlituao pushed a commit to youlituao/pytorch that referenced this pull request Jul 28, 2026
Includes the following commits:

- Add XPU toggleCollectionDynamic mechanism (pytorch/kineto#1410) cb29370
- Explicitly wrap NCCL strings in output json (pytorch/kineto#1482) d62c7f5
- emit GPU_USER_ANNOTATION for user record_function ranges (pytorch/kineto#1393) a8fd013
- Re-select test_basic_chrome_trace_cpu on XPU (pytorch/kineto#1484) f451dfc
- Fix CQS signal readability-avoid-const-params-in-decls in fbcode/kineto/libkineto (pytorch/kineto#1486) c4e1538
- Add NCCL collective metadata fields to the catalog (pytorch/kineto#1483) a31870c
- Add addTypedMetadata to GenericTraceActivity (pytorch/kineto#1485) 29ab453
- Centralize MetadataField definitions (pytorch/kineto#1481) 9c49dca
- Add XCCL collective communication activity tracing to XPU plugin (pytorch/kineto#1396) a97543e
- Fix CQS signal modernize-use-scoped-lock in fbcode/kineto/libkineto (pytorch/kineto#1480) e804b8f
- Un-deselect some profiler tests after fixing them (pytorch/kineto#1432) 446ac67
- Test controller async request arbitration (pytorch/kineto#1477) d579d88
- Annotation fixups (pytorch/kineto#1476) 994e6c5
Pull Request resolved: pytorch#190687
Approved by: https://github.com/Skylion007, https://github.com/scotts
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
Includes the following commits:

- Add XPU toggleCollectionDynamic mechanism (pytorch/kineto#1410) cb29370
- Explicitly wrap NCCL strings in output json (pytorch/kineto#1482) d62c7f5
- emit GPU_USER_ANNOTATION for user record_function ranges (pytorch/kineto#1393) a8fd013
- Re-select test_basic_chrome_trace_cpu on XPU (pytorch/kineto#1484) f451dfc
- Fix CQS signal readability-avoid-const-params-in-decls in fbcode/kineto/libkineto (pytorch/kineto#1486) c4e1538
- Add NCCL collective metadata fields to the catalog (pytorch/kineto#1483) a31870c
- Add addTypedMetadata to GenericTraceActivity (pytorch/kineto#1485) 29ab453
- Centralize MetadataField definitions (pytorch/kineto#1481) 9c49dca
- Add XCCL collective communication activity tracing to XPU plugin (pytorch/kineto#1396) a97543e
- Fix CQS signal modernize-use-scoped-lock in fbcode/kineto/libkineto (pytorch/kineto#1480) e804b8f
- Un-deselect some profiler tests after fixing them (pytorch/kineto#1432) 446ac67
- Test controller async request arbitration (pytorch/kineto#1477) d579d88
- Annotation fixups (pytorch/kineto#1476) 994e6c5
Pull Request resolved: pytorch#190687
Approved by: https://github.com/Skylion007, https://github.com/scotts
MelindaTan pushed a commit to MelindaTan/pytorch that referenced this pull request Jul 31, 2026
Includes the following commits:

- Add XPU toggleCollectionDynamic mechanism (pytorch/kineto#1410) cb29370
- Explicitly wrap NCCL strings in output json (pytorch/kineto#1482) d62c7f5
- emit GPU_USER_ANNOTATION for user record_function ranges (pytorch/kineto#1393) a8fd013
- Re-select test_basic_chrome_trace_cpu on XPU (pytorch/kineto#1484) f451dfc
- Fix CQS signal readability-avoid-const-params-in-decls in fbcode/kineto/libkineto (pytorch/kineto#1486) c4e1538
- Add NCCL collective metadata fields to the catalog (pytorch/kineto#1483) a31870c
- Add addTypedMetadata to GenericTraceActivity (pytorch/kineto#1485) 29ab453
- Centralize MetadataField definitions (pytorch/kineto#1481) 9c49dca
- Add XCCL collective communication activity tracing to XPU plugin (pytorch/kineto#1396) a97543e
- Fix CQS signal modernize-use-scoped-lock in fbcode/kineto/libkineto (pytorch/kineto#1480) e804b8f
- Un-deselect some profiler tests after fixing them (pytorch/kineto#1432) 446ac67
- Test controller async request arbitration (pytorch/kineto#1477) d579d88
- Annotation fixups (pytorch/kineto#1476) 994e6c5
Pull Request resolved: pytorch#190687
Approved by: https://github.com/Skylion007, https://github.com/scotts
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.

1 participant