惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
Help Net Security
Help Net Security
PCI Perspectives
PCI Perspectives
T
The Blog of Author Tim Ferriss
H
Heimdal Security Blog
The Register - Security
The Register - Security
Schneier on Security
Schneier on Security
宝玉的分享
宝玉的分享
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
C
CERT Recently Published Vulnerability Notes
L
LangChain Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
MongoDB | Blog
MongoDB | Blog
美团技术团队
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
Cisco Talos Blog
Cisco Talos Blog
C
Cybersecurity and Infrastructure Security Agency CISA
月光博客
月光博客
B
Blog RSS Feed
Cyberwarzone
Cyberwarzone
U
Unit 42
AWS News Blog
AWS News Blog
F
Fortinet All Blogs
L
LINUX DO - 最新话题
GbyAI
GbyAI
T
Threat Research - Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
Attack and Defense Labs
Attack and Defense Labs
Engineering at Meta
Engineering at Meta
MyScale Blog
MyScale Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
V2EX - 技术
V2EX - 技术
Y
Y Combinator Blog
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
TaoSecurity Blog
TaoSecurity Blog
博客园_首页
C
CXSECURITY Database RSS Feed - CXSecurity.com
M
MIT News - Artificial intelligence
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Hacker News: Front Page

Lei Mao's Log Book

2026 FIFA World Cup 备受嘲讽的会徽 Python Debugging Via VS Code In Docker Container Vargas Plateau Regional Park 徒步 Vargas Plateau Regional Park Apex 2026 FIFA World Cup 小组赛赛程 Retaining EXIF Metadata In GIMP San Francisquito Creek Joint Powers Authority 2025 Calendar Photo 麦当劳 The FIFA World Cup 套餐 Ardenwood Historic Farm 徒步 Ardenwood Historic Farm Synchronizations With TorchRec KeyedJaggedTensor Pacific Commons Linear Park 徒步 Pacific Commons Linear Park 2026 San Jose Half Marathon 竞赛 目标 Mountain View Shoreline Park 徒步 Mountain View Shoreline Park PyTorch AOTInductor Hybrid Lowering Carquinez Strait Regional Shoreline 徒步 Carquinez Strait Regional Shoreline PyTorch Triton Kernel Transparent Tracing and Compilation 脸庞 PyTorch Fake Export 2026 BRAIN Foundation 10K 竞赛 2026 Wild and Scenic Film Festival 参观 2026 Wild and Scenic Film Festival 系统工程程序员修 Bug FIFA 官方网站的语言 PyTorch Custom Operation 汉堡王 The Mandalorian and Grogu 套餐 Tilden Regional Parks Botanic Garden 参观 Tilden Regional Park Tilden Regional Parks Botanic Garden Tilden Regional Park 徒步 《寻秦记》电影版 ICML 2026 Area Chair Experience 2026 Foster City 5K Fun Run 竞赛 2026 年 3 月和 4 月该入手的模型手办 Docker Container GUI Display Using Wayland 马拉松破二 2026 Heart & Soles Run 5K 竞赛 How Is FARS, The Fully Automated Research System? 算计: 七天的死亡游戏 Lake Chabot Regional Park 徒步 Lake Chabot Regional Park 2023 年恐怖电影《感恩节》 2026 Airport Runway Run at San Carlos Airport 5K 竞赛 Page Table for Page-Locked Host Memory Don Edwards San Francisco Bay National Wildlife Refuge - Ravenswood 徒步 Don Edwards San Francisco Bay National Wildlife Refuge - Ravenswood 法外风云 PyTorch Graph Symbolic Integer Contra Costa Canal Regional Trail 徒步 Contra Costa Canal Regional Trail 娑婆诃 PyTorch Export 2026 Western Pacific 5K 竞赛 浮躁的科研和胡扯的自媒体 Connecting Logitech Devices On Linux 2026 Oakland Half Marathon 竞赛 Del Valle Regional Park 徒步 Del Valle Regional Park CUDA_LAUNCH_BLOCKING=1 踏切时间 Wildcat Canyon Regional Park 徒步 Wildcat Canyon Regional Park Credit Card Unauthorized Transaction While In Possession 莎拉的真伪人生 2026 Union City Superhero Fun Run 5K 竞赛 McLaughlin Eastshore State Park 徒步 McLaughlin Eastshore State Park Cloudflare Worker Proxy R2 Bucket Access Zorro 和 Batman Fix MacBook Pro Space Key Stuck Problem 2026 年 1 月和 2 月该入手的模型手办 2026 Brazen Victory 10K 竞赛 儿时的玩伴李峰 Marsh Creek Regional Trail 徒步 Marsh Creek Regional Trail 百万人推理 System Performance Optimizations QQ 幻想 2026 Brazen Bay Breeze 5K 竞赛 CUDA Shared Memory Bank Conflict-Free Vectorized Access Dota 闪电站出售 Mountain View Downtown 徒步 Mountain View Downtown C++ Latch and Barrier 2025 年跑步总结 2026 Rotary Mission Ten Half Marathon 竞赛 狗的素质等于人的素质 CUDA Rendezvous Stream Pleasanton Ridge Regional Park 徒步 Pleasanton Ridge Regional Park Xfinity Internet 多年来的使用感受 Randomized SVD Don Castro Regional Recreation Area 徒步 Don Castro Regional Recreation Area 拖车公司的大汉们
Perfetto GPU Flow Artifacts
2026-02-20 · via Lei Mao's Log Book

Introduction

Performance software engineers often need to profile and analyze the performance of their applications. One of the tools that can serve for this purpose is Perfetto, a powerful open-source performance tracing system. However, Perfetto trace rendering can sometimes be confusing to read, especially for the flows that indicates the dependency between different events.

In this blog post, I would like to discuss the root cause of the problem and suggest a potential solution to fix the issue.

Perfetto Flow Artifacts

Sometimes, we will see flows in Perfetto traces that do not match our expectation. For example, one CUDA kernel launch function from CPU can only launch one CUDA kernel on GPU. But in some cases, we can see multiple flows from one CUDA kernel launch function on CPU to multiple CUDA kernels on GPU, which is not possible in reality. Moreover, in some cases, we can see CUDA synchronization events flow from GPU back to a CPU function that completes even before the CUDA synchronization function call from CPU, which is also not possible in reality.

An Artifact of Multiple Events Submitted from One Event

Since Perfetto renders traces from raw trace data, previously I do not know if the problem is caused by the trace rendering or the trace data collection. So this time, I did a little bit of investigation.

There are mainly three types of events in the trace data: complete events, flow start events, and flow end events. The complete events are represented by "ph": "X", the flow start events are represented by "ph": "s", and the flow end events are represented by "ph": "f". "ts" is the time stamp of the event, and "dur" is the duration of the event. The flow start and end events with the same "id" are considered as a flow, and the time span of the flow is from the time stamp of the flow start event to the time stamp of the flow end event. The args field of each event contains the metadata of the event, which will not be used for Perfetto trace rendering.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"ph": "X", "cat": "cpu_op", "name": "MseLossBackward0", "pid": 237, "tid": 257,
"ts": 919730262716.414, "dur": 79.231,
"args": {
"External id": 514,"Sequence number": 59, "Fwd thread id": 1, "Record function id": 0, "Concrete Inputs": [""], "Input type": ["float"], "Input Strides": [[]], "Input Dims": [[]], "Ev Idx": 1
}
},
{
"ph": "f", "id": 1, "pid": 237, "tid": 257, "ts": 919730262716.414,
"cat": "fwdbwd", "name": "fwdbwd", "bp": "e"
},
{
"ph": "s", "id": 15, "pid": 237, "tid": 237, "ts": 919730261596.889,
"cat": "fwdbwd", "name": "fwdbwd"
},

Perfetto will use "id" to associate the flow start and end events. However, there is no data specifying which complete events the flow start and end events are associated with. Therefore, Perfetto will just match the flow start and end events into the complete events whose time span covers the flow start time stamp or flow end time stamp. Normally, this should work pretty well.

However, what if I have two complete events which execute sequentially and there is no time gap between the end of the first complete event and the start of the second complete event? For example, we have two complete events with the following time stamps and durations, and each of them has an associated flow start event at the end of the complete event.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"ph": "X", "cat": "cpu_op", "name": "MseLossBackward0", "pid": 237, "tid": 257,
"ts": 100, "dur": 10,
},
{
"ph": "X", "cat": "cpu_op", "name": "MseLossBackward1", "pid": 237, "tid": 257,
"ts": 110, "dur": 10,
},
{
"ph": "s", "id": 1, "pid": 237, "tid": 257, "ts": 110,
"cat": "fwdbwd", "name": "fwdbwd0",
},
{
"ph": "s", "id": 2, "pid": 237, "tid": 257, "ts": 120,
"cat": "fwdbwd", "name": "fwdbwd1",
},

Because we know or we assume the flow start event will happen at the end of the complete event, we know that fwdbwd0 is associated with MseLossBackward0 and fwdbwd1 is associated with MseLossBackward1. However, Perfetto does not know this assumption and it also cannot make this assumption because it is completely possible that the flow start event can happen at any time during the complete event. Therefore, in this case, there is an ambiguity for Perfetto to determine whether fwdbwd0 is associated with MseLossBackward0 or MseLossBackward1, because fwdbwd0 has the same time stamp as the start time stamp of MseLossBackward1 and the same time stamp as the end time stamp of MseLossBackward0. Therefore, Perfetto will have a chance to associate both fwdbwd0 and fwdbwd1 to MseLossBackward1, which results in an artifact of multiple flows from one complete event.

A trick to fix this issue is to subtract a very small value from the time stamp of the flow start event, so that the flow start event will be unambiguously associated with the complete event that it is supposed to be associated with. For example, we can subtract 0.001 microsecond from the time stamp of the flow start event, which is negligible for human eyes but can help Perfetto to correctly associate the flow start event with the complete event.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"ph": "X", "cat": "cpu_op", "name": "MseLossBackward0", "pid": 237, "tid": 257,
"ts": 100, "dur": 10,
},
{
"ph": "X", "cat": "cpu_op", "name": "MseLossBackward1", "pid": 237, "tid": 257,
"ts": 110, "dur": 10,
},
{
"ph": "s", "id": 1, "pid": 237, "tid": 257, "ts": 109.999,
"cat": "fwdbwd", "name": "fwdbwd0",
},
{
"ph": "s", "id": 2, "pid": 237, "tid": 257, "ts": 119.999,
"cat": "fwdbwd", "name": "fwdbwd1",
},
```

In this case, there is no ambiguity for Perfetto to associate fwdbwd0 with MseLossBackward0 and fwdbwd1 with MseLossBackward1. Consequently, the artifact of multiple flows from one complete event will be resolved.

Conclusions

There is nothing wrong with the Perfetto trace data or rendering. It is just Perfetto does not have enough domain specific knowledge. Remember, Perfetto is a general purpose trace rendering engine, and it is not only used for rendering CPU and GPU events, but also used for rendering events from other domains.