Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.

Explicitly wrap NCCL strings in output json (#1482) - #1482

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

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

Conversation

@ryanzhang22

@ryanzhang22 ryanzhang22 commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

We are moving NCCL metadata to to typed metadata, which means that string fields (collective name, dtype, pg name/desc) arrive unquoted instead of as pre-quoted JSON strings. Normally, appendCollectiveArgs copies these onto the linked GPU-kernel row with addRaw(key, getMetadataValue()). Currently, getMetadataValue() arrives with quotes, so the call is fine. But we will move these to raw strings on the PyTorch side, so these will arrive without quotes and addRaw will paste the value in as is, producing invalid JSON.

To make sure this doesn't break when we make the PyTorch side change, strip strings of quotes and then add them via addQuoted.

TODO in the future is to make NCCL metadata be represented as MetadataFields, then add a CollectiveMetadataVisitor that extracts typed values instead of directly adding raw to the output json.

Reviewed By: scotts

Differential Revision: D112147890

@meta-cla meta-cla Bot added the cla signed label Jul 16, 2026
@meta-codesync

meta-codesync Bot commented Jul 16, 2026

Copy link
Copy Markdown

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

@meta-codesync meta-codesync Bot changed the title Explicitly wrap NCCL strings in output json Explicitly wrap NCCL strings in output json (#1482) Jul 16, 2026
ryanzhang22 added a commit to ryanzhang22/kineto that referenced this pull request Jul 16, 2026
Summary:

We are moving NCCL metadata to to typed metadata, which means that string fields (collective name, dtype, pg name/desc) arrive unquoted instead of as pre-quoted JSON strings. Normally, `appendCollectiveArgs` copies these onto the linked GPU-kernel row with `addRaw(key, getMetadataValue())`. Currently, `getMetadataValue()` arrives with quotes, so the call is fine. But we will move these to raw strings on the PyTorch side, so these will arrive without quotes and `addRaw` will paste the value in as is, producing invalid JSON.

To make sure this doesn't break when we make the PyTorch side change, strip strings of quotes and then add them via `addQuoted`.

TODO in the future is to make NCCL metadata be represented as `MetadataField`s, then add a `CollectiveMetadataVisitor` that extracts typed values instead of directly adding raw to the output json.

Differential Revision: D112147890
ryanzhang22 added a commit to ryanzhang22/kineto that referenced this pull request Jul 17, 2026
Summary:

We are moving NCCL metadata to to typed metadata, which means that string fields (collective name, dtype, pg name/desc) arrive unquoted instead of as pre-quoted JSON strings. Normally, `appendCollectiveArgs` copies these onto the linked GPU-kernel row with `addRaw(key, getMetadataValue())`. Currently, `getMetadataValue()` arrives with quotes, so the call is fine. But we will move these to raw strings on the PyTorch side, so these will arrive without quotes and `addRaw` will paste the value in as is, producing invalid JSON.

To make sure this doesn't break when we make the PyTorch side change, strip strings of quotes and then add them via `addQuoted`.

TODO in the future is to make NCCL metadata be represented as `MetadataField`s, then add a `CollectiveMetadataVisitor` that extracts typed values instead of directly adding raw to the output json.

Differential Revision: D112147890
ryanzhang22 added a commit to ryanzhang22/kineto that referenced this pull request Jul 20, 2026
Summary:

We are moving NCCL metadata to to typed metadata, which means that string fields (collective name, dtype, pg name/desc) arrive unquoted instead of as pre-quoted JSON strings. Normally, `appendCollectiveArgs` copies these onto the linked GPU-kernel row with `addRaw(key, getMetadataValue())`. Currently, `getMetadataValue()` arrives with quotes, so the call is fine. But we will move these to raw strings on the PyTorch side, so these will arrive without quotes and `addRaw` will paste the value in as is, producing invalid JSON.

To make sure this doesn't break when we make the PyTorch side change, strip strings of quotes and then add them via `addQuoted`.

TODO in the future is to make NCCL metadata be represented as `MetadataField`s, then add a `CollectiveMetadataVisitor` that extracts typed values instead of directly adding raw to the output json.

Differential Revision: D112147890
ryanzhang22 added a commit to ryanzhang22/kineto that referenced this pull request Jul 20, 2026
Summary:

We are moving NCCL metadata to to typed metadata, which means that string fields (collective name, dtype, pg name/desc) arrive unquoted instead of as pre-quoted JSON strings. Normally, `appendCollectiveArgs` copies these onto the linked GPU-kernel row with `addRaw(key, getMetadataValue())`. Currently, `getMetadataValue()` arrives with quotes, so the call is fine. But we will move these to raw strings on the PyTorch side, so these will arrive without quotes and `addRaw` will paste the value in as is, producing invalid JSON.

To make sure this doesn't break when we make the PyTorch side change, strip strings of quotes and then add them via `addQuoted`.

TODO in the future is to make NCCL metadata be represented as `MetadataField`s, then add a `CollectiveMetadataVisitor` that extracts typed values instead of directly adding raw to the output json.

Differential Revision: D112147890
Summary:

We are moving NCCL metadata to to typed metadata, which means that string fields (collective name, dtype, pg name/desc) arrive unquoted instead of as pre-quoted JSON strings. Normally, `appendCollectiveArgs` copies these onto the linked GPU-kernel row with `addRaw(key, getMetadataValue())`. Currently, `getMetadataValue()` arrives with quotes, so the call is fine. But we will move these to raw strings on the PyTorch side, so these will arrive without quotes and `addRaw` will paste the value in as is, producing invalid JSON.

To make sure this doesn't break when we make the PyTorch side change, strip strings of quotes and then add them via `addQuoted`.

TODO in the future is to make NCCL metadata be represented as `MetadataField`s, then add a `CollectiveMetadataVisitor` that extracts typed values instead of directly adding raw to the output json.

Reviewed By: scotts

Differential Revision: D112147890
@meta-codesync

meta-codesync Bot commented Jul 21, 2026

Copy link
Copy Markdown

This pull request has been merged in d62c7f5.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant