M02.01·Profiling·Core·50 minutes·2 min read
Profiler Triage Report
Turn an operator table into a concise performance report with suspects, evidence, and the next experiment.
- Module
- See inside the box
- Objective
- Read profiler output and write a focused next-step report instead of a vague optimization wishlist.
Prompt
You receive this simplified profiler table for one request:
| op | CUDA total | CPU total | calls | memory |
|---|---|---|---|---|
aten::matmul | 38.4 ms | 4.1 ms | 18 | 0 B |
aten::_scaled_dot_product_flash_attention | 31.7 ms | 2.9 ms | 18 | 0 B |
aten::copy_ | 19.6 ms | 20.4 ms | 54 | 2.8 GiB |
aten::to | 15.1 ms | 16.8 ms | 54 | 2.8 GiB |
aten::slice | 1.4 ms | 7.9 ms | 436 | 0 B |
tokenizer.encode | 0 ms | 22.0 ms | 1 | 0 B |
Workload:
model: decoder-only LLM
prompt: 4096 tokens
output: 128 tokens
dtype: bf16 weights
batch: 1
hardware: L4
Deliverable
Write a five-line report:
Workload:
Hardware:
Top CUDA time:
Top CPU / orchestration cost:
Next experiment:
Then add:
- Two hypotheses for why
copy_andtoare present. - One experiment that would confirm or reject each hypothesis.
- One thing you would not optimize yet, and why.
Acceptance criteria
A good answer:
- Separates model math from avoidable movement.
- Mentions that tokenizer CPU time is outside GPU execution but still affects request latency.
- Does not propose writing a custom attention kernel while copies and casts are unexplained.
- Chooses one next experiment, not five.
Stretch
Add NVTX or record_function ranges you would insert before the next run. Name the ranges exactly.
Debrief
The profiler is a discipline tool. It keeps you from choosing glamorous work before the boring evidence has been handled.