This repository was archived by the owner on Sep 30, 2026. It is now read-only.
Repository navigation
Remove INFO logs from kineto trace metadata to fix invalid JSON (#1336) - #1336
Closed
jiannanWang wants to merge 1 commit into
Closed
jiannanWang wants to merge 1 commit into
jiannanWang wants to merge 1 commit into
Conversation
|
@jiannanWang has exported this pull request. If you are a Meta employee, you can view the originating Diff in D98257725. |
jiannanWang
added a commit
to jiannanWang/kineto
that referenced
this pull request
Apr 1, 2026
…rch#1336) Summary: ## Problem Kineto’s LoggerCollector can capture INFO logs that include unescaped double quotes from activity metadata (example: cudaEvent "event_id": 64, ...). Those quotes can break the JSON, causing json trace parsers to fail. ## Fix Rather than filtering INFO logs at the LoggerCollector level (which is a generic collection class), this PR filters them in GenericActivityProfiler::getLoggerMetadata(), the point where logs are written into the trace. Only WARNING and ERROR entries make it into the metadata map written to the JSON trace. This makes the intent clearer: the filtering is a trace-writing concern, not a general logging concern. LoggerCollector remains generic and continues to collect all log levels (INFO, WARNING, ERROR) as before. Note: This bug only affects dyno traces, not PyTorch profiler traces. The LoggerCollector metadata is written to the trace file through ChromeTraceLogger::finalizeTrace(), used by kineto's on-demand controller path. The Python torch.profiler API uses its own export path that does not include logger metadata. ## Verification Generated traces using `buck2 run @//mode/opt //kineto/libkineto/fb/integration_tests:pytorch_resnet_integration_test -- --enable_profiling --trace_handler=local --num_iters 110`: BEFORE (original kineto) — trace contains INFO section with 10 entries: "INFO": [ "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:526] Enabling GPU tracing with max buffer size 128MB)", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:450] [Profiler = CuptiRangeProfiler] Evaluating whether to run child profiler.", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:463] [Profiler = CuptiRangeProfiler] Not running child profiler.", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:563] Tracing starting in 6s", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:568] Tracing will end in 7s", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:146] Processing 1 CPU buffers", "INFO:2026-03-30 16:01:31 2519601:2519601 CuptiActivityProfiler.cpp:196] Processed 239252 GPU records (9221680 bytes)", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:218] Record counts: Out-of-range = 11888, Blocklisted runtime = 74589, Invalid ext correlations = 0, CPU GPU out-of-order = 0, Unexpected CUDA events = 0, GPU stopped early? = 0", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:654] CPU Traces Recorded:", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:657] PyTorch Profiler: 1 span(s) recorded" ], AFTER (patched kineto) — no INFO section in trace. Reviewed By: scotts Differential Revision: D98257725
jiannanWang
force-pushed
the
export-D98257725
branch
from
April 1, 2026 00:02
4ee01f3 to
bef1de3
Compare
…rch#1336) Summary: Pull Request resolved: pytorch#1336 ## Problem Kineto’s LoggerCollector can capture INFO logs that include unescaped double quotes from activity metadata (example: cudaEvent "event_id": 64, ...). Those quotes can break the JSON, causing json trace parsers to fail. ## Fix Rather than filtering INFO logs at the LoggerCollector level (which is a generic collection class), this PR filters them in GenericActivityProfiler::getLoggerMetadata(), the point where logs are written into the trace. Only WARNING and ERROR entries make it into the metadata map written to the JSON trace. This makes the intent clearer: the filtering is a trace-writing concern, not a general logging concern. LoggerCollector remains generic and continues to collect all log levels (INFO, WARNING, ERROR) as before. Note: This bug only affects dyno traces, not PyTorch profiler traces. The LoggerCollector metadata is written to the trace file through ChromeTraceLogger::finalizeTrace(), used by kineto's on-demand controller path. The Python torch.profiler API uses its own export path that does not include logger metadata. ## Verification Generated traces using `buck2 run @//mode/opt //kineto/libkineto/fb/integration_tests:pytorch_resnet_integration_test -- --enable_profiling --trace_handler=local --num_iters 110`: BEFORE (original kineto) — trace contains INFO section with 10 entries: "INFO": [ "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:526] Enabling GPU tracing with max buffer size 128MB)", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:450] [Profiler = CuptiRangeProfiler] Evaluating whether to run child profiler.", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:463] [Profiler = CuptiRangeProfiler] Not running child profiler.", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:563] Tracing starting in 6s", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:568] Tracing will end in 7s", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:146] Processing 1 CPU buffers", "INFO:2026-03-30 16:01:31 2519601:2519601 CuptiActivityProfiler.cpp:196] Processed 239252 GPU records (9221680 bytes)", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:218] Record counts: Out-of-range = 11888, Blocklisted runtime = 74589, Invalid ext correlations = 0, CPU GPU out-of-order = 0, Unexpected CUDA events = 0, GPU stopped early? = 0", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:654] CPU Traces Recorded:", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:657] PyTorch Profiler: 1 span(s) recorded" ], AFTER (patched kineto) — no INFO section in trace. Reviewed By: scotts Differential Revision: D98257725
jiannanWang
force-pushed
the
export-D98257725
branch
from
April 1, 2026 00:05
bef1de3 to
3941ae7
Compare
|
This pull request has been merged in 502c513. |
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
Summary: Pull Request resolved: pytorch/kineto#1336 ## Problem Kineto’s LoggerCollector can capture INFO logs that include unescaped double quotes from activity metadata (example: cudaEvent "event_id": 64, ...). Those quotes can break the JSON, causing json trace parsers to fail. ## Fix Rather than filtering INFO logs at the LoggerCollector level (which is a generic collection class), this PR filters them in GenericActivityProfiler::getLoggerMetadata(), the point where logs are written into the trace. Only WARNING and ERROR entries make it into the metadata map written to the JSON trace. This makes the intent clearer: the filtering is a trace-writing concern, not a general logging concern. LoggerCollector remains generic and continues to collect all log levels (INFO, WARNING, ERROR) as before. Note: This bug only affects dyno traces, not PyTorch profiler traces. The LoggerCollector metadata is written to the trace file through ChromeTraceLogger::finalizeTrace(), used by kineto's on-demand controller path. The Python torch.profiler API uses its own export path that does not include logger metadata. ## Verification Generated traces using `buck2 run @//mode/opt //kineto/libkineto/fb/integration_tests:pytorch_resnet_integration_test -- --enable_profiling --trace_handler=local --num_iters 110`: BEFORE (original kineto) — trace contains INFO section with 10 entries: "INFO": [ "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:526] Enabling GPU tracing with max buffer size 128MB)", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:450] [Profiler = CuptiRangeProfiler] Evaluating whether to run child profiler.", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:463] [Profiler = CuptiRangeProfiler] Not running child profiler.", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:563] Tracing starting in 6s", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:568] Tracing will end in 7s", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:146] Processing 1 CPU buffers", "INFO:2026-03-30 16:01:31 2519601:2519601 CuptiActivityProfiler.cpp:196] Processed 239252 GPU records (9221680 bytes)", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:218] Record counts: Out-of-range = 11888, Blocklisted runtime = 74589, Invalid ext correlations = 0, CPU GPU out-of-order = 0, Unexpected CUDA events = 0, GPU stopped early? = 0", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:654] CPU Traces Recorded:", "INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:657] PyTorch Profiler: 1 span(s) recorded" ], AFTER (patched kineto) — no INFO section in trace. Reviewed By: scotts Differential Revision: D98257725 fbshipit-source-id: 8b22597601c6c092e0566fc711fcb5bf0282665a 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:
Problem
Kineto’s LoggerCollector can capture INFO logs that include unescaped double quotes from activity metadata (example: cudaEvent "event_id": 64, ...). Those quotes can break the JSON, causing json trace parsers to fail.
Fix
Rather than filtering INFO logs at the LoggerCollector level (which is a generic collection class), this PR filters them in GenericActivityProfiler::getLoggerMetadata(), the point where logs are written into the trace. Only WARNING and ERROR entries make it into the metadata map written to the JSON trace.
This makes the intent clearer: the filtering is a trace-writing concern, not a general logging concern. LoggerCollector remains generic and continues to collect all log levels (INFO, WARNING, ERROR) as before.
Note: This bug only affects dyno traces, not PyTorch profiler traces. The LoggerCollector metadata is written to the trace file through ChromeTraceLogger::finalizeTrace(), used by kineto's on-demand controller path. The Python torch.profiler API uses its own export path that does not include logger metadata.
Verification
Generated traces using
buck2 run @//mode/opt //kineto/libkineto/fb/integration_tests:pytorch_resnet_integration_test -- --enable_profiling --trace_handler=local --num_iters 110:BEFORE (original kineto) — trace contains INFO section with 10 entries:
"INFO": [
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:526] Enabling GPU tracing with max buffer size 128MB)",
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:450] [Profiler = CuptiRangeProfiler] Evaluating whether to run child profiler.",
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:463] [Profiler = CuptiRangeProfiler] Not running child profiler.",
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:563] Tracing starting in 6s",
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:568] Tracing will end in 7s",
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:146] Processing 1 CPU buffers",
"INFO:2026-03-30 16:01:31 2519601:2519601 CuptiActivityProfiler.cpp:196] Processed 239252 GPU records (9221680 bytes)",
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:218] Record counts: Out-of-range = 11888, Blocklisted runtime = 74589, Invalid ext correlations = 0, CPU GPU out-of-order = 0, Unexpected CUDA events = 0, GPU stopped early? = 0",
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:654] CPU Traces Recorded:",
"INFO:2026-03-30 16:01:31 2519601:2519601 GenericActivityProfiler.cpp:657] PyTorch Profiler: 1 span(s) recorded"
],
AFTER (patched kineto) — no INFO section in trace.
Reviewed By: scotts
Differential Revision: D98257725