This repository was archived by the owner on Sep 30, 2026. It is now read-only.
Repository navigation
Fix GPU trace collection on ROCm by ensuring early rocprofiler-sdk tool registration - #1338
Closed
zhangruiskyline wants to merge 1 commit into
Closed
zhangruiskyline wants to merge 1 commit into
zhangruiskyline wants to merge 1 commit into
Conversation
…ol registration Summary: On ROCm/AMD systems, PyTorch profiler traces were missing GPU kernel events (0 GPU records). The root cause is a race condition in rocprofiler-sdk tool registration: if any HIP/GPU activity occurs before Kineto registers as a profiling tool, rocprofiler-sdk skips the registration callback and no GPU kernel events are captured. The fix adds `RocprofLogger::ensureRegistered()` which explicitly calls `rocprofiler_force_configure()` to guarantee tool registration happens early, regardless of HIP initialization order. This is called: 1. From `libkineto_init()` — before any profiler setup 2. From `startLogging()` — as a fallback if init didn't run This follows the same pattern used by XLA's ROCm profiler integration. Additionally, `rocprofiler_hide.lds` hides all `rocprofiler_*` symbols on AMD builds, which prevents the passive symbol-discovery registration mechanism. The explicit `force_configure` call bypasses this limitation. Differential Revision: D99105057
|
@zhangruiskyline has exported this pull request. If you are a Meta employee, you can view the originating Diff in D99105057. |
|
This pull request has been merged in 4ff89e8. |
scotts
added a commit
to scotts/pytorch
that referenced
this pull request
Apr 9, 2026
Includes the following commits: - 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 - remove the rocprofiler early exit hack (pytorch/kineto#1329) 0c8ede0 Authored with Claude.
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
…ol registration (#1338) Summary: Pull Request resolved: pytorch/kineto#1338 On ROCm/AMD systems, PyTorch profiler traces were missing GPU kernel events (0 GPU records). The root cause is a race condition in rocprofiler-sdk tool registration: if any HIP/GPU activity occurs before Kineto registers as a profiling tool, rocprofiler-sdk skips the registration callback and no GPU kernel events are captured. The fix adds `RocprofLogger::ensureRegistered()` which explicitly calls `rocprofiler_force_configure()` to guarantee tool registration happens early, regardless of HIP initialization order. This is called: 1. From `libkineto_init()` — before any profiler setup 2. From `startLogging()` — as a fallback if init didn't run This follows the same pattern used by XLA's ROCm profiler integration. Additionally, `rocprofiler_hide.lds` hides all `rocprofiler_*` symbols on AMD builds, which prevents the passive symbol-discovery registration mechanism. The explicit `force_configure` call bypasses this limitation. Reviewed By: royren622 Differential Revision: D99105057 fbshipit-source-id: 1cb104f7c1b9918a7a4123162d1b3d8a91d13154 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
On ROCm/AMD systems, PyTorch profiler traces were missing GPU kernel events
(0 GPU records). The root cause is a race condition in rocprofiler-sdk tool
registration: if any HIP/GPU activity occurs before Kineto registers as a
profiling tool, rocprofiler-sdk skips the registration callback and no GPU
kernel events are captured.
The fix adds
RocprofLogger::ensureRegistered()which explicitly callsrocprofiler_force_configure()to guarantee tool registration happensearly, regardless of HIP initialization order. This is called:
libkineto_init()— before any profiler setupstartLogging()— as a fallback if init didn't runThis follows the same pattern used by XLA's ROCm profiler integration.
Additionally,
rocprofiler_hide.ldshides allrocprofiler_*symbols onAMD builds, which prevents the passive symbol-discovery registration
mechanism. The explicit
force_configurecall bypasses this limitation.Differential Revision: D99105057