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

Fix NCCL metadata missing on GPU kernels due to CUPTI buffer ordering (#1354) - #1354

Closed
jiannanWang wants to merge 1 commit into
pytorch:mainfrom
jiannanWang:export-D100050069
Closed

jiannanWang wants to merge 1 commit into
pytorch:mainfrom
jiannanWang:export-D100050069

Conversation

@jiannanWang

@jiannanWang jiannanWang commented Apr 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

CUPTI provides no ordering guarantee for activity records in its buffers. When EXTERNAL_CORRELATION records (which link GPU kernels to CPU ops like NCCL record_param_comms) arrive after their corresponding CONCURRENT_KERNEL records, the linkedActivity() lookup fails because cpuCorrelationMap_ has not been populated yet. This causes all NCCL collective metadata (collective name, dtype, message sizes, group size, etc.) to be silently dropped from
GPU kernel trace output.

Fix: Split processGpuActivities into two passes over the CUPTI activity buffer:

  • Pass 1: Process only EXTERNAL_CORRELATION records to fully populate cpuCorrelationMap_ and userCorrelationMap_.
  • Pass 2: Process all remaining activities (kernels, sync events, etc.) which can now resolve their linked CPU activity regardless of buffer order.

Differential Revision: D100050069

@meta-cla meta-cla Bot added the cla signed label Apr 8, 2026
@meta-codesync

meta-codesync Bot commented Apr 8, 2026

Copy link
Copy Markdown

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

jiannanWang added a commit to jiannanWang/kineto that referenced this pull request Apr 9, 2026
…pytorch#1354)

Summary:

CUPTI provides no ordering guarantee for activity records in its buffers. When EXTERNAL_CORRELATION records (which link GPU kernels to CPU ops like NCCL record_param_comms) arrive after their corresponding CONCURRENT_KERNEL records, the linkedActivity() lookup fails because cpuCorrelationMap_ has not been populated yet. This causes all NCCL collective metadata (collective name, dtype, message sizes, group size, etc.) to be silently dropped from
GPU kernel trace output.

Fix: Split processGpuActivities into two passes over the CUPTI activity buffer:
- Pass 1: Process only EXTERNAL_CORRELATION records to fully populate cpuCorrelationMap_ and userCorrelationMap_.
- Pass 2: Process all remaining activities (kernels, sync events, etc.) which can now resolve their linked CPU activity regardless of buffer order.

Differential Revision: D100050069
…pytorch#1354)

Summary:

CUPTI provides no ordering guarantee for activity records in its buffers. When EXTERNAL_CORRELATION records (which link GPU kernels to CPU ops like NCCL record_param_comms) arrive after their corresponding CONCURRENT_KERNEL records, the linkedActivity() lookup fails because cpuCorrelationMap_ has not been populated yet. This causes all NCCL collective metadata (collective name, dtype, message sizes, group size, etc.) to be silently dropped from
GPU kernel trace output.

Fix: Split processGpuActivities into two passes over the CUPTI activity buffer:
- Pass 1: Process only EXTERNAL_CORRELATION records to fully populate cpuCorrelationMap_ and userCorrelationMap_.
- Pass 2: Process all remaining activities (kernels, sync events, etc.) which can now resolve their linked CPU activity regardless of buffer order.

Differential Revision: D100050069
@meta-codesync meta-codesync Bot changed the title Fix NCCL metadata missing on GPU kernels due to CUPTI buffer ordering Fix NCCL metadata missing on GPU kernels due to CUPTI buffer ordering (#1354) Apr 9, 2026
@meta-codesync meta-codesync Bot closed this in 360873c Apr 9, 2026
@meta-codesync

meta-codesync Bot commented Apr 9, 2026

Copy link
Copy Markdown

This pull request has been merged in 360873c.

scotts added a commit to scotts/pytorch that referenced this pull request Apr 10, 2026
Includes the following commits:

- Emit USDT logger messages on profiler start/stop (pytorch/kineto#1325) b2103f7
- Fix NCCL metadata missing on GPU kernels due to CUPTI buffer ordering (pytorch/kineto#1354) 360873c
- Modernize target_link_libraries in Cmakelists.txt (pytorch/kineto#1283) 2b26470
- Replace shared_ptr singleton with Meyers singleton in CuptiCallbackApi (pytorch/kineto#1350) f287ee7
- Fix XpuptiProfilerTest link error and double free crash (pytorch/kineto#1349) eea2334
- Fix missing wait_on_cuda_event_record_corr_id in Event Synchronize activities (pytorch/kineto#1318) f689d8a
- approximate clock fast path for arm (pytorch/kineto#1333) ec4a9b0
- Fix ABBA deadlock in bufferCompleted when verbose logging is enabled (pytorch/kineto#1347) 404f8cd
- refactor JSON chrome trace writing (pytorch/kineto#1342) c51fcfe
- Fix GPU trace collection on ROCm by ensuring early rocprofiler-sdk tool registration (pytorch/kineto#1338) 4ff89e8
- Remove tb_plugin CI workflows (pytorch/kineto#1341) e335a7d
- Remove INFO logs from kineto trace metadata to fix invalid JSON (pytorch/kineto#1336) 502c513
- Expose occupany limiting factors (pytorch/kineto#1330) 185fe9c

Authored with Claude.
pytorchmergebot pushed a commit to pytorch/pytorch that referenced this pull request Apr 10, 2026
Includes the following commits:

- Emit USDT logger messages on profiler start/stop (pytorch/kineto#1325) b2103f7
- Fix NCCL metadata missing on GPU kernels due to CUPTI buffer ordering (pytorch/kineto#1354) 360873c
- Modernize target_link_libraries in Cmakelists.txt (pytorch/kineto#1283) 2b26470
- Replace shared_ptr singleton with Meyers singleton in CuptiCallbackApi (pytorch/kineto#1350) f287ee7
- Fix XpuptiProfilerTest link error and double free crash (pytorch/kineto#1349) eea2334
- Fix missing wait_on_cuda_event_record_corr_id in Event Synchronize activities (pytorch/kineto#1318) f689d8a
- approximate clock fast path for arm (pytorch/kineto#1333) ec4a9b0
- Fix ABBA deadlock in bufferCompleted when verbose logging is enabled (pytorch/kineto#1347) 404f8cd
- refactor JSON chrome trace writing (pytorch/kineto#1342) c51fcfe
- Fix GPU trace collection on ROCm by ensuring early rocprofiler-sdk tool registration (pytorch/kineto#1338) 4ff89e8
- Remove tb_plugin CI workflows (pytorch/kineto#1341) e335a7d
- Remove INFO logs from kineto trace metadata to fix invalid JSON (pytorch/kineto#1336) 502c513
- Expose occupany limiting factors (pytorch/kineto#1330) 185fe9c

Authored with Claude.
Pull Request resolved: #179906
Approved by: https://github.com/ryanzhang22
gplutop7 pushed a commit to gplutop7/pytorch that referenced this pull request Jul 15, 2026
Includes the following commits:

- Emit USDT logger messages on profiler start/stop (pytorch/kineto#1325) b2103f7
- Fix NCCL metadata missing on GPU kernels due to CUPTI buffer ordering (pytorch/kineto#1354) 360873c
- Modernize target_link_libraries in Cmakelists.txt (pytorch/kineto#1283) 2b26470
- Replace shared_ptr singleton with Meyers singleton in CuptiCallbackApi (pytorch/kineto#1350) f287ee7
- Fix XpuptiProfilerTest link error and double free crash (pytorch/kineto#1349) eea2334
- Fix missing wait_on_cuda_event_record_corr_id in Event Synchronize activities (pytorch/kineto#1318) f689d8a
- approximate clock fast path for arm (pytorch/kineto#1333) ec4a9b0
- Fix ABBA deadlock in bufferCompleted when verbose logging is enabled (pytorch/kineto#1347) 404f8cd
- refactor JSON chrome trace writing (pytorch/kineto#1342) c51fcfe
- Fix GPU trace collection on ROCm by ensuring early rocprofiler-sdk tool registration (pytorch/kineto#1338) 4ff89e8
- Remove tb_plugin CI workflows (pytorch/kineto#1341) e335a7d
- Remove INFO logs from kineto trace metadata to fix invalid JSON (pytorch/kineto#1336) 502c513
- Expose occupany limiting factors (pytorch/kineto#1330) 185fe9c

Authored with Claude.
Pull Request resolved: pytorch#179906
Approved by: https://github.com/ryanzhang22
ani300 pushed a commit to IBM/kineto-spyre that referenced this pull request Jul 28, 2026
… (#1354)

Summary:
Pull Request resolved: pytorch/kineto#1354

CUPTI provides no ordering guarantee for activity records in its buffers. When EXTERNAL_CORRELATION records (which link GPU kernels to CPU ops like NCCL record_param_comms) arrive after their corresponding CONCURRENT_KERNEL records, the linkedActivity() lookup fails because cpuCorrelationMap_ has not been populated yet. This causes all NCCL collective metadata (collective name, dtype, message sizes, group size, etc.) to be silently dropped from
GPU kernel trace output.

Fix: Split processGpuActivities into two passes over the CUPTI activity buffer:
- Pass 1: Process only EXTERNAL_CORRELATION records to fully populate cpuCorrelationMap_ and userCorrelationMap_.
- Pass 2: Process all remaining activities (kernels, sync events, etc.) which can now resolve their linked CPU activity regardless of buffer order.

Reviewed By: ryanzhang22

Differential Revision: D100050069

fbshipit-source-id: eb8f020ac444590082de228b356e1e9f68a0a777
Signed-off-by: Antoni Viros i Martin <[email protected]>
aws-kingrj pushed a commit to amazon-contributing/upstream-to-pytorch that referenced this pull request Jul 29, 2026
Includes the following commits:

- Emit USDT logger messages on profiler start/stop (pytorch/kineto#1325) b2103f7
- Fix NCCL metadata missing on GPU kernels due to CUPTI buffer ordering (pytorch/kineto#1354) 360873c
- Modernize target_link_libraries in Cmakelists.txt (pytorch/kineto#1283) 2b26470
- Replace shared_ptr singleton with Meyers singleton in CuptiCallbackApi (pytorch/kineto#1350) f287ee7
- Fix XpuptiProfilerTest link error and double free crash (pytorch/kineto#1349) eea2334
- Fix missing wait_on_cuda_event_record_corr_id in Event Synchronize activities (pytorch/kineto#1318) f689d8a
- approximate clock fast path for arm (pytorch/kineto#1333) ec4a9b0
- Fix ABBA deadlock in bufferCompleted when verbose logging is enabled (pytorch/kineto#1347) 404f8cd
- refactor JSON chrome trace writing (pytorch/kineto#1342) c51fcfe
- Fix GPU trace collection on ROCm by ensuring early rocprofiler-sdk tool registration (pytorch/kineto#1338) 4ff89e8
- Remove tb_plugin CI workflows (pytorch/kineto#1341) e335a7d
- Remove INFO logs from kineto trace metadata to fix invalid JSON (pytorch/kineto#1336) 502c513
- Expose occupany limiting factors (pytorch/kineto#1330) 185fe9c

Authored with Claude.
Pull Request resolved: pytorch#179906
Approved by: https://github.com/ryanzhang22
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