/who-ate-my-flops:extract-computation-graphfrom who-ate-my-flops
Reads a PyTorch job's code into records/computation_graph.json and records/execution_schedule.json, mapping expected computation and device movement for later comparison against actual profiles.
Ships in who-ate-my-flops. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
In: the job's code, at a known commit.
Out: records/computation_graph.json and records/execution_schedule.json in the workspace’s records/ directory.
This runs nothing. It records what you expect the job to do. The profile records what it actually did, and you read one against the other.
records/computation_graph.json | records/execution_schedule.json | |
|---|---|---|
| says | what is computed | when and where it is computed, and what moves between devices |
| lets you attribute | a measured kernel back to the module, layer or op that issued it, times its repeat count | a measured idle gap back to the copy, collective or sync point behind it |
| lets you check | whether the cost sits where the structure says the work is | whether what the code meant to overlap actually did |
The fields below are examples. Add what this job needs.
records/computation_graph.json| field | why it is there |
|---|---|
job_type: training, inference serving, or batch | each has a different skeleton. Do not assume training |
commit | every file:line below means nothing without the sha it was read at |
entrypoint | the step function, as a file:line |
modules, down to op level (model -> modules -> layers -> ops), each naming its enclosing parent and its execution order | findings land on ops, not on files |
shapes on the boundaries you can read | shape decides which kernel gets picked and how much memory the tensor takes |
code_anchor on every entry, written model/dit.py:DiTBlock.forward:214 | this is where a root cause has to land later. Symbol before line, so it survives an edit above it |
repeat on every unit that repeats: the unit and its count | a cost inside a unit multiplies by N. Rank by per-unit cost x N, never by one instance: forty blocks turn a millisecond into forty |
records/execution_schedule.json| field | what to record |
|---|---|
phases | startup, data, forward, backward, optimizer, periodic eval or checkpoint, teardown. Each with a kind of one-off, repeated or periodic, and who it runs_on |
data_path | every hop from disk to device: worker processes, collation, pinned staging, the copy itself. Mark which hops are asynchronous and which block the step |
host_device | the H2D and D2H copies, whether their source is pinned or pageable, and every sync point: .item(), .cpu(), .numpy(), .tolist(), torch.cuda.synchronize(), printing a tensor, any Python branch that reads one |
device_device | the collectives, each tagged with the parallelism it serves (data, tensor, pipeline, expert, sequence) and whether the call blocks or was issued with async_op=True |
compute | forward, backward, which blocks recompute under activation checkpointing, gradient accumulation, the optimizer step, and the torch.compile regions with the graph breaks between them |
overlap | what is supposed to run at the same time as what, and on which stream |
The plan has to descend: model, modules, layers, ops etc. A plan that stops at module level produces a graph that stops there too.
repeat count is worse than a
missing one, because everything downstream multiplies by it.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub openperfagent/who-ate-my-flops --plugin who-ate-my-flops9 skills in this plugin
/clean-upDeliver a finished optimization run as a branch the user can merge. Cherry-pick the commits that changed the workload onto the base, hardcode the A/B flags, re-verify on the shipped code, strip the checkpoint calls in a last commit, and leave the user standing on that branch with a handover./convert-to-benchmark-scriptTurn the script a user really runs into a benchmark script an optimization loop can run over and over. Same shape as the real job, a few minutes long, repeatable, and leaving nothing behind. It produces the script and a table of what changed, and it does not run it./diagnoseProfile the job defined in contract.md, name the one thing it loses most time to, and propose a single fix with a measured number behind it. It stops at the first finding. optimize is this same work repeated until nothing worth doing is left./initWork with the user to pin down which PyTorch job gets optimized, write contract.md, and put the correctness instrumentation in place. The optimize skill later reads the contract.md written here and optimizes on its own. Every piece of alignment with the user happens in init, all of it./optimizeOptimize the torch job defined in contract.md with no further input. Profile, edit, and check correctness in a loop, then hand back one clean optimized branch./publish-prWrite the pull request description and one issue for a finished campaign into proposed-pr-description.md and proposed-issue.md, for the user to review and post. Says what the PR may claim, what goes in each section and in what order, and how it is worded. Fills template/pr-description.md and template/issue.md; the filled examples are the .example.md files next to them. It pushes nothing and opens nothing.Other plugins' skills for the same job