docs: TraceLens-free trace analysis guide and raw-trace parser - #3
Open
amd-bartgips wants to merge 2 commits into
Open
docs: TraceLens-free trace analysis guide and raw-trace parser#3amd-bartgips wants to merge 2 commits into
amd-bartgips wants to merge 2 commits into
Conversation
New files (additive — existing TRACE_ANALYSIS_GUIDE.md and TraceLens
workflow are unchanged):
- docs/TRACE_ANALYSIS_GUIDE_RAW.md — TraceLens-free analysis guide
- docs/examples/analyze_trace.py — raw Kineto trace parser (stdlib only)
Why
---
TraceLens silently ignores operations it does not recognize. For new models
or new kernels this means the hottest ops are absent from its output, making
the existing guide unusable for that workload. This is a practical blocker
for any run that exercises new operations: the analyst sees an incomplete
or misleading ranking and cannot hand off actionable ticket information.
The raw approach reads cpu_op / kernel / cuda_runtime events directly from
the Kineto/roctracer JSON, attributing GPU kernel time to the launching op
via the correlation chain (kernel.correlation → cuda_runtime.correlation/
External id → cpu_op.External id). Because it never consults a known-op
registry, every operation appears in the output.
What the tool produces
-----------------------
analyze_trace.py:
- op ranking by attributed GPU kernel time (% and absolute ms)
- per-op: full un-truncated GPU kernel names, per-kernel timing breakdown
- per-op: shape variants (Input Dims / Input type / Strides / Concrete
Inputs from the cpu_op args, exactly as Kineto recorded them)
- --json output for downstream tools (e.g. /silotiger-ticket)
- no external dependencies; stdlib gzip + json only
Validated against an MI355 Qwen3-VL w4a4 eager trace — reproduces the
TraceLens baseline exactly (fused_moe_ 32.1%, unified_attention 23.7%,
mha_varlen 13.3%); 37342/37522 kernels attributed (remainder are memcpy /
setup events outside profiled ops).
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why this exists alongside the existing guide
TRACE_ANALYSIS_GUIDE.mdtells analysts to run TraceLens to produce an xlsxreport and then read its sheets for per-op facts. That works well when TraceLens
knows the ops. But TraceLens silently drops operations it does not recognize.
For any trace that exercises new models or new kernels — the exact situation where
we most need a complete picture — the ranking is incomplete and analysts cannot
hand off accurate ticket information.
This PR adds a parallel workflow (nothing in the existing guide is changed or
removed). It reads the raw Kineto/roctracer JSON directly, so every operation
appears in the output regardless of whether TraceLens has seen it before.
Raised in
#tiger-aiter-perf-eng/#tiger-aiter-kernel-support: Sara flaggedthe TraceLens blind-spot; Sami proposed relying on raw trace data for shape
extraction; this is the concrete tooling outcome of that thread.
What's added
docs/examples/analyze_trace.pyStandalone raw-trace parser. No TraceLens, no external packages (stdlib
gzip+jsononly).Reads the Kineto
cpu_op/kernel/cuda_runtimeevent stream, attributesGPU kernel time to its launching op via the correlation chain, and reports:
exactly as Kineto recorded them on the
cpu_opevent)--jsonfor downstream tools (e.g./silotiger-ticket)docs/TRACE_ANALYSIS_GUIDE_RAW.mdNew guide mirroring the structure of
TRACE_ANALYSIS_GUIDE.mdbut replacing theTraceLens extraction sections with raw-trace equivalents driven by the script.
Carries over Sections 3–6 (ticket brief template, reproducer, MoE untuned CSV,
gotchas/checklist) unchanged — those sections were always tool-agnostic. Adds an
explicit note from the Slack thread: report concrete extracted facts; do not
fabricate roofline/NV-comparison targets.
Example output — MI355 Qwen3-VL w4a4 eager trace
Validated against
mi355_w4a4_vllm23_offline_8x_eager.trace.json.gz(17.2 M events, 8× MI355, offline batch).
Op ranking
37,342 / 37,522 kernels attributed (remainder are memcpy / setup events outside
profiled ops). Numbers match the TraceLens baseline to within 0.2%.
--op aiter::fused_moe_— what works wellThis is an op that TraceLens drops from its detail sheet (it treats it as an
aggregation parent and shows 0 rows in
unified_perf_summary). The raw approachgets the full picture:
All five dispatched GPU kernels are named and timed individually. Input shapes
show M=32768 activations (
BFloat16), FP4 gate+up weights[128, 3072, 2048]and down-projection weights
[128, 4096, 768]— physical K, so logical K = ×2.Scale tensors
[128, 3072, 128]and[128, 4096, 48]are also visible(one E8M0 value per 32 weight elements).
--op vllm::unified_attention_with_output— known limitationThe Q tensor shape is visible; KV-cache tensors and scalar parameters are empty —
this is the decode attention problem (gotcha 4/5 in both guides: the kernel reads
KV cache via internal vLLM state, not explicit tensor arguments):
We can read nheads=64, head_dim=128 (padded; logical=72 via softmax_scale), Q dtype
FP8 e4m3fn, output dtype BF16. Block_size, page_size, and KV cache layout remain
invisible — must be read from the serving config or from the KV-cache-writing op
(
aiter::fused_qk_norm_mrope_3d_cache_pts_quant_shuffle, whose Concrete Inputscarry block_size=64 and page_size=16 at positions 24–25). This limitation is the
same whether you use TraceLens or the raw trace; it is a property of how vLLM
passes KV cache state, not of the analysis tool.
What's not duplicated
This PR does not overlap with PR #1. PR #1 added
TRACE_ANALYSIS_GUIDE.md(theTraceLens-based guide). This PR adds two new files alongside it; the existing
guide and any ongoing TraceLens-based workflows are unaffected.
AI assistance
This PR was developed with Claude Code assistance. The commit message, guide
content, script, and PR description were reviewed and are accurate to the best of
my knowledge. The example output was produced by running the script against the
real MI355 trace and is not generated or hallucinated.