Repository navigation
π chore: release 0.7.1 - #64
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
xprobe 0.7.1. Rebase-merge, then tag the merged commit
v0.7.1.Sampling
--python-samplekeeps 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 reportestimated_ns, and each sweep sample counts its own sweep's interval.--python-threads-hz 0turns sweeps off.--cpu-sampledefaults to 999 Hz and keeps every sample.--max-samplesis removed. The JSONL artifact holds frame lines, stack lines (addresses only), and time-ordered samples withCLOCK_MONOTONICtimestamp_nsand on-CPUcpu_ns.analyze_trace.py --cpu-samplesplaces 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 exactpairs any CUDA API with the kernel, memcpy, or memset it issued, by CUPTI correlation ID. Context is not part of the pairing key.src_memory/dst_memory(pageable, pinned, device, managed, ...).--aggregatereports a quality verdict.CUPTI_AGENT_BUSYinstead of taking over a running capture. The Agent claims itself before it restarts.validatewarnsCUPTI_AGENT_ALREADY_LOADED.discoverlistsprocfs_hintswhen NVML reports PIDs from another PID namespace.CLI
xprobe --helplists every mode with an example, andmeasure --helpgroups options by mode.measureprints the defaults it used on stderr.elapsed_ms.CI
Verification
On the NVIDIA dev machine, at 7dc5296:
fmt-check,lint,test, andtest-agent-contract;benchmark-gpu,benchmark-cpu,benchmark-python-sampling, andtest-release-live.All passed. The Agent also builds with
-Werrorin both pinned Ubuntu 22.04 CUDA images. The later docs and version commits passedtest-agent-contractandlint-commits.