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:

opCUDA totalCPU totalcallsmemory
aten::matmul38.4 ms4.1 ms180 B
aten::_scaled_dot_product_flash_attention31.7 ms2.9 ms180 B
aten::copy_19.6 ms20.4 ms542.8 GiB
aten::to15.1 ms16.8 ms542.8 GiB
aten::slice1.4 ms7.9 ms4360 B
tokenizer.encode0 ms22.0 ms10 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:

  1. Two hypotheses for why copy_ and to are present.
  2. One experiment that would confirm or reject each hypothesis.
  3. One thing you would not optimize yet, and why.

Acceptance criteria

A good answer:

  1. Separates model math from avoidable movement.
  2. Mentions that tokenizer CPU time is outside GPU execution but still affects request latency.
  3. Does not propose writing a custom attention kernel while copies and casts are unexplained.
  4. 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.