Repository navigation
perf: deduplicate SnapshotDB callstacks and skip Frame rebuild in split #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,20 @@ queries: | |
| required: false | ||
| description: Number of rows to skip | ||
| query: | | ||
| SELECT * FROM {{ device_trace_table }} | ||
| SELECT | ||
| id, | ||
| action, | ||
| address, | ||
| size, | ||
| stream, | ||
| allocated, | ||
| active, | ||
| reserved, | ||
| ( | ||
| SELECT callstack FROM callstack | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [低] 旧布局数据库上此模板硬失败: 用真实管线( 问题链路: 建议:渲染前探测缺列/缺表时给出友好的 schema 不匹配提示(引导重新导入)或做兼容回退;同步修订 docs 中该句;补一个锁定该行为的测试。 |
||
| WHERE callstack.id = {{ device_trace_table }}.callstackId | ||
| ) AS callstack | ||
| FROM {{ device_trace_table }} | ||
| WHERE 1=1 | ||
| {% if id is not none %}AND id = {{ id }}{% endif %} | ||
| {% if min_id is not none %}AND id >= {{ min_id }}{% endif %} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,16 +24,25 @@ queries: | |
| description: Maximum rows to return (-1 for unlimited). Mirrored from the caller-side ``max_rows`` for SQL pushdown. | ||
| query: | | ||
| SELECT | ||
| callstack, | ||
| COUNT(*) as alloc_count, | ||
| SUM(size) as total_size, | ||
| AVG(size) as avg_size, | ||
| MAX(size) as max_size | ||
| FROM {{ device_trace_table }} | ||
| WHERE callstack IS NOT NULL | ||
| GROUP BY callstack | ||
| HAVING alloc_count >= {{ min_count }} | ||
| AND total_size >= {{ min_size }} | ||
| COALESCE(c.callstack, '[missing callstack]') AS callstack, | ||
| grouped.alloc_count AS alloc_count, | ||
| grouped.total_size AS total_size, | ||
| grouped.avg_size AS avg_size, | ||
| grouped.max_size AS max_size | ||
| FROM ( | ||
| SELECT | ||
| callstackId, | ||
| COUNT(*) as alloc_count, | ||
| SUM(size) as total_size, | ||
| AVG(size) as avg_size, | ||
| MAX(size) as max_size | ||
| FROM {{ device_trace_table }} | ||
| WHERE callstackId IS NOT NULL | ||
| GROUP BY callstackId | ||
| HAVING alloc_count >= {{ min_count }} | ||
| AND total_size >= {{ min_size }} | ||
| ) AS grouped | ||
| LEFT JOIN callstack c ON c.id = grouped.callstackId | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [提示] 悬空分组经结果映射后显示为字符串 "None"
|
||
| ORDER BY total_size DESC, callstack ASC | ||
| LIMIT {{ limit|int }} | ||
| output_schema: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[低]
_raw_frames=True使 torch-npu workspace 块在切片中丢失帧simulate.py:124-131的_adapt_workspace_snapshot构造 Block 时只传frames=existed_seg.frames——raw 模式下它是[](entities.py:241-242)——且未传播_raw_frames,于是Block.to_dict()序列化为"frames": [](entities.py:196-200)。PR 之前 eager 路径经Frame._origin能回传真实帧。该适配块经slice_dump/hooker.py:99-101深拷贝进入切片文件。不影响回放有效性与 DB 导入(
block2record无帧列),也不崩溃,但 npu workspace 快照(首事件为workspace_snapshot)的切片相对变更前静默丢数据。其余所有构造点均正确传播_raw_frames(Block.build_from_event、Segment.build_from_event、snapshot_mutator.py:267-296),此处是唯一遗漏。修复:Block 构造补传
_raw_frames=existed_seg._raw_frames;现有test_workspace_marker_splits_and_replays用的正是"frames": [],无法捕获该问题,需补一个带非空 workspace segment 帧的 split 测试。