Skip to content

πŸ”– chore: release 0.7.1 - #64

Merged
itdevwu merged 22 commits into
masterfrom
feat/v0.7.1
Dec 2, 2026
Merged

itdevwu merged 22 commits into
masterfrom
feat/v0.7.1

Conversation

@itdevwu

@itdevwu itdevwu commented Dec 2, 2026

Copy link
Copy Markdown
Owner

xprobe 0.7.1. Rebase-merge, then tag the merged commit v0.7.1.

Sampling

  • --python-sample keeps every sample. The GIL holder is sampled at 999 Hz. Thread sweeps run at up to 100 Hz, within 6,400 reads/s. Stack groups, hotspots, and native waits report estimated_ns, and each sweep sample counts its own sweep's interval. --python-threads-hz 0 turns sweeps off.
  • --cpu-sample defaults to 999 Hz and keeps every sample. --max-samples is removed. The JSONL artifact holds frame lines, stack lines (addresses only), and time-ordered samples with CLOCK_MONOTONIC timestamp_ns and on-CPU cpu_ns. analyze_trace.py --cpu-samples places them in a trace slice; the analyzer reads sample files line by line. Closes Align CPU stack samples with offline trace windowsΒ #52.

CUDA

  • --match exact pairs any CUDA API with the kernel, memcpy, or memset it issued, by CUPTI correlation ID. Context is not part of the pairing key.
  • Memcpy events and aggregates carry src_memory / dst_memory (pageable, pinned, device, managed, ...).
  • --aggregate reports a quality verdict.
  • A second session gets CUPTI_AGENT_BUSY instead of taking over a running capture. The Agent claims itself before it restarts.
  • A loaded Agent is reused even after its file is deleted. validate warns CUPTI_AGENT_ALREADY_LOADED.
  • discover lists procfs_hints when NVML reports PIDs from another PID namespace.

CLI

  • xprobe --help lists every mode with an example, and measure --help groups options by mode.
  • A live measure prints the defaults it used on stderr.
  • Hints name the flag to change.
  • Triage measures thread and cgroup time over the requested window and reports elapsed_ms.

CI

  • The CUDA containers and the CPU benchmark install packages from the Azure Ubuntu mirror.

Verification

On the NVIDIA dev machine, at 7dc5296:

  • fmt-check, lint, test, and test-agent-contract;
  • CUPTI live tests on CUDA 13, 12, and the CUDA 12 minimum, plus the burst test;
  • injection live tests on CUDA 13 and 12;
  • CPU, NVTX, multisource, trigger, Python-sample, PyTorch CUDA, and triage live tests;
  • benchmark-gpu, benchmark-cpu, benchmark-python-sampling, and test-release-live.

All passed. The Agent also builds with -Werror in both pinned Ubuntu 22.04 CUDA images. The later docs and version commits passed test-agent-contract and lint-commits.

A second measure on the same target used to restart the Agent or re-ARM
it, dropping the first session's capture without an error. The session
that sends ARM now owns the capture, identified by the peer PID and start
time on the control socket. While it runs, agent start returns BUSY and
commands from other processes get stop reason 6; the CLI reports
CUPTI_AGENT_BUSY. An owner that exited without STOP gives way.

A CUPTI subscriber held by another tool (torch.profiler, Nsight, cuda-gdb)
now reports stop reason 7, and the CLI names those tools in its hint.
- Separate kernel and memcpy --aggregate commands, fix exact policy scope,
  and show how to join CUDA API and memcpy events by correlation_id offline.
- Document --python-sample thread capacity sizing, --cpu-sample tuning,
  completeness checks beyond status == completed, container discover
  fallback, triage window duration, and keeping libxprobe-cupti.so on disk
  while injected targets remain running.
- Relax Skill word budgets in test_contract.py (1200 / 8000), sync new
  schema/attribute checks, and tighten prose across docs and Skill files.
A kernel, copy, or memset carries the CUPTI correlation ID of the API
call that issued it, but validate allowed exact pairing only between
launch APIs and kernels. Any Runtime or Driver API endpoint now pairs
exactly with kernel, memcpy, or memset endpoints. A Driver API endpoint
warns DRIVER_API_CORRELATION: activity carries the outermost call's ID,
so it matches only work issued through the Driver API directly.

The Skill drops the two-graph join workaround and shows how to attribute
copies to the API call and the Python stack sampled before it.
Pageable or pinned host memory was reported only by --aggregate. The
Agent now stores a copy's CUPTI memory kinds in its exact record and
sets XPROBE_CUPTI_FEATURE_MEMORY_KINDS for every capture; the CLI writes
them as attributes.src_memory and attributes.dst_memory on memcpy events.
The output ABI version does not change: older readers ignore the fields.
Aggregate results had no quality object, so a script had to check them
differently from every other mode. An aggregate that returns counted every
activity, so its verdict is good; NAME_TRUNCATED notes groups whose
kernel names were cut at 127 bytes and may hold several kernels.
--python-sample stopped keeping samples at a capacity sized for 64
threads, so a process with many threads kept only the start of the
window while reporting completed. Samples now hold an index into the
distinct stacks, every one is kept, and the JSONL is written as it is
produced rather than built in memory. Read times go into fixed buckets.

The GIL holder is sampled at 999 Hz by default. Sweeps of every thread
run up to 100 times a second and slow down to stay within 6,400 stack
reads a second; --python-threads-hz fixes the rate and 0 turns sweeps
off. Stack groups, hotspots, native waits, and GIL release time carry
estimated_ns, and collection reports sweep_reads_per_second. Triage
uses the same defaults.
--cpu-sample stopped at --max-samples and listed hotspots computed only
from the groups that fit --max-groups, so short captures looked sparse
and long ones lost samples. Every sample is now kept, stamped on
CLOCK_MONOTONIC with its perf period, and written to --events-out as
JSONL: each stack once, then the samples that use it. --max-samples is
gone; --max-groups only sets how many groups and hotspots are listed.
Groups and hotspots give estimated_ns from perf periods, and collection
reports cpu_time_ns and elapsed_ns. The default rate is 999 Hz, in
triage too.

analyze_trace.py --cpu-samples adds the on-CPU stacks sampled inside a
gap, outlier, or time slice, ranked by CPU time.
measure read the loaded Agent's ELF file to find its start function, so
deleting the install directory, as when a temporary venv is removed, made
every later CUDA capture of that process fail until it restarted. measure
now asks the target's loader for the Agent by the name it was loaded under
(dlopen with RTLD_NOLOAD) and takes the start function from dlsym, without
reading the file.

validate warns CUPTI_AGENT_ALREADY_LOADED with agent_path and file_deleted
when a target holds an Agent, and the docs state what a loaded Agent keeps
between captures: its mapping and the last capture's record buffers.
Inside a container NVML names CUDA processes by host PID, so discover
found nothing. When none of NVML's processes are visible, discover now
lists procfs_hints: processes at or below the root that map libcuda or
hold /dev/nvidia* files open, with that evidence. They are kept apart from
candidates, which stay NVML-confirmed context holders: loading CUDA or
opening a device does not show a context.
Triage read thread and cgroup counters before every source started and
after the slowest finished, including attach and symbol analysis, so a
2 s triage reported a 10 s window and diluted thread shares. The counters
now span exactly --duration-ms in their own thread; window_ms is that
window and the new elapsed_ms is the whole command. The readable output
presents findings as rule-based leads to check against the data.
xprobe --help named only the four commands, so a caller could not tell
that measure samples Python and CPU stacks, counts syscalls and GPU work,
waits on triggers, or triages. The top-level help now ends with one line
per common measurement. measure --help groups its options by mode and
ends with the selector syntax, the policies, and examples. A live measure
prints the defaults it fell back on as `xprobe: defaults: ...` on stderr,
so a sparse or truncated result points at the flag to change. Hints name
the flags to adjust, and a policy error names the policy to use.
A start checked for a live session and then restarted the Agent, so a
second measure could pass the check before the first sent ARM and then
close its socket. The check now also claims the Agent; while it restarts,
every command, including another start, is busy.

Captures of GPU activity alone registered CUPTI activity callbacks without
subscribing, so on a process torch.profiler or Nsight was profiling they
replaced that tool's buffer callbacks instead of reporting the conflict.
Every capture now subscribes first and fails with the conflict.
Sweeps slow down as threads are added, but estimated_ns gave every sweep
sample the run's average interval, so time before a thread pool grew was
overstated and time after it understated. The sampler records when each
sweep starts, and a sweep sample now counts the interval until the next
sweep, or the end of the run.
CPU sample JSONL now lists each distinct frame once by address, and stack
lines refer to frames by address. Only the listed stack groups are built
from frames. analyze_trace.py reads sample files line by line and keeps
only samples inside the slice from the slice's processes.
measure called dlopen with RTLD_NOLOAD in the target for every reuse. It
now reads the start function from the mapped Agent file, as before, and
asks the target's loader only when the file was deleted.
Reading every thread's counters takes a while on processes with many
threads. The window now runs from the middle of the first snapshot to the
middle of the last, and cgroup counters are read right around the sleep.
- Trim over-detailed install verification phrasing and repeated JSON/JSONL
  suffixes in README.md, and add memcpy and --cpu-samples examples.
- Update SKILL.md for CPU sample CLOCK_MONOTONIC alignment, keep the pip
  install hint, and state explicit read-only / user-scoped boundaries.
- Note discover procfs_hints and fix a minor typo in docs/architecture.md.
@itdevwu itdevwu added this to the v0.7.1 milestone Dec 2, 2026
@itdevwu itdevwu changed the title πŸ”– xprobe 0.7.1 πŸ”– chore: release 0.7.1 Dec 2, 2026
@itdevwu
itdevwu merged commit 3b1918b into master Dec 2, 2026
18 checks passed
@itdevwu
itdevwu deleted the feat/v0.7.1 branch December 3, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Align CPU stack samples with offline trace windows

1 participant