# Single-worker attention compiler flamegraph

Outputs:

* `attention-compiler-functions.svg`: function-level view, without inline frames.
* `attention-compiler.svg`: full inline-frame view.

This is a new recording of the batch-one SigLIP attention compiler with automatic
attention/product plans. No IPU workload is executed. Width is sampled CPU time.
Click frames to zoom and use Search to highlight function names.

`RAYON_NUM_THREADS=1` controls the global Rayon pool. The planner has a separate
pool capped at eight workers using `available_parallelism()`, so the process was
also pinned to CPU 24 with `taskset -c 24`. This makes both pools use one worker
and prevents concurrent CPU execution. The aborted environment-only recording is
kept under `aborted-pool-check*`; it is not used in these flamegraphs.

The optimized profiling build includes full debug symbols, frame pointers, and
native CPU instructions, isolated in `target/flamegraph`.

After sourcing the local Poplar SDK's `enable.sh`, run from the repository root:

```bash
CARGO_TARGET_DIR=target/flamegraph \
CARGO_PROFILE_RELEASE_DEBUG=true \
CARGO_BUILD_JOBS=16 \
RUSTFLAGS='-C target-cpu=native -C force-frame-pointers=yes' \
RAYON_NUM_THREADS=1 \
taskset -c 24 cargo flamegraph -p ipu-tests --bin ipu-trivial-test \
  --deterministic --image-width 1800 --min-width 0.2 \
  -c 'record -F 99 --call-graph fp' \
  -o artifacts/compiler-perf/flamegraph-single/attention-compiler.svg -- \
  c600-init.ipucfg --device-lock artifacts/layout-sweep/device.lock \
  --package artifacts/compiler-perf/flamegraph-single/model.ipuexe \
  --workload siglip-attention-benchmark --attention-strategy auto \
  --attention-batch 1 --attention-products auto --inspect-exchanges \
  > artifacts/compiler-perf/flamegraph-single/run.log 2>&1
mv perf.data artifacts/compiler-perf/flamegraph-single/perf.data
flamegraph --perfdata artifacts/compiler-perf/flamegraph-single/perf.data \
  --no-inline --deterministic --image-width 1800 --min-width 0.2 \
  -o artifacts/compiler-perf/flamegraph-single/attention-compiler-functions.svg
```
