Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ See [docs/quickstart.md](docs/quickstart.md) for the full walkthrough (including
| `ledger sass` | Look up the SASS instruction behind a dead store from a cubin directory, function, and PC offset. |
| `ledger perturb-plan` / `perturb-report` | Generate and summarize replay memory-poisoning experiments (e.g. Sibyl `replay_perturb`). |
| `ledger sibyl-regions` | Convert a Sibyl recording's address ranges into Ledger's `regions-*.json` memory map. |
| `ledger ascend-import` | Convert Huawei Ascend CANN `msprof` + `aclGraph` dumps and weight/KV maps into a Ledger capture. |

## Documentation

Expand Down
22 changes: 22 additions & 0 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,25 @@ For a [Sibyl](https://github.com/GeetoRinku/sibyl) replay, which preserves recor
ledger sibyl-regions <recording>/ranges-rank0-<pid>.json out
LD_PRELOAD=$(ledger build) LEDGER_OUT=out LEDGER_GRAPH_WINDOW=8:44 <replay program> ...
```

---

## Huawei Ascend CANN (`msprof` + `aclGraph`)

To analyze an Ascend NPU run exported with `msprof --export=on`, import its `op_summary_*.csv`
(and optional `task_time_*.csv`), `aclmdlRIDebugPrint` graph dumps (`--graph`), and weight / KV
descriptor maps (`--weights`, `--draft-weights`, `--owners`, or `--regions`):

```sh
ledger ascend-import <msprof PROF_* dir> out \
--graph capture.json --graph draft-graph.json \
--weights target_weights.json --draft-weights draft_weights.json --owners owners.json \
--device "Ascend 910B1" --sms 24 --steps 1 --batch 8 --draft-tokens 7

ledger analyze out --ceiling-gbps 1350 --peak-tflops bf16=320,int8=640 --out out/report.md
ledger transfers out --steps 1 --out out/transfers.md
ledger perfetto out --ceiling-gbps 1350 --out out/trace.json
```

msprof does not record the size or direction of `MEMCPY_ASYNC` tasks: `ledger transfers` reports
their times, but the copies are imported with 0 bytes and labelled DtoD.
6 changes: 4 additions & 2 deletions ledger/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def busy_and_gaps(rows):


MARKER = "spin_kernel" # torch.cuda._sleep, launched by examples/vllm_decode.py at the start of each step
DRAFT = ("speculator.", "drafter.", "spec_decode_model.")
DRAFT = ("speculator.", "drafter.", "spec_decode_model.", "draft.")


def split_steps(rows):
Expand Down Expand Up @@ -252,6 +252,8 @@ def precision(dtype):
return "bf16", 1
if dtype == "uint8":
return "fp4", 2
if dtype == "int8":
return "int8", 1
return dtype, 1


Expand All @@ -275,7 +277,7 @@ def gemm_flops(r, run):
return cls, m, 2 * m * elements


ACT_BYTES = {"fp8": 1, "bf16": 2, "fp4": 0.5} # input activation element, by the weight's compute class
ACT_BYTES = {"fp8": 1, "bf16": 2, "fp4": 0.5, "int8": 1} # input activation element, by the weight's compute class


def act_bytes(r, run):
Expand Down
Loading
Loading