Skip to content

πŸ”– chore: release 0.7.0 - #56

Merged
itdevwu merged 43 commits into
masterfrom
feat/v0.7
Nov 28, 2026
Merged

itdevwu merged 43 commits into
masterfrom
feat/v0.7

Conversation

@itdevwu

@itdevwu itdevwu commented Nov 28, 2026

Copy link
Copy Markdown
Owner

0.7.0: MEMCPY2 peer copies, stream-order matching, capture manifests, triggered capture (idle, gap, duration, latency), external CPython sampling, device idle and GPU UUIDs, wall-clock anchors, the xprobe-perf-profiling Skill installed from skills.sh, and the fixes from 0.7.0-dev.1 to dev.3 feedback.

Rebase-merge; the tag v0.7.0 goes on the merged commit.

Stream order paired each end with the first unused selected start after it, so a narrower end selector measured spans across kernels it never saw. It now finds each end's successor among every kernel, copy, and memset on the stream, captures all GPU activity to do so, accepts only end-to-start endpoints, and reports overlap, tied starts, and undecidable truncated names as ambiguous. Unmatched counts and the score now cover the whole window for every policy.
Event JSONL records only events, so offline correlation could not tell what a capture covered and re-read preserved failures as clean. Live artifacts now carry <artifact>.manifest.json with target identity, capture window, armed selectors, GPU activity and peer-copy coverage, losses, and the artifact's SHA-256. measure --input restores losses from it, rejects a stale one, and reports collection.coverage; merged inputs without manifests and stream order without proof of every GPU activity are cautioned.
A fixed window misses a spike that appears once a minute. measure --trigger-gap-ms, --trigger-duration-ms, and --trigger-latency-ms keep the newest --max-events CUPTI records in an Agent ring (control protocol v6, sequence-locked snapshots that report overwritten records) and evaluate every new span with measure's pairing rules. Each window around a span over the threshold is written with its capture manifest; windows that may overlap overwritten or dropped records are discarded and counted, and a timeout without a window reports the longest span seen as TRIGGER_NOT_OBSERVED.
Python stacks needed -X perf on CPython 3.12+ and perf-event access, which production containers often lack. measure --python-sample reads interpreter state with process_vm_readv, never stopping or injecting into the target: the GIL holder up to 2000 Hz and every thread at 100 Hz, for CPython 3.9 through 3.14. Offsets come from each version's internal headers, pinned by a fixture and checked at runtime against _Py_DebugOffsets on 3.13+. Torn stacks are discarded and counted, and results report achieved rates, read latency, and timestamped samples.
A GIL released to native code left Python sampling silent about where time went. Each all-thread sweep now reads a thread's /proc/<pid>/task/<tid>/syscall, symbolizes its program counter while the mappings are live, and groups blocked threads by system call, module, and symbol in native_waits.
analyze_trace.py --python-samples adds the GIL holder's stacks, per-thread counts, and native waits sampled inside a gap, outlier, or explicit slice, and warns when the slice's GPU timestamps are not normalized to CLOCK_MONOTONIC.
Triage on a CPython target now samples its GIL holder alongside CPU samples, reports the top Python hotspots and the share of ticks with the GIL released, and ranks a PYTHON_HOTSPOT finding. CPU_BOUND points at --python-sample instead of an interpreter restart with -X perf.
…d coverage

Ring writers and the snapshot reader now claim slots with CAS, so no two touch one slot body; a writer that cannot claim drops and counts its record, and readers report dropped indices as gaps. Exact-mode commit advance is bounded per callback. STOP always disables CUPTI. Triggered windows are clipped to the ARM-to-STOP coverage and marked truncated, and a failed capture or unknown records stop the trigger. Stream order tracks running activity by identity and treats gaps before an end without a captured start as ambiguous; the Agent keeps activity still running at ARM. Merged inputs prove full GPU coverage only when a wide capture's window holds every other input; duplicate inputs and manifests disagreeing with their events are errors.
…igned clocks

Python thread TIDs are keyed by thread state and pthread_t so a reused thread state cannot inherit another thread's TID, ambiguous pthread TID offsets leave threads unmapped, a GIL handoff during a read discards the sample, unexpected read errors are fatal, and unreadable native thread states are counted. analyze_trace.py places Python samples in a slice only when its clock evidence is CLOCK_MONOTONIC and only for processes in the trace. Artifact digests move from protocol to exporter and are computed only for manifests written. collection.coverage defaults to unverified for results written without it.
…merges honest

- Trigger: close windows while watching but cut them only after STOP and the
  final drain; re-check the firing span and count revoked windows; keep a
  closed window's trimmed records; start the window after the ARM reply, end
  it before STOP, skip spans that began before ARM, and check unknown and
  dropped records absolutely since ARM resets the counters.
- Ring: retry a stalled drain a bounded number of times and count an unread
  tail as overwritten; give a snapshot started before the deadline time to
  finish.
- Agent: judge activity clocks per capture from each activity's end, mark a
  reply host-clock only with bounded evidence, and keep the kernel/launch
  check linear in the reply.
- Stream order: keep zero-duration activity between its neighbours and key
  running activity by kernel name too.
- Offline: reject one PID with two process start times, repeated events
  across inputs by Event identity or CUPTI content, and manifests whose
  window ends before a host-clock event.
- Python: read the thread identity around every stack read, compare GIL
  switch_number before and after (offsets from 3.9-3.14 headers), retry the
  pthread offset each sweep, and propagate task-list and EIO errors.
- analyze_trace.py 1.3: gaps carry pid and clock domain; Python slices use
  only the gap's or outlier's process; device gaps group by clock domain.
… labels

- Trigger: a drop or overwrite reported after a window fired loses it; the
  open window holds at most twice the retention bound and a closed one at
  most the bound; spans are re-checked with context outside the window, and
  a run that ended early is completed rather than timed out.
- Agent: a STOP that cannot disable callbacks reports stop reason 5 and keeps
  serving so CLOSE can retry; the CLI returns CLEANUP_FAILED and keeps its
  cleanup guard. An unaligned clock verdict is final, and one capture never
  mixes activity clock labels.
- Stream order: a zero-duration activity is recognized by its start
  preceding its end in sequence, so back-to-back runs of one graph node keep
  their zero gap; two zero-duration starts at one instant are ambiguous.
- Offline: partial CUPTI snapshots count their missing records as dropped;
  inputs are deduplicated by event content apart from session, ID, and
  sequence; manifests naming one PID as two processes are rejected.
- Python 3.9/3.10: read the TID through pthread_t before and after each
  stack read; a frame-window read fails on anything but a fault.
- analyze_trace.py: a gap or outlier slice keeps only its process and
  comparable clocks.
- The Agent reads each CUDA ordinal's UUID from the target's driver and sends
  a device table after the capture header; results, manifests, and triage
  report it as cuda_devices.
- Triage judges only GPUs the target ran kernels on, matched by UUID, instead
  of applying the target's activity to every GPU on the host.
- measure --trigger-idle-ms fires when no stream of the target on a device is
  active; --trigger-gap-ms stays a single-stream gap.
- analyze_trace.py 1.4 reports per-device busy, idle, compute, communication,
  and communication-only time, stretches activity cut by the capture edges,
  and compares several ranks' budgets over their common window.
- Thread snapshots skip threads that exit while being read.
…edure

The Skill lists the evidence each command produces and, in
references/artifacts.md, the fields of every result and how they mislead, so
the user's agent chooses sources for its own hypotheses. Triage becomes one
optional broad look whose findings are hints. The README, its hero art,
multi-process guidance for unevenly loaded ranks, and AGENTS.md follow; a
contract test checks that every field the Skill names exists.
CUPTI tracks push levels only while NVTX callbacks are enabled, so when ARM
lands inside a nest, the pops of earlier pushes report a negative level. They
end ranges the capture never saw start and are no longer counted as unknown
records, which failed the whole measurement. The NVTX live test now also makes
every output readable so a failure shows the fixture's stderr.
Captures read CLOCK_REALTIME against CLOCK_MONOTONIC at start and end, with
the tightest of several bracketed reads, and report the anchors as wall_clock
in manifests and in measurement, graph, trigger, and Python sample results.
analyze_trace.py 1.5 prints UTC wall times beside host-clock timestamps so
events can be lined up with application logs, and warns when the wall clock
moved during the capture.
- Agent: read device UUIDs outside CUDA initialization and every Agent lock,
  never record the Agent's own driver calls, mark MIG instances with their
  physical GPU's UUID (48-byte entries), and keep a start record for activity
  still running at STOP. CUPTI reports no start for it, so the CLI places it
  at its stream's previous end with the start_unknown attribute instead of
  letting the device look idle.
- CLI: read the wall-clock start anchor before touching the target and treat a
  failed end anchor as a missing mapping; merge device tables that arrive in a
  later snapshot and restore them from manifests; triage attributes every
  kernel group by UUID before cutting the inline list.
- analyze_trace.py: verify manifests against their artifacts, report recorded
  losses, stretch edge activity to the manifest window, pair boundaries by
  event identity, clip summed activity to the compared window, warn on drift
  in multi-rank mode, compute stream gaps from all activity on the stream, and
  subtract intervals in one pass.
- Skill: artifact field paths are checked per artifact; correct the Python
  stack field names, schema version, and TRIGGER_NOT_OBSERVED wording.
- The burst test bounds by samples so a slow GPU cannot cut it short.
Rename `skills/xprobe-measure-latency` to `skills/xprobe-perf-profiling`
and refocus the Skill on exact JSON/JSONL artifact shapes, one-off
scripting, cross-process CLOCK_MONOTONIC alignment, and RSI loops instead
of prescribing investigation procedures or deployment builds:

- Replace `references/artifacts.md`, `references/multi-process.md`, and
  `references/setup.md` with `references/data-format.md` (stdout/artifact
  path table, real JSONL samples, pairing keys, wall-clock conversion, and
  Python scripting/RSI recipes) and a streamlined `references/selectors.md`.
- Drop 11 redundant single-edge/inventory JSON spec templates, keeping
  `examples/request-path-graph.json` and `examples/kernel-duration.json`.
- Update skill references in `AGENTS.md`, `CLAUDE.md`,
  `.cursor/rules/xprobe.mdc`, `README.md`, `docs/`, and the agent-contract
  and installation tests, adding JSON-block syntax validation while
  removing prose-pinning assertions.
Restructure `README.md` for human readers and discoverability:

- Lead with the ML infra / AI agent / RSI loop positioning and live Linux
  CPU, Python, syscall, and CUDA profiling tagline.
- Add a comparison table against `perf`/`uprobe`, `py-spy`, `nsys`, and
  `torch.profiler`, including honest boundaries for NVTX startup env and
  visual/hardware-counter handoff.
- Separate CLI installation (`pip install xprobe` and standalone archive)
  from AI Agent Skill installation, and add compact examples for Python
  GIL sampling, GPU aggregation, spike triggers, and one-off script/RSI
  piping.
Keep all technical rules and verification targets in `AGENTS.md`, while
replacing jargon and repetitive lists with plain engineering language
(e.g. compacting the `just` recipe list and removing rules already
covered in the Skill and `docs/releasing.md`).
Redraw `docs/assets/xprobe-flow-{light,dark}.svg` and
`docs/assets/social-preview.svg` via `scripts/render-readme-art.py`:

- Replace the old single-graph terminal with an illustrative RSI loop:
  valid live GPU trigger + Python sampling commands, an aligned
  `CLOCK_MONOTONIC` timeline showing exact `launch β†’ kernel` correlation
  arcs alongside a Python GIL stall / GPU idle bubble, an agent JSONL
  slicing step, and a before/after verification diff (`KEEP βœ“`).
- Use seamless 6.2s loop keyframes (`0% == 100%`) with a live timeline
  scan cursor and synchronized 4-step pill highlights.
- Embed compact ASCII+symbol WOFF2 subsets of Maple Mono and Geist
  (SIL OFL-1.1) from `docs/assets/fonts/` so GitHub `<img>` renders
  consistently offline and across platforms; note the caption and font
  attribution in `README.md`.
Reconcile all `docs/*.md` pages against the current implementation and
tighten repetitive or overly defensive prose:

- `docs/cli-contract.md`: fix the schema version breakdown (`3.0` / `2.0`
  / `1.0`) against `xprobe/protocol/src/`, break up long paragraphs, and
  drop the legacy pre-1.0 compatibility footnote.
- `docs/architecture.md`: update CUPTI control protocol to v6, document
  external CPython sampling, triggered ring capture, and wall-clock/UUID
  manifests, and fix schema version consistency.
- `docs/cupti-agent.md`: fix the stale two-filter line to match
  `XPROBE_CUPTI_FILTER_COUNT` (8) and split the ABI wall of text into
  scannable sections.
- `docs/installation.md`, `docs/development.md`, `docs/benchmarks.md`,
  `docs/releasing.md`, `docs/agent-integration.md`: align installation
  with the current CLI + Skill split, replace stale Skill/route notes
  with a complete `just` test table, and keep version references aligned
  with `0.7.0-dev.2`.
Record the writing style preference in `AGENTS.md` so future edits to
docs, Skills, and comments stay direct, drop historical version notes,
and avoid repetitive jargon or defensive filler.
…gger windows

- Agent: CUPTI can hand over an in-flight activity at STOP with a start the
  timestamp callback never converted. Keep that start only when it falls
  between ARM minus the clock margin and now; otherwise mark it unknown.
  In-flight starts are flagged and skipped by the snapshot clock check, so one
  unfinished record no longer turns a whole capture unaligned.
- analyze_trace.py: match communication kernels with an unanchored `nccl`, so
  mangled names such as `_Z40ncclDevKernel_AllReduce...` count.
- Trigger: recompute span counts and the longest span from the latest records
  on every evaluation, keeping counts for spans whose records left retention.
  A window whose span no longer crosses the threshold is revoked right away
  and its slot reopens, so capture keeps waiting until the timeout.
…ns directly

- Agent: every activity still running at STOP gets an unknown start. CUPTI's
  start for it may be missing or unconverted, and no range check tells the
  two apart, so the CLI places it at its stream's previous end.
- Correlator: starts known only as running at STOP mark their stream busy
  and are never selected as measured endpoints.
- Trigger: check a fired idle span or stream gap directly against the
  activity of its device or stream, including activity whose other boundary
  is missing, so trimmed context no longer revokes a valid window and lost
  windows stay lost. Revoke before firing so a freed slot can take a span
  from the same read; only fired spans are marked seen. Settle span counts
  from the records as they stand before trimming. Read once more after the
  last window closes before stopping.
- Simplify `scripts/render-readme-art.py` layout: drop redundant labels
  and footer noise, tighten card headers, condense the agent script card
  to three lines, and center the RSI before/after bars.
- Unify the tagline across `README.md` and `docs/assets/social-preview.*`
  around "Minimizing friction on the path to RSI."
- Update `docs/assets/xprobe-flow-{light,dark}.svg`,
  `docs/assets/social-preview.svg`, and `docs/assets/social-preview.png`.
…er them

Everything read before a window fired was already part of the spans that
fired it, so only later records can contradict an idle span or a stream gap:
a boundary inside it, a later activity that ran across it (paired across
reads), or a start still running at STOP that began before its end. This
needs no trimmed context and is not fooled by CUDA Graph nodes that share a
correlation ID. Latency and duration windows are re-paired while their
records are retained and again when cut.

Spans are computed once per evaluation and reused to settle counts before
trimming. A closed or revoked window schedules another evaluation, so a span
already read can take the freed slot without new records. Starts known only
as running at STOP no longer pair in activity durations or the analyzer.
- README and agent-integration.md point to `npx skills add itdevwu/xprobe`;
  installation.md keeps the tag-pinned and non-interactive commands.
- AGENTS.md notes that skills.sh installs from `master`, so Skill
  development uses the local checkout or a tag URL.
- The contract test checks the short command in all three docs and the
  pinned URL only in installation.md.
`just lint-commits` checks commits not yet on master: titles fit in 72
characters so GitHub shows them whole, follow emoji conventional commits,
and bodies wrap at 80. A one-line commit passes.
pip reads the simple index, which PyPI's CDN serves stale for about ten
minutes after an upload, so the check waited that long. The per-version
JSON is fresh on its first request. The step now downloads the wheel it
lists and checks its SHA-256 against the wheel this run built.
@itdevwu
itdevwu merged commit f968b88 into master Nov 28, 2026
7 checks passed
@itdevwu itdevwu added this to the v0.7 milestone Nov 28, 2026

This branch had an error being deployed

1 failed deployment
pypi β€” f968b888 Deployed Nov 28, 2026 by itdevwu via pypi #21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant